Your browser does not support the canvas tag.

previous        Show / Hide Source        Download        next
/*
  Program Name: deadorange_kills_everything
  Program Description: Use the mouse to change the environment!
                          - Mouse Up/Down: Make deadorange rise/set
                          - Mouse Left/Right: Kill the trees
                          - Mouse Click: Display a message
                          - Key Press: Display another message
  Author: Maxwell Hayes Woodley
  Program Creation Date: 06/09/18
  Program Submission Date: 19/09/18
  Created For: Assignment 1 - Interactive Drawing [Intro to Media Computation]
               Teacher - Nicholas Hesler
  Changelog: Not Available
*/

//Purpose: Executed on start
void setup(){
  size(400,400);                   // Set size of canvas to 400x400
  colorMode(RGB,400,400,400,400);  // Set colour mode to match all channels with size of canvas for easy calculations
  // Print a message
  println("Hear it's laugher. There is no escape. Deadorange kills everything.");
}

// Purpose: Executes every frame
void draw(){
  background(400-(-mouseY+400)/1.5,200-(-mouseY+300),0+(-mouseY+400)/5);  // Set the background to orange or purple, depending on the mouse's Y position
  
  /* COORDINATES TO USE IN EQUATIONS
    ###RAYS###
    POINT TO ROTATE AROUND: 200,mouseY*.5+75 (deadorange origin)
    
    TOP YELLOW RAY: 200,((mouseY*.5+75)-400)
                    350,((mouseY*.5+75)-400)
                    
    BOTTOM YELLOW RAY: 200,((mouseY*.5+75)+400)
                       350,((mouseY*.5+75)+400)
                       
    RIGHT YELLOW RAY: 600,((mouseY*.5+75)+150)
                      600,((mouseY*.5+75)-150)
                      
    LEFT YELLOW RAY: -200,((mouseY*.5+75)+150)
                     -200,((mouseY*.5+75)-150)
  */
  
  // ###DRAW SUNRAYS###
  fill(400-(-mouseY+400)/1.5,300-(-mouseY+300),0+(-mouseY+400)/5); // Set fill to yellow or purple, depending on mouse Y position
  noStroke();                                                      // Get rid of stroke for rays
  
  // Ray 1, top
  triangle(200,mouseY*.5+75,
  
           ( ((50-200)*cos(millis()*0.001)) - (((mouseY*.5+75-400)-(mouseY*.5+75))*sin(millis()*0.001)) )+200,
           ( (((mouseY*.5+75-400)-(mouseY*.5+75))*cos(millis()*0.001)) + ((50-200)*sin(millis()*0.001)) )+(mouseY*.5+75),
           
           ( ((350-200)*cos(millis()*0.001)) - (((mouseY*.5+75-400)-(mouseY*.5+75))*sin(millis()*0.001)) )+200,
           ( (((mouseY*.5+75-400)-(mouseY*.5+75))*cos(millis()*0.001)) + ((350-200)*sin(millis()*0.001)) )+(mouseY*.5+75));
           
  // Ray 2, bottom
  triangle(200,mouseY*.5+75,
  
           ( ((50-200)*cos(millis()*0.001)) - (((mouseY*.5+75+400)-(mouseY*.5+75))*sin(millis()*0.001)) )+200,
           ( (((mouseY*.5+75+400)-(mouseY*.5+75))*cos(millis()*0.001)) + ((50-200)*sin(millis()*0.001)) )+(mouseY*.5+75),
           
           ( ((350-200)*cos(millis()*0.001)) - (((mouseY*.5+75+400)-(mouseY*.5+75))*sin(millis()*0.001)) )+200,
           ( (((mouseY*.5+75+400)-(mouseY*.5+75))*cos(millis()*0.001)) + ((350-200)*sin(millis()*0.001)) )+(mouseY*.5+75));
           
  // Ray 3, right
  triangle(200,mouseY*.5+75, 
   
           ( ((600-200)*cos(millis()*0.001)) - (((mouseY*.5+75+150)-(mouseY*.5+75))*sin(millis()*0.001)) )+200,
           ( (((mouseY*.5+75+150)-(mouseY*.5+75))*cos(millis()*0.001)) + ((600-200)*sin(millis()*0.001)) )+(mouseY*.5+75), 
           
           ( ((600-200)*cos(millis()*0.001)) - (((mouseY*.5+75-150)-(mouseY*.5+75))*sin(millis()*0.001)) )+200,
           ( (((mouseY*.5+75-150)-(mouseY*.5+75))*cos(millis()*0.001)) + ((600-200)*sin(millis()*0.001)) )+(mouseY*.5+75));
  
  // Ray 4, left
  triangle(200,mouseY*.5+75, 
           
           ( ((-200-200)*cos(millis()*0.001)) - (((mouseY*.5+75+150)-(mouseY*.5+75))*sin(millis()*0.001)) )+200,
           ( (((mouseY*.5+75+150)-(mouseY*.5+75))*cos(millis()*0.001)) + ((-200-200)*sin(millis()*0.001)) )+(mouseY*.5+75), 
           
           ( ((-200-200)*cos(millis()*0.001)) - (((mouseY*.5+75-150)-(mouseY*.5+75))*sin(millis()*0.001)) )+200,
           ( (((mouseY*.5+75-150)-(mouseY*.5+75))*cos(millis()*0.001)) + ((-200-200)*sin(millis()*0.001)) )+(mouseY*.5+75));
           
  // ###DRAW AURA###
  noStroke();                                                                     // Get rid of stroke for aura
  ellipseMode(CENTER);                                                            // Set ellipse mode to center
  fill(0,((-mouseY+400)/3)-50);                                                   // Set opaciyt of middle aura to low
  ellipse(200,mouseY*.5+75,275+sin(millis()*0.001)*5,275+sin(millis()*0.001)*5);  // Draw innermost aura
  fill(0,((-mouseY+400)/4)-50);                                                   // Set opacity of middle aura to lower
  ellipse(200,mouseY*.5+75,325+cos(millis()*0.001)*5,325+cos(millis()*0.001)*5);  // Draw middle aura
  fill(0,((-mouseY+400)/5)-50);                                                   // Set opacity of outermost aura to lowest
  ellipse(200,mouseY*.5+75,375+sin(millis()*0.001)*5,375+sin(millis()*0.001)*5);  // Draw outermost aura
  
  // ###DRAW DEADORANGE###
  stroke(0);                                                            // Set stroke to black
  strokeWeight(2);                                                      // Set stroke weight to 1.5
  fill(350-(-mouseY+400)/2.6,250-(-mouseY+300)/2,0+(-mouseY+400)/23.6); // Set fill to various shades of orange, depending on the mouse's Y position
  ellipseMode(CENTER);                                                  // Set ellipse mode to center
  ellipse(200,mouseY*.5+75,250,250);                                    // Draw ellipse that follows mouse
  
  // ###DRAW FACE###
  strokeWeight(3);                                                                     // Set stroke weight to 3
  stroke(0,0,0,(-mouseY+400));                                                         // Set stroke to black
  fill(400-(-mouseY+400)/2.6,350-(-mouseY+300)/2,50+(-mouseY+400)/23.6,(-mouseY+400)); // Set fill to pale yellow
  arc(200,(mouseY*.5+75),230,230,0,PI);                                          // Draw mouth arc
  fill(0,0,0,-mouseY+400);                                                             // Set fill to black
  // Draw teeth lines...
  line(200,mouseY*.5+190,150,mouseY*.5+75);  // Draw tooth line 1
  line(200,mouseY*.5+190,250,mouseY*.5+75);  // Draw tooth line 2
  line(150,mouseY*.5+75,115,mouseY*.5+150);  // Draw tooth line 3
  line(250,mouseY*.5+75,285,mouseY*.5+150);  // Draw tooth line 4
  noStroke();                                // Get rid of stroke
  fill(0,0,0,(-mouseY+400));                 // Set fill to black
  // Draw eyes...
  // Draw left eye 1
  quad(105+mouseX*.025,mouseY*.5+5,
       145+mouseX*.025,mouseY*.5+25,
       165+mouseX*.025,mouseY*.5+65,
       125+mouseX*.025,mouseY*.5+45);
  // Draw left eye 2
  quad(165+mouseX*.025,mouseY*.5+5,
       125+mouseX*.025,mouseY*.5+25,
       105+mouseX*.025,mouseY*.5+65,
       145+mouseX*.025,mouseY*.5+45);
  // Draw right eye 1
  quad(290+mouseX*.025,mouseY*.5+10,
       255+mouseX*.025,mouseY*.5+25,
       240+mouseX*.025,mouseY*.5+60,
       275+mouseX*.025,mouseY*.5+45); 
  // Draw right eye 2
  quad(240+mouseX*.025,mouseY*.5+10,
       275+mouseX*.025,mouseY*.5+25,
       290+mouseX*.025,mouseY*.5+60,
       255+mouseX*.025,mouseY*.5+45);  
       
  // Draw stem
  stroke(0,0,0,(-mouseY+400));             // Set stroke to black
  line(200,mouseY*.5-30,200,mouseY*.5-5);  // Draw stem line 1
  line(190,mouseY*.5-26,210,mouseY*.5-8);  // Draw stem line 2
  line(210,mouseY*.5-26,190,mouseY*.5-8);  // Draw stem line 3
  
  // Draw orange spots
  stroke(0,0,0,(-mouseY+400));  // Set stroke to black
  strokeWeight(3);              // Set stroke weight to 3
  point(160,mouseY*.5-30);      // Draw spot 1
  point(230,mouseY*.5+60);      // Draw spot 2
  point(100,mouseY*.5+50);      // Draw spot 3
  point(190,mouseY*.5+20);      // Draw spot 4
  point(250,mouseY*.5-10);      // Draw spot 5
  point(300,mouseY*.5+30);      // Draw spot 6
  
  // ###DRAW GOOPCLOUDS###
  // Dark ellipses/lines create stroke that meshes
  stroke(0);
  fill(0);              // Set fill to black
  ellipseMode(CENTER);  // Set ellipse mode to center
  ellipse(0,10,76,76);  // Draw stroke for cloud 1-1
  ellipse(50,25,76,76); // Draw stroke for cloud 1-2
  ellipse(100,0,76,76); // Draw stroke for cloud 1-3
  
  ellipse(400,-10,76,76); // Draw cloud 2-1
  ellipse(350,10,76,76);  // Draw cloud 2-2
  ellipse(310,-5,76,76);  // Draw cloud 2-3
  
  strokeWeight(18.5);               // Set stroke weight to 18.5
  line(25,-10,25,(-mouseY+400)/5);  // Draw stroke for goop 1
  line(90,-5,90,(-mouseY+400)/3.5); // Draw stroke for goop 2
  line(340,0,340,(-mouseY+400)/6);  // Draw stroke for goop 3
  
  // Regular ellipses/lines layered over meshed stroke
  noStroke();  // Get rid of stroke, as dark ellipses/clouds act as meshed stroke
  // Set fill to between white and pale orange, depending on the mouse's Y position
  fill(400-(-mouseY+400)/2+100,
       400-(-mouseY+400)/1.25+100,
       400-(-mouseY+400)+100);
  ellipseMode(CENTER);  // Set ellipseMode to center
  ellipse(0,10,75,75);  // Draw cloud 1-1
  ellipse(50,25,75,75); // Draw cloud 1-2
  ellipse(100,0,75,75); // Draw cloud 1-3
  
  ellipse(400,-10,75,75); // Draw cloud 2-1
  ellipse(350,10,75,75);  // Draw cloud 2-2
  ellipse(310,-5,75,75);  // Draw cloud 2-3
  
  // Set stroke to between white and pale orange, depending on the mouse's Y position
  stroke(400-(-mouseY+400)/2+100,
         400-(-mouseY+400)/1.25+100,
         400-(-mouseY+400)+100);
  strokeWeight(15);                 // Set stroke weight to 15
  line(25,-10,25,(-mouseY+400)/5);  // Draw goop 1
  line(90,-5,90,(-mouseY+400)/3.5); // Draw goop 2
  line(340,0,340,(-mouseY+400)/6);  // Draw goop 3
  
  // ###DRAW HILLS###
  // Black quads/triangles create stroke that meshes
  stroke(0);                              // Set stroke to black
  strokeWeight(5);                        // Set stroke weight to 5
  fill(0);                                // Set fill to black
  quad(300,200,350,400,100,400,270,210);  // Draw stroke for hill quad
  quad(0,400,400,400,400,325,0,300);      // Draw stroke for right quad
  triangle(400,300,400,400,100,400);      // Draw stroke for right triangle
  triangle(0,250,0,400,300,400);          // Draw stroke for left quad 
  
  // Regular quads/triangles layered over meshed stroke
  noStroke();                                     // Get rid of stroke, as dark quads/triangles act as meshed stroke
  fill(0+(-mouseY+400)/2,300-(-mouseY+300)/2,0);  // Set fill to slowly desaturating shades of green, depending on the mouse's Y position
  quad(300,200,350,400,100,400,270,210);          // Draw hill quad
  quad(0,400,400,400,400,325,0,300);              // Draw right quad
  triangle(400,300,400,400,100,400);              // Draw right triangle
  triangle(0,250,0,400,300,400);                  // Draw left
  
  // ###DRAW TREES###
  // Tree 1
  fill(0);                                                                                   // Set fill to black
  stroke(0);                                                                                 // Set stroke to black
  strokeWeight(4);                                                                           // Set stroke weight to 4
  triangle(20,375,35,375,50,300);                                                            // Draw trunk mesh part 1
  triangle(35,345,40,325,20,250);                                                            // Draw trunk mesh part 2
  noStroke();                                                                                // Turn off stroke
  fill(150-(-mouseY+400)*0.375,110-(-mouseY+400)*0.275,0-(-mouseY+400));                     // Set fill to between brown and black
  triangle(20,375,35,375,50,300);                                                            // Draw trunk part 1
  triangle(35,345,40,325,20,250);                                                            // Draw trunk part 2
  stroke(0,0,0,(400-(-mouseY+400))+abs((32.5-mouseX)));                                      // Set stroke to black
  fill(100+(-mouseY+400)/2,400-(-mouseY+300)/2,100,(400-(-mouseY+400))+abs((32.5-mouseX)));  // Set fill to slowly desaturating shades of green, depending on the mouse's Y position
  ellipseMode(CORNER);                                                                       // Set ellipseMode to corner
  ellipse(-5,245,75,75+(-mouseY+400)/16);                                                    // Draw an ellipse that lengthens/shortens, depending on the mouse's Y position
  
  // Tree 2
  fill(0);                                                                                  // Set fill to black
  stroke(0);                                                                                // Set stroke to black
  strokeWeight(2);                                                                          // Set stroke weight to 2
  quad(300,175,280,205,290,202,305,175);                                                    // Draw trunk mesh part 1
  triangle(300,175,305,175,290,150);                                                        // Draw trunk mesh part 2
  triangle(300,175,305,175,315,170);                                                        // Draw trunk mesh part 3
  noStroke();                                                                               // Get rid of stroke
  fill(150-(-mouseY+400)*0.375,110-(-mouseY+400)*0.275,0-(-mouseY+400));                    // Set fill to between brown and black
  quad(300,175,280,205,290,202,305,175);                                                    // Draw trunk part 1
  triangle(300,175,305,175,290,150);                                                        // Draw trunk part 2
  triangle(308,175,305,175,315,170);                                                        // Draw trunk part 3
  stroke(0,0,0,(400-(-mouseY+400))+abs((298-mouseX)));                                      // Set stroke to black
  fill(100+(-mouseY+400)/2,400-(-mouseY+300)/2,100,(400-(-mouseY+400))+abs((298-mouseX)));  // Set fill to slowly desaturating shades of green, depending on the mouse's Y position
  ellipseMode(CORNER);                                                                      // Set ellipseMode to corner
  ellipse(280,145,36,36+(-mouseY+400)/30);                                                  // Draw an ellipse that lengthens/shortens, depending on the mouse's Y position
  
  // Tree 3
  fill(0);                                                                                    // Set fill to black
  stroke(0);                                                                                  // Set stroke to black
  strokeWeight(3);                                                                            // Set stroke weight to 3
  triangle(350,360,375,360,340,280);                                                          // Draw trunk part 1
  quad(370,290,350,340,355,350,375,300);                                                      // Draw trunk part 2
  triangle(370,290,370,300,350,270);                                                          // Draw trunk part 3
  noStroke();                                                                                 // Get rid of stroke
  fill(150-(-mouseY+400)*0.375,110-(-mouseY+400)*0.275,0-(-mouseY+400));                      // Set fill to between brown and black
  triangle(350,360,375,360,340,280);                                                          // Draw trunk part 1
  quad(370,290,350,340,355,350,375,300);                                                      // Draw trunk part 2
  triangle(370,290,370,300,350,270);                                                          // Draw trunk part 3
  stroke(0,0,0,(400-(-mouseY+400))+abs((352.5-mouseX)));                                      // Set stroke to black
  fill(100+(-mouseY+400)/2,400-(-mouseY+300)/2,100,(400-(-mouseY+400))+abs((352.5-mouseX)));  // Set fill to slowly desaturating shades of green, depending on the mouse's Y position
  ellipseMode(CORNER);                                                                        // Set ellipseMode to corner
  ellipse(315,230,75,75+(-mouseY+400)/18);                                                    // Draw an ellipse that lengthens/shortens, depending on the mouse's Y position
}

// Purpose: Executed upon key press
void keyPressed(){
  // Print a message
  println("It is the embodiment of famine and disease, born from the neglected groceries of the demons below.");
}

// Purpose: Executed upon mouse click
void mousePressed(){
  // Print a message
  println("The deadorange has come. The crops will wilt, the farmers shall die. This land transformed into a blighted corpse.");
}