deviceMoved

Static deviceMoved 

Source
pub static deviceMoved: DeviceMovedInternalType
Expand description

The deviceMoved() function is called when the device is moved by more than the threshold value along X, Y or Z axis. The default threshold is set to 0.5. The threshold value can be changed using setMoveThreshold().

Examples

// Run this example on a mobile device
// Move the device around
// to change the value.

let value = 0;
function draw() {
  fill(value);
  rect(25, 25, 50, 50);
}
function deviceMoved() {
  value = value + 5;
  if (value > 255) {
    value = 0;
  }
}