...
Code Block |
---|
void setup()
{
size(600,600); // def. window size
strokeWeight(1); // line thickness
}
void draw()
{
background(255); // def. background colour
for(int x = 0; x <= width; x+=30)
{
for(int y = 0; y <= height; y+=30)
{
smiley(x,y); // funtion call
}
}
}
void keyPressed()
{
switch(key)
{
case 's':
save("screenShot.jpg");
println("save the screen to screenShot.jpg");
break;
}
}
// function
void smiley(int x, int y)
{
println("smiley");
noFill();
ellipse(x,y,18,18); // head
fill(0);
ellipse(x - 3,y - 3,2,5); // left eye
ellipse(x + 3,y - 3,2,5); // right eye
noFill();
arc(x,y,10,10,radians(20),radians(180-20)); // mouth
} |
...