xxxxxxxxxx
130
function setup() {
createCanvas(400, 400);
r = random(0,255);
g = random(0,255);
b = random(0,255);
}
var x = 100;
var y = 10;
var s = 100; // size
function mousePressed() {
save('week7animation.jpg'); }
function draw() {
background(1000)
// Draw snowman's arms
strokeWeight(4);
stroke(139, 69, 19); // brown color
line(170, 270, 100, 240); // left arm
line(230, 270, 300, 240); // right arm
// Draw snowman's body
stroke("black")
strokeWeight(1);
fill(r, g, b)
ellipse(200, 350, 150, 150); // bottom circle
ellipse(200, 250, 100, 100); // middle circle
ellipse(200, 170, 70, 70); // top circle
// Draw snowman's eyes
noStroke()
fill(0);
ellipse(180, 160, 10, 10); // left eye
ellipse(220, 160, 10, 10); // right eye
// Draw snowman's nose
fill(255, 165, 0); // orange color
triangle(200, 160, 195, 180, 205, 180); // carrot nose
// Draw snowman's mouth
noFill();
stroke(255, 0, 0); // red color
strokeWeight(2);
arc(200, 190, 20, 15, 0, PI); // smile
// Draw snowman's buttons
noStroke()
fill(0);
ellipse(200, 260, 10, 10); // top button
ellipse(200, 330, 10, 10); // middle button
ellipse(200, 370, 10, 10); // bottom button
// Draw snowman's hat
fill(0);
rect(160, 130, 80, 20); // brim
rect(180, 110, 40, 30); // top
//snow ( )
fill("skyblue")
ellipse(x-90, y, 30);
ellipse(x, y, 20);
ellipse(x+100, y, 20);
ellipse(x+150, y+10, 20);
ellipse(x+200, y-10, 10);
ellipse(x+250, y+25, 0);
ellipse(x+300, y-14, 25);
ellipse(x+350, y, 10);
ellipse(x-40, y, 20);
ellipse(x+180, y+50, 20);
ellipse(x+250, y-30, 40);
ellipse(x+290, y+75, 30);
ellipse(x+40, y-14, 25);
ellipse(x+370, y, 40);
y += 2;
if (y > height) {
y = 0;
}
//snow
//// random ellipse
if (frameCount % 30 === 0) {
r = random(0,255);
g = random(0,255);
b = random(0,255);
}
// random ellipse
}