float x =100; float y = 350; float speedX = 5; float speedY = 3; void setup() { size(602, 505); background(255); //for (int i=0; i<20; i=i+1) { // } } void draw() { if (mousePressed) { float red = random(255); float green = random(255); float blue = random(255); face(random(width), random(height), random(20, 200), color(red, green, blue)); } if (keyPressed) { background(255); } //face(348, 52, 150, color(255, 255, 0)); //face(87, 183, 40, color(255, 0, 255)); // move the face //x = x + speedX; //y = y + speedY; //// check the edges //if (x > width || x< 0) { // speedX = -speedX; //} //if (y > height || y< 0) { // speedY = -speedY; //} } void face(float u, float v, float size, color c) { // display ball noStroke(); fill(c); ellipse(u, v, size, size); fill(255); ellipse(u-size*0.3, v-size*0.1, 0.05*size, 0.05*size); ellipse(u+size*0.3, v-size*0.1, 0.05*size, 0.05*size); arc(u, v, size*0.6, size*0.6, 0, PI); }