Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

deutsche Version

Syntax of functions

...

Code Block
void setup()
{
  size(300500,300);
  smoothstroke(255);
  stroke(255,255,255strokeWeight(3);
  noFill();
}
 
void draw()
{
  background(0);
    bommelsmiley(100,10,140,50height/2);
  bommelsmiley(150,10,190,50250,height/2);
  bommelsmiley(200,10,240,50400,height/2);
}
 

void bommelsmiley(int x, int y,int length,int size)
{
  strokeWeightprintln(1"smiley");
  lineellipse(x,y,100,100);  // head
  
  ellipse(x - 20,y+length - 10,10,15);   strokeWeight(5);
  ellipse// left eye
  ellipse(x + 20,y - 10,10,15);  // right eye
   
  arc(x,y+length,size,size);,60,60,radians(20),radians(180-20));  // mouth
}


And here is our first interactive program:

Code Block
void setup()
{
  size(300,300);
  background(0);
}
 
void draw()
{}
 
void mousePressed()
{
  println("x:" + mouseX + ", y:" + mouseY);
}

Exercise 4

Create Write a program sketch where a unique shape follows the mouse position. When you click the mouse, the shape should change in some way (form, colour, size).