xxxxxxxxxx
34
// make ball respawn where it started after it leaves the canvas
// an actual in class demo from my CCL class.
let dia = 50;
let x
let y;
function setup() {
createCanvas(400, 400);
x = width/2;
y = 0;
frameRate(1)
}
function draw() {
background("violet");
noStroke();
circle(x, y, dia);
console.log("dia", dia) // HERE IS CONSOLE.LOG for dia
y = y + 1;
if (y > width) {
y =- y;
console.log(y) // TRY CONSOLE.LOG for y HERE
}
console.log(y) // CONSOLE.LOG for y HERE?
}
// function mousePressed() {
// if (dia < 100) {
// dia += 50;
// } else {
// dia = 50;
// }
// }