Вы находитесь на странице: 1из 4

Go to processing.org/download/ and download the program.

Then copy and paste the text


below into the program and run it. Remember, it’s only the second thing I’ve done.

// The onion
void setup() {
size(400,400); // Set the size of the window
background(255);
smooth ();

// Outer Body
ellipseMode (CENTER);
stroke (0);
fill (0);
ellipse (200,200,100,100);

// Right Ear (Outer)


translate (210,155);
ellipseMode (CENTER);
stroke (0);
fill (0);
rotate (radians (45));
ellipse (0,0,20,40);
rotate (radians (315));
translate (-210,-155);

// Left Ear (Outer)


translate (190,155);
ellipseMode (CENTER);
stroke (0);
fill (0);
rotate (radians (-45));
ellipse (0,0,20,40);
rotate (radians (-315));
translate (-190,-155);

// Center Ear
stroke (0);
fill (0);
ellipse (200,150,20,40);

// Inner Body
stroke (110,187,31);
fill (110,187,31);
ellipse (200,200,98,98);

// arc
stroke (255);
strokeWeight(4);
noFill ();
arc (200,200,90,90,radians(310),radians (330));

// Right Ear (Inner)


translate (210,155);
ellipseMode (CENTER);
rotate (radians (45));
stroke (110,187,31);
strokeWeight(4);
fill (110,187,31);
ellipse (0,0,15,35);
rotate (radians (315));
translate (-210,-155);

// Left Ear (Inner)


translate (190,155);
ellipseMode (CENTER);
stroke (110,187,31);
strokeWeight(4);
fill (110,187,31);
rotate (radians (-45));
ellipse (0,0,15,35);
rotate (radians (-315));
translate (-190,-155);

// Center Ear (Inner)


stroke (110,187,31);
strokeWeight(3);
fill (110,187,31);
ellipse (200,150,15,35);

void draw() {
}

// Whenever a user clicks the mouse the code written inside mousePressed() is executed.
void mousePressed() {
// Left Eye
stroke (0);
fill (0);
ellipse (mouseX-15,mouseY-15,12,18);

// Right Eye
ellipse (mouseX+15,mouseY-15,15,28);

// Mouth
ellipse (mouseX,mouseY+22,30,30);
}

// Whenever a user presses a key the code written inside keyPressed() is executed.
void keyPressed() {
background(255);

// Outer Body
ellipseMode (CENTER);
stroke (0);
fill (0);
ellipse (200,200,100,100);

// Right Ear (Outer)


translate (210,155);
ellipseMode (CENTER);
stroke (0);
fill (0);
rotate (radians (45));
ellipse (0,0,20,40);
rotate (radians (315));
translate (-210,-155);

// Left Ear (Outer)


translate (190,155);
ellipseMode (CENTER);
stroke (0);
fill (0);
rotate (radians (-45));
ellipse (0,0,20,40);
rotate (radians (-315));
translate (-190,-155);

// Center Ear
stroke (0);
fill (0);
ellipse (200,150,20,40);

// Inner Body
stroke (110,187,31);
fill (110,187,31);
ellipse (200,200,98,98);

// arc
stroke (255);
strokeWeight(4);
noFill ();
arc (200,200,90,90,radians(310),radians (330));

// Right Ear (Inner)


translate (210,155);
ellipseMode (CENTER);
rotate (radians (45));
stroke (110,187,31);
strokeWeight(4);
fill (110,187,31);
ellipse (0,0,15,35);
rotate (radians (315));
translate (-210,-155);

// Left Ear (Inner)


translate (190,155);
ellipseMode (CENTER);
stroke (110,187,31);
strokeWeight(4);
fill (110,187,31);
rotate (radians (-45));
ellipse (0,0,15,35);
rotate (radians (-315));
translate (-190,-155);

// Center Ear (Inner)


stroke (110,187,31);
strokeWeight(3);
fill (110,187,31);
ellipse (200,150,15,35);
}

Оценить