Static p5_sys::global::touchMoved[][src]

pub static touchMoved: TouchMovedInternalType
Expand description

The touchMoved() function is called every time a touch move is registered. If no touchMoved() function is defined, the mouseDragged() function will be called instead if it is defined.

Browsers may have different default behaviors attached to various touch events. To prevent any default behavior for this event, add "return false" to the end of the method.

Examples

// Move your finger across the page
// to change its value

let value = 0;
function draw() {
  fill(value);
  rect(25, 25, 50, 50);
}
function touchMoved() {
  value = value + 5;
  if (value > 255) {
    value = 0;
  }
}
function touchMoved() {
  ellipse(mouseX, mouseY, 5, 5);
  // prevent default
  return false;
}
// returns a TouchEvent object
// as a callback argument
function touchMoved(event) {
  console.log(event);
}

Parameters

event? optional TouchEvent callback argument.