Smiley Face – Moving the mouth tutorial

This sketch is an update to the smiley face. One of the questions asked was how do we make the mouth go down – this shows how that works.

The mouth is made up of the bezier command and a single line command. What I have done is to change the Y coordinate by adding 10 to the original value.

// Bezier end point is 10 pixels down
bezier(150, 295, 200, 370, 300, 370, 350, 320);

// Top line of the mouth – also 10 points down
line(150, 295, 350, 320);


void setup()
{
  
 size(500,500); 
  
}
void draw()
{

size (500, 500);
  background(130);
  fill(233, 224 , 71);
  strokeWeight(7);
  ellipse(250, 250, 300 ,300);
  fill(0);
  ellipse(200, 210 , 30, 70);
  fill(0);
  ellipse(300, 210 , 30, 70);
  fill (255);
  
  // Bezier end point is 10 pixels down
  bezier(150, 295, 200, 370, 300, 370, 350, 320);
  
  // Top line of the mouth - also 10 points down
  line(150, 295, 350, 320);
  line(160, 180, 210, 135);
  line(340, 100, 290,75 );


}
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s