xxxxxxxxxx
23
let value = 0;
let y = 25;
function draw() {
background(255);
fill(value);
rect(25, y, 50, 50);
}
function keyPressed() {
// if you press up, move up
if (keyCode === UP_ARROW){
y = y - 10;
}
if (keyCode === LEFT_ARROW) {
value = 255;
} else if (keyCode === RIGHT_ARROW) {
value = 0;
}
}