Skip to content

Instantly share code, notes, and snippets.

View luruke's full-sized avatar

Luigi De Rosa luruke

View GitHub Profile
@luruke
luruke / button.js
Last active October 25, 2019 12:23
import {
Mesh,
PlaneBufferGeometry,
RawShaderMaterial,
} from 'three';
import dom3D from '../dom3D';
import scene from '../scene';
import textures from 'gl/utils/textures';
import { Object3D } from 'three';
import { component } from 'bidello';
import { viewport, scroll } from './bidello';
import camera from './camera';
export default class extends component(Object3D) {
init() {
this.element = this._args[0];
}
/**
* Try to fix iOS lock on audio.
*
* By default, audio on iOS is locked until a sound is played within a user interaction,
* and then it plays normally the rest of the page session.
*/
// Inspired from https://github.com/goldfire/howler.js/blob/2.0/src/howler.core.js#L212
export default class IosUnlock {
$0 = 10 (Step pulse time, microseconds)
$1 = 25 (Step idle delay, milliseconds)
$2 = 0 (Step pulse invert, mask)
$3 = 1 (Step direction invert, mask)
$4 = 0 (Invert step enable pin, boolean)
$5 = 1 (Invert limit pins, boolean)
$6 = 0 (Invert probe pin, boolean)
$10 = 2 (Status report options, mask)
$11 = 0.010 (Junction deviation, millimeters)
$12 = 0.002 (Arc tolerance, millimeters)