/* Author: Riley Jckson
Date: Sept. 14, 2018
Discription: This is an interactive drawing. This drawing consists of a rabbit in the snow
that is following the light that is being held by the mouse with it's eyes. When
the mouse is clicked the scene turns to a storm and the rabbit is laying down
with it's eyes closed. Another part of the interactivity is when a key is pressed
the scene turns to day and the snow appears to be melting, while th rabbit looks
a lot happier.
*/
//sets the window up and only runs once
void setup() {
//set the size of the window
size(400, 400);
//set the colour of the background white
background(255);
}
//draws the shapes, and is always repeating as if to create the frames of the animation
void draw() {
//sets the frame rate 60 per second
frameRate(60);
//set it so no stokes/lines appear on the outside of the shape
noStroke();
//Fill the background with lighter blue
fill(1, 36, 73);
//set the location and size of the rectangle
rect(0, 0, 400, 400);
//fill the background with the darker blue
fill(0, 14, 58, mouseY / 2);
rect(0, 0, 400, 400);
//change the input mode of the ellipse to center, so the corrdinates used will be the center of the ellipse
ellipseMode(CENTER);
/*MOON*/
fill(255, 255, 255, 75);
ellipse(350, 50 + mouseY / 70, 100, 100);
fill(242, 242, 242);
ellipse(350, 50 + mouseY / 70, 80, 80);
/*BACKGROUND GROUND SNOW*/
fill(229, 241, 255);
ellipse(200, 340, 400, 160);
/*BACKGROUND FALLING SNOW*/
ellipseMode(CORNER);
//creates an ellipse for wach piece of snow on screen
ellipse(0, 40 + mouseY / 15, 5, 5);
ellipse(40, 0 + mouseY / 15, 5, 5);
ellipse(50, 120 + mouseY / 15, 5, 5);
ellipse(180, 20 + mouseY / 15, 5, 5);
ellipse(380, 0 + mouseY / 15, 5, 5);
ellipse(110, 100 + mouseY / 15, 5, 5);
ellipse(330, 100 + mouseY / 15, 5, 5);
ellipse(320, 40 + mouseY / 15, 5, 5);
ellipse(170, 140 + mouseY / 15, 5, 5);
ellipse(260, 150 + mouseY / 15, 5, 5);
ellipse(340, 140 + mouseY / 15, 5, 5);
ellipse(130, 160 + mouseY / 15, 5, 5);
ellipse(40, 200 + mouseY / 15, 5, 5);
ellipse(280, 200 + mouseY / 15, 5, 5);
ellipse(360, 190 + mouseY / 15, 5, 5);
ellipse(0, 220 + mouseY / 15, 5, 5);
ellipse(90, 220 + mouseY / 15, 5, 5);
ellipse(180, 200 + mouseY / 15, 5, 5);
ellipse(240, 260 + mouseY / 15, 5, 5);
ellipse(350, 280 + mouseY / 15, 5, 5);
ellipse(250, 60 + mouseY / 15, 5, 5);
ellipse(240, -10 + mouseY / 15, 5, 5);
ellipse(130, -10 + mouseY / 15, 5, 5);
ellipseMode(CENTER);
/*FOREGROUND GROUND SNOW*/
//sets the colour to white
fill(255);
//creates a rectangle on screen
rect(0, 340, 400, 70);
//creates an ellipse on screen
ellipse(30, 330, 160, 100);
ellipse(370, 330, 160, 100);
/*RABBIT'S BODY AND EARS*/
//colour of the rabbit
fill(255, 246, 229);
//body of the rabbit
ellipse(200, 280, 160, 160);
//head of the rabbit
ellipse(200, 180, 100, 100);
//ears of the rabbit
arc(175, 150, 20, 120, -PI, 0);
arc(225, 150, 20, 120, -PI, 0);
/*RABBIT'S EYES AND NOSE*/
//sets the colour of the shapes to black
fill(0);
//rabbit's eyes and how they move with the mouse
ellipse(175 + pmouseX / 50, 170 + pmouseY / 50, 20, 20);
ellipse(215 + pmouseX / 50, 170 + pmouseY / 50, 20, 20);
//rabbit's nose
triangle(190, 190, 200, 200, 210, 190);
/*BLUSH*/
//set the colour to a light pink
fill(255, 226, 224);
//creates the shapes for the blush
ellipse(170, 190, 20, 10);
ellipse(230, 190, 20, 10);
/*RABBIT'S EYES HIGHLIGHT*/
//sets the colour to white
fill(255);
//creates the circles inside the previous eyes and lets them move with them.
ellipse(170 + pmouseX / 50, 165 + pmouseY / 50, 5, 5);
ellipse(210 + pmouseX / 50, 165 + pmouseY / 50, 5, 5);
ellipseMode(CORNER);
/*FOREGROUND FALLING SNOW*/
//sets the colour to white
fill(255);
//creates the circles of falling snow
ellipse(40, 40 + mouseY / 7, 10, 10);
ellipse(110, 0+ mouseY / 7, 10, 10);
ellipse(270, 0+ mouseY / 7, 10, 10);
ellipse(200, 50+ mouseY / 7, 10, 10);
ellipse(370, 30+ mouseY / 7, 10, 10);
ellipse(310, 120+ mouseY / 7, 10, 10);
ellipse(70, 160+ mouseY / 7, 10, 10);
ellipse(350, 220+ mouseY / 7, 10, 10);
ellipse(160, 240+ mouseY / 7, 10, 10);
ellipse(40, 270+ mouseY / 7, 10, 10);
ellipse(220, 200+ mouseY / 7, 10, 10);
ellipse(200, 290+ mouseY / 7, 10, 10);
ellipse(250, 260+ mouseY / 7, 10, 10);
ellipse(220, -30+ mouseY / 7, 10, 10);
ellipseMode(CENTER);
/*YELLOW FIREFLY LIGHT THAT FOLLOWS MOUSE*/
//sets the colour to yellow and lowers opacity to 75%
fill(255, 255, 0, 75);
//creates the glow of the small ellipse that follow the mouse
ellipse(mouseX, mouseY, 25, 25);
ellipse(mouseX + 20, mouseY, 10, 10);
ellipse(mouseX, mouseY + 20, 10, 10);
ellipse(mouseX, mouseY- 20, 10, 10);
ellipse(mouseX - 20, mouseY, 10, 10);
//sets the colour to a more orange yellow
fill(255, 233, 0);
//creates the saller ellipse that follow the mouse
ellipse(mouseX, mouseY, 15, 15);
ellipse(mouseX + 20, mouseY, 5, 5);
ellipse(mouseX, mouseY + 20, 5, 5);
ellipse(mouseX, mouseY- 20, 5, 5);
ellipse(mouseX - 20, mouseY, 5, 5);
}
//this is activated when one of the mouse buttons gets pressed
void mousePressed() {
//lowers the frame rate to 1, so the image is seen for a full second rather then a flash
frameRate(1);
//colour of background (sky)
fill(0, 10, 40);
rect(0, 0, 400, 400);
ellipseMode(CENTER);
/*BACKGROUND GROUND SNOW*/
fill(229, 241, 255);
ellipse(200, 340, 400, 160);
/*MOON*/
fill(242, 242, 242);
ellipse(380, 100, 80, 80);
fill(255, 255, 255, 75);
ellipse(380, 100, 100, 100);
/*BACKGROUND FALLING SNOW*/
ellipseMode(CORNER);
ellipse(0, 40, 5, 5);
ellipse(40, 0, 5, 5);
ellipse(50, 120, 5, 5);
ellipse(180, 20, 5, 5);
ellipse(380, 0, 5, 5);
ellipse(110, 100, 5, 5);
ellipse(330, 100, 5, 5);
ellipse(320, 40, 5, 5);
ellipse(170, 140, 5, 5);
ellipse(260, 150, 5, 5);
ellipse(340, 140, 5, 5);
ellipse(130, 160, 5, 5);
ellipse(40, 200, 5, 5);
ellipse(280, 200, 5, 5);
ellipse(360, 190, 5, 5);
ellipse(0, 220, 5, 5);
ellipse(90, 220, 5, 5);
ellipse(180, 200, 5, 5);
ellipse(240, 260, 5, 5);
ellipse(350, 280, 5, 5);
ellipse(250, 60, 5, 5);
ellipse(240, -5, 5, 5);
ellipse(20, 20, 5, 5);
ellipse(14, 118, 5, 5);
ellipse(80, 60, 5, 5);
ellipse(300, 300, 5, 5);
ellipse(200, 180, 5, 5);
ellipse(220, 100, 5, 5);
ellipse(95, 140, 5, 5);
ellipse(335, 15, 5, 5);
ellipse(95, 310, 5, 5);
ellipse(140, 140, 5, 5);
ellipse(130, 75, 5, 5);
ellipse(311, 68, 5, 5);
ellipse(307, 265, 5, 5);
ellipse(383, 116, 5, 5);
ellipse(135, 225, 5, 5);
ellipseMode(CENTER);
/*FOREGROUND GROUND SNOW*/
fill(255, 255, 255);
rect(0, 340, 400, 70);
ellipse(30, 330, 160, 100);
ellipse(370, 330, 160, 100);
/*RABBIT'S BODY*/
fill(255, 246, 229);
ellipse(200, 280, 160, 160);
/*FOREGROUND EXTRA SNOW*/
fill(255);
stroke(240);
ellipse(120, 330, 100, 50);
ellipse(280, 330, 100, 50);
/*RABBIT'S HEAD AND EARS*/
fill(255, 246, 229);
stroke(232, 216, 187);
ellipse(200, 320, 100, 100);
arc(175, 290, 20, 120, -PI, 0);
arc(225, 290, 20, 120, -PI, 0);
noStroke();
/*RABBIT'S EYES AND NOSE*/
fill(0);
ellipse(180, 335, 20, 5);
ellipse(220, 335, 20, 5);
triangle(190, 345, 200, 355, 210, 345);
/*BLUSH*/
fill(255, 226, 224);
ellipse(170, 345, 20, 10);
ellipse(230, 345, 20, 10);
ellipseMode(CORNER);
/*FOREGROUND FALLING SNOW*/
fill(255);
ellipse(40, 40, 10, 10);
ellipse(110, 0, 10, 10);
ellipse(270, 0, 10, 10);
ellipse(200, 50, 10, 10);
ellipse(370, 30, 10, 10);
ellipse(310, 120, 10, 10);
ellipse(70, 160, 10, 10);
ellipse(350, 220, 10, 10);
ellipse(160, 240, 10, 10);
ellipse(40, 270, 10, 10);
ellipse(220, 200, 10, 10);
ellipse(200, 290, 10, 10);
ellipse(250, 260, 10, 10);
ellipse(210, 165, 10, 10);
ellipse(133, 195, 10, 10);
ellipse(300, 200, 10, 10);
//this will print a line of text the the console
println("So Cold!");
}
void keyPressed() {
//lowers the frame rate to 1, so the image is seen for a full second rather then a flash
frameRate(1);
/*FOREGROUND GROUND SNOW*/
fill(255);
rect(0, 340, 400, 70);
ellipseMode(CENTER);
/*GRASS*/
fill(9, 135, 13);
ellipse(200, 340, 400, 70);
/*SKY*/
fill(137, 182, 255);
rect(0, 0, 400, 340);
/*CLOUDS*/
//sets the colour to white
fill(255);
//creates the ellipse
ellipse(40, 40, 250, 40);
ellipse(100, 70, 300, 40);
ellipse(400, 140, 250, 20);
ellipse(140, 200, 300, 15);
/*RABBIT'S BODY AND EARS*/
//sets the colour to a beige
fill(255, 246, 229);
//creates an ellipse
ellipse(200, 280, 160, 160);
ellipse(200, 180, 100, 100);
//creates an arc for the ears
arc(175, 150, 20, 120, -PI, 0);
arc(225, 150, 20, 120, -PI, 0);
/*RABBIT'S EYES AND NOSE*/
//sets the colour to black
fill(0);
//creates the ellipse for the eyes
ellipse(180, 175, 20, 20);
ellipse(220, 175, 20, 20);
//creates the triangle for the nose
triangle(190, 190, 200, 200, 210, 190);
/*RABBIT'S EYE SQUINT*/
//sets the colour to the same colour as the rabbit's body and head
fill(255, 246, 229);
//creates the ellipse
ellipse(180, 190, 20, 20);
ellipse(220, 190, 20, 20);
/*BLUSH*/
//sets the colour to light pink
fill(255, 226, 224);
//creates the ellipse fot the blush
ellipse(170, 190, 20, 10);
ellipse(230, 190, 20, 10);
/*RABBIT'S EYES HIGHLIGHT*/
//sets colour to white
fill(255);
//creates the ellipse for the highlight
ellipse(175, 170, 5, 5);
ellipse(215, 170, 5, 5);
//this will print a line of text to the console
println("The snow is melting!");
}