Answers for "p5 touch input"

0

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;
  }
}
Posted by: Guest on February-20-2021

Browse Popular Code Answers by Language