This is an old revision of the document!
Marcus's crazy dog.js
// Where is the circle
let x, y;
function setup() {
createCanvas(600, 470);
// Starts in the middle
x = width / 2;
y = height;
}
function draw() {
background(20);
// Draw a circle
stroke(50);
fill(10, 255, 68)
ellipse(x+98,y+100,100)
ellipse(x+55,y+60,45)
ellipse(x+135,y+60,45)
fill(0,255,150)
ellipse(x+135,y+100,35)
fill(0,255,150)
ellipse(x+100,y+100,35)
fill(0, 189, 35)
ellipse(x+120,y+125,15)
// Jiggling randomly on the horizontal axis
x = x + random(-1, 1);
// Moving up at a constant speed
y = y - 1;
// Reset to the bottom
if (y < 0) {
y = height;
}
}