[−][src]Static p5_sys::global::touchStarted
pub static touchStarted: TouchStartedInternalType
The touchStarted() function is called once after every time a touch is
registered. If no touchStarted() function is defined, the mousePressed()
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
// Touch within the image to change // the value of the rectangle let value = 0; function draw() { fill(value); rect(25, 25, 50, 50); } function touchStarted() { if (value === 0) { value = 255; } else { value = 0; } }
function touchStarted() { ellipse(mouseX, mouseY, 5, 5); // prevent default return false; }
// returns a TouchEvent object // as a callback argument function touchStarted(event) { console.log(event); }
Parameters
event?
optional TouchEvent callback argument.