Assignment 2

For Assignment 2 I drew a series of lines that make up my initial – the letter “M” . To add motion to the drawing I used the scale function so that the letter M appears to be scaling up from being infinite small until it fills the screen, and then scales back down. The process is continuously looping.

float a = 0.0;
float s = 0.0;

void setup()
{
  size(300,300);
strokeWeight(10);
stroke(255);
  frameRate(30);
}

void draw()
{
  background(20,60,255);
 
  a = a + 0.02;
  s = cos(a)*1;
 
  scale(s);
  fill(51);
  line(0, 300, 85, 20);
line(85, 20, 150, 250);
line(150, 250, 215, 20);
line(215, 20, 300, 300);
 
  translate(5, 0);
  fill(255);
  scale(s);
  line(0, 300, 85, 20);
line(85, 20, 150, 250);
line(150, 250, 215, 20);
line(215, 20, 300, 300);       
}

Image

Image

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