Answers for "p5js check for keyboard keys"

1

p5js check for keyboard keys

let value = 0;
function draw() {
  fill(value);
  rect(25, 25, 50, 50);
}
function keyTyped() {
  if (key === 'a') {
    value = 255;
  } else if (key === 'b') {
    value = 0;
  }
  // uncomment to prevent any default behavior
  // return false;
}
Posted by: Guest on June-17-2020

Code answers related to "Javascript"

Browse Popular Code Answers by Language