xxxxxxxxxx
20
/* I want to create a flashlight effect for a party. My current sketch fades the screen from black to white. Help me repair the conditionals so that the screen would infinitely bounces between black and white. */
let c = 0;
let v = 1
function setup() {
createCanvas(400, 400);
}
function draw() {
background(c);
c = c + v
if (c < 1) {
v = 1;
} else if (c > 255) {
v = -1;
}
}