xxxxxxxxxx
43
let y = 100;
let redVal = 0;
function setup() {
createCanvas(400, 400);
}
function draw() {
if(redVal > 0) {
background(redVal, 0, 0);
} else {
background(0, 200, 240);
}
fill(0, 200, 24);
stroke(255, 100, 0);
strokeWeight(15);
point(mouseX, mouseY);
strokeWeight(6);
y = y + 1;
let rnd = round(random(1, 3));
let onGround = y > height;
if(onGround) {
y = 0;
if(rnd == 1) {
redVal = 200;
} else if(rnd == 2) {
redVal = 100;
} else {
redVal = 255;
}
}
ellipse(mouseX, y, 56, 56);
rect(300, 300, 100, 100);
line(mouseX, mouseY, 300, 300);
line(mouseX, mouseY, 300, 400);
line(mouseX, mouseY, 400, 300);
}