p5 touch input code example
Example: p5 touch input
// 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;
}
}