Private
thePrivate
_accelPrivate
boundStatic
initInitialize Accel functionality in your WebChucK instance.
This adds a Accel
and AccelMsg
class to the ChucK Virtual Machine (VM).
Accelerometer event (DeviceMotionEvent) listeners are added if enableAccel
is true (default).
theChuck = await Chuck.init([]);
accel = await Accel.init(theChuck); // Initialize Accel
Introducing Accel (accelerometer, on mobile) support for WebChucK. Accel wraps JavaScript
DeviceMotionEvent
listeners easing access to mobile device accelerometers in WebChucK code.To get started with Accel:
The
devicemotion
event gives the acceleration of the device on the three axes: x, y, and z. Acceleration is expressed in m/s². More on thedevicemotion
event can be found online here.iOS devices require that the web developer ask permission from the user to access sensors after a button push. This looks like: