...
| Code Block |
|---|
void setup()
{
size(500,300);
stroke(255);
strokeWeight(3);
noFill();
}
void draw()
{
background(0);
smiley(100,height/2);
smiley(250,height/2);
smiley(400,height/2);
}
void smiley(int x, int y)
{
println("smiley");
noFill();
ellipse(x,y,100,100); // head
fill(0); ellipse(x - 20,y - 10,10,15); // left eye
ellipse(x + 20,y - 10,10,15); // right eye
noFill();
arc(x,y,60,60,radians(20),radians(180-20)); // mouth
} |
...
| Code Block |
|---|
void setup()
{
size(300,300);
background(0);
}
void draw()
{}
void mousePressed()
{
println("x:" + mouseX + ", y:" + mouseY);
} |
Exercise 4
Write a sketch where a unique shape follows the mouse position. When you click the mouse, the shape should change in some way (form, colour, size).