Ten Lines: Snappy Bird

tenLines2tenlinesconcept2Using the mouse’s x coordinate as input, I used my ten lines to draw a bird-like head that attempts to eat the mouse as it approaches the right side of the screen. The bird’s pupil also follows the mouse, but is constrained within the eye shape.

//Miranda Jacoby
//EMS Interactivity Section A
//majacoby@andrew.cmu.edu
//Copyright Miranda Jacoby 2014

//Implement offset to create spaces between lines

void setup() {
  size(400, 300);
}

void draw() {
  background(255); 
  strokeWeight(3); 
  
  //Center line
  line (200, 100, 200, 200); //Line 1

  float eyeX1 = map(mouseX, 0, 400, 140, 162);
  float eyeY1 = 150;
  float eyeX2 = map(mouseX, 0, 400, 140, 162);
  float eyeY2 = 160;

  float x1 = 50; 
  float y1 = 50;
  float x2 = 50; 
  float y2 = 150;
  
  
  float x3 = 350; 
  float y3 = 150; 
  float x4 = 350;
  float y4 = 50; 
  
  
//  float x5 = 350; 
//  float y5 = 350;
//  float x6 = 50; 
//  float y6 = 150;
//  
//  
//  float x7 = 350; 
//  float y7 = 150; 
//  float x8 = 350;
//  float y8 = 50; 
  
  //Top beak
  float beakLx1 = map(mouseX, 0,width, x1,x2); 
  float beakLy1 = map(mouseX, 0,width, y1,y2); 
  float beakRx1 = map(mouseX, 0,width, x3,x4); 
  float beakRy1 = map(mouseX, 0,width, y3,y4); 
  line (beakLx1, beakLy1,  beakRx1 , beakRy1 ); //Line 2
  
  //Inner top beak
  line(200, 150, beakRx1, beakRy1); //Line 3
  
  //Bottom beak
//  float beakLx2 = map(mouseX, 0,width, x5,x6); 
//  float beakLy2 = map(mouseX, 0,width, y5,y6); 
//  float beakRx2 = map(mouseX, 0,width, x7,x8); 
//  float beakRy2 = map(mouseX, 0,width, y7,y8); 
//  line (beakLx2, beakLy2,  beakRx2, beakRy2 );
  float beakLx2 = map(mouseX, 0,width, x1,x2); 
  float beakLy2 = map(mouseX, 0,width, y1 + 200 ,y2); 
  float beakRx2 = map(mouseX, 0,width, x3,x4); 
  float beakRy2 = map(mouseX, 0,width, y3, y4 + 200); 
  line (beakLx2, beakLy2,  beakRx2 , beakRy2 ); //Line 4
  
  //Inner bottom beak
  line(200, 150, beakRx2, beakRy2); //Line 5
  
  //Eye Shape
  line(125, 145, 175, 150); //Line 6
  line(175, 150, 150, 175); //Line 7
  line(150, 175, 125, 145); //Line 8
  
  //Pupil
  line(eyeX1, eyeY1, eyeX2, eyeY2); //Line 9
  
  //Back of head
  line(beakLx1, beakLy1, beakLx2, beakLy2); //Line 10
}

Comments are closed.