Snowbot

The Code


// declare variables
//colors
float r;
float g;
float b;
float a;

//construction
float circW = width/2;
float circH = height;
float x;
float y;

void setup() {
rectMode(CENTER);
size(400,400);
background(200);
smooth();
frameRate(30);
}
void draw() {

// snow
for (int i=0; i<400; i++) { noStroke(); // pick a random color r = random(240,255); g = random(240,255); b = random(240,255); a = random(20,255); circW = random(1,3); circH = random(1,3); x = random(width); y = random(height); // create a random colored line of random dimensions fill(r,g,b,a); ellipse(x,y,circW,circH); } } // if the mouse is pressed, redraw the background void mousePressed() { // body and arms stroke(255); fill(150); // make it grey rect(mouseX,mouseY,50,30); //body is 50x30 ellipse(mouseX-30,mouseY-5,10,10); ellipse(mouseX+30,mouseY-5,10,10); // legs rect(mouseX-10,mouseY+20,10,10); rect(mouseX+10,mouseY+20,10,10); // head rect(mouseX,mouseY-22.5,40,15); // head is 40x15 // eyes fill(255); // make the eyes white ellipse(mouseX-9,mouseY-24.5,5,5); ellipse(mouseX+9,mouseY-24.5,5,5); // mouth rect(mouseX,mouseY-18.5,20,3); }