Versions Compared

Key

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

...

Dieses Beispiel zeigt, wie Funktionen zum Erstellen lesbarer und einfacher Blöcke verwendet werden (Modularisierung).


Code Block
languagejava
void setupvoid setup()
{
    sizesize(500,300);
    strokestroke(255);
    strokeWeightstrokeWeight(3);
  noFill  noFill();
}
  
  void void drawdraw()
{
  background  background(0);
    smileysmiley(100,height/2);
    smileysmiley(250,height/2);
    smileysmiley(400,height/2);
}
  
   
 void void smileysmiley(int x, int yint x, int y)
{
    printlnprintln("smiley");
   noFill();   ellipseellipse(x,y,100,100);    // head
     
  fill(0);
  ellipse 
  ellipse(x - 20 20,y - 10 10,10,15);    // left eye
    ellipseellipse(x + 20 20,y - 10 10,10,15);    // right eye
    
  noFill();
  arc    
  arc(x,y,60,60,radians(20),radians(180-20));    // mouth
}


...