xxxxxxxxxx
48
function setup() {
cnv = createCanvas(800, 200);
angleMode(DEGREES);
}
function draw() {
background("black");
for (let i=0; i<9;i++){
drawPlanet((frameCount+100*i) % width,15,"#99CEE6","#7B919B")
}
}
function drawPlanet(x,y,c1,c2) {
// mia
// background("#555758");
push();
translate(x,50+y);
rotate(sin(frameCount*5)*15);
scale(0.5);
fill(c1);
noStroke();
ellipse(x, y, 200);
beginShape();
translate(x, y);
noFill();
strokeWeight(10);
stroke(c2);
vertex(-120, 0);
bezierVertex(-30+300, y+100, 50, 100, 120, 0);
endShape();
pop();
}
function keyPressed() {
// this will download the first x seconds of the animation!
if (key == "s") {
saveGif("800x80", 5);
}
if (key == "c") {
saveCanvas(cnv, "myCanvas.png");
}
}