[][src]Static p5_sys::global::touchEnded

pub static touchEnded: TouchEndedInternalType

The touchEnded() function is called every time a touch ends. If no touchEnded() function is defined, the mouseReleased() 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

// Release touch within the image to
// change the value of the rectangle

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

Parameters

event? optional TouchEvent callback argument.