xxxxxxxxxx
32
let x, y;
function setup() {
createCanvas(720, 400);
// Starts in the middle
x = width / 2;
y = height;
textSize(20);
textAlign(LEFT);
}
function draw() {
background(200);
// Draw a circle
stroke(50);
fill(100);
ellipse(x, y, 24, 24);
// Moving up at a constant speed
y = y - 1;
// Reset to the bottom
if (y < 0) {
y = height;
}
noStroke();
text(frameCount, 50, height / 2);
text("this is the Math.sin of frameCount divided by 100: " + Math.abs(Math.sin(frameCount/100)), 50, 50 + height / 2);
x = Math.abs(Math.sin(frameCount/100) * width)
}