> show canvas only <


/* built with Studio Sketchpad: 
 *   https://sketchpad.cc
 * 
 * observe the evolution of this sketch: 
 *   https://uclaspring12.sketchpad.cc/sp/pad/view/ro.JTMsZWNPBIH/rev.275
 * 
 * authors: 
 *   Nicole

 * license (unless otherwise specified): 
 *   creative commons attribution-share alike 3.0 license.
 *   https://creativecommons.org/licenses/by-sa/3.0/ 
 */ 



// This sketch builds on a prior work, "Workshop 5 [Template]", created by Casey Reas
// http://uclaspring12.sketchpad.cc/sp/pad/view/ro.68AkKzKaSULxF8/rev.56



// Clone and modify this program, then change the name to 
// [YOUR NAME] - Workshop 5
// Press Control-R to render the sketch
 
 
 /* @pjs preload="/static/uploaded_resources/p.4531/eyes.jpg"; */
 
 /* @pjs preload="/static/uploaded_resources/p.4531/tree.jpg"; */
 
 /* @pjs preload="/static/uploaded_resources/p.4531/tree2.jpg"; */
 
 /* @pjs preload="/static/uploaded_resources/p.4531/head.png"; */
 
 
 /* @pjs preload="/static/uploaded_resources/p.4531/lefteye.png"; */
 
 /* @pjs preload="/static/uploaded_resources/p.4531/righteye.png"; */
 
 
 
 //I used one composition from my original collage to creat workshop 5. I used this specific composition because it creates somewhat off an eerie feeling in the viewer and I wanted to use that idea to create a dreamlike/ nightmare type of moving image. The floating eyes and head throws the viewer off and I wanted to do this to keep the eerie theme consistent. 
 
PImage eyes, head, lefteye, righteye, tree, tree2;

float angle = 0.0;
float offset = 125;
float scalar = 2;
float speed = .05;
float speed2 = 2.0;
float s = 1.5;
int diameter2 = 160;
float speedhead = 2;
float speedimg = 1.5;
float x3;
float y3;
float x4;
float y4;
float posx;
float posy;
float treescale = .75;




void setup () {

  size (600, 300);

 
eyes = loadImage("/static/uploaded_resources/p.4531/eyes.jpg");
tree = loadImage("/static/uploaded_resources/p.4531/tree.jpg");
tree2 = loadImage("/static/uploaded_resources/p.4531/tree2.jpg");
head = loadImage("/static/uploaded_resources/p.4531/head.png");
lefteye = loadImage("/static/uploaded_resources/p.4531/lefteye.png");
righteye = loadImage("/static/uploaded_resources/p.4531/righteye.png");

posx = 87;
  posy = 0;
}



void draw () {
  background (0);  

  if (mousePressed == true) {
    pushMatrix();
    scale (treescale);
    tint (190, 90, 50, 200);
    image (tree2, 0, 0);    
    popMatrix();

    pushMatrix();
    translate (600, 0);
    scale (treescale);
    image (tree, -100, 0);
    popMatrix();
    //image (tree, 502, 0);
    treescale += 0.01;
  } 
  else {
    noTint();
    treescale = 1;
  }


  pushMatrix();
  noTint();
  x4 += random (-speedimg, speedimg);
  y4 += random (-speedimg, speedimg);
  translate (87, 0);
  //  image (eyes, 87, 0, 417, 300);
  image (eyes, x4, y4, 417, 300);
  popMatrix();

  pushMatrix();
  //x3 = 224;
  //y3 = 14;
  noTint();
  x3 += random (-speedhead, speedhead);
  y3 += random (-speedhead, speedhead);
  translate (mouseX, mouseY);
  rotate (angle/8);
  //  image (head, 224, 14, 160, 160);
  image (head, x3, y3, diameter2, diameter2);
  popMatrix ();

  pushMatrix();
  noTint();
  float x = offset + cos(angle) * scalar;
  float y = (offset + 43) + sin(angle) * scalar;
  //  image (lefteye, 125, 168, 44, 44);
  image (lefteye, x, y, 44, 44);
  angle += speed*2 ;
  popMatrix();

  pushMatrix();
  float x2 = (offset + 291) - cos(angle) * scalar;
  float y2 = (offset + 48) - sin(angle) * scalar;
  //  image (righteye, 416, 173, 42, 42);
  image (righteye, x2, y2, 42, 42);
  angle += speed*2;
  scalar += speed*2;
  popMatrix();
}