/* ******************************************* Title: Interactive Drawing - Magic Rabbit Date last edited: September 19th,2015 by: Aaron Sutton ******************************************* */ //setup********************************************************************************************* //"void setup" sets up the basics, only goes through a single cycle void setup() { //sets the window size "400x400" size(400,400); /*sets the drawing mode for rectangles to the "Corner" mode What this means is that you set the x-y variables for the upper-left corner first and set the bottom left x-y variables second*/ rectMode(CORNERS); /*sets the drawing mode for the ellipses as "Center" What this means is that you state the x-y variable of the center of the ellipse first and set the x value for the width and a y value for the height, respectively*/ ellipseMode(CENTER); } //end setup cycle************************************************************************************ //setup draw cycle*********************************************************************************** /*"draw" will create every object listed for every frame (currently set to the standard 60 frames per second) endlessly until program is closed*/ void draw() { //sets the background colour to black background(0); //create a stage to go along with the background***************** //set a brown outline stroke(44,13,13); //set an outline thickness value strokeWeight(1); //sets stage colour to light brown fill(116,74,50); //creates the main stage***************************************** rect(0,180,400,400); //creates the individual plank appearance************************** line(20,400,40,180); line(60,400,80,180); line(100,400,120,180); line(140,400,160,180); line(230,400,210,180); line(270,400,250,180); line(310,400,290,180); line(350,400,330,180); line(390,300,370,180); //Create body***************************** //sets each shape drawn with no outline from here on, until told otherwise noStroke(); //sets fill colour to white fill(255); //follows below the mouse vertically, due to mouseY+200 //+200 to mouseY makes the body follow at 200 pixels below the mouse position ellipse(200,mouseY+200,90,100); //draw the bunny's ears****************************** //follows below the mouse vertically, due to mouseY+70 //+70 to mouseY makes the ears follow at 70 pixels below the mouse position ellipse(170,mouseY+70,40,80); ellipse(230,mouseY+70,40,80); //Draw bunny ear holes******************************* //black outline for drawn shapes from here on until told otherwise stroke(0); //sets the thickness for outline to 0.5 strokeWeight(0.5); //sets color to pink fill(246,167,245); //follows below the mouse vertically, due to mouseY+80 //+80 to mouseY makes the ear holes follow at 80 pixels below the mouse position ellipse(172,mouseY+80,20,55); ellipse(227,mouseY+80,20,56); //Draw bunny's head*********************************** //sets no outline for shapes drawn from this point onward until told otherwise noStroke(); //sets the color to white fill(255); //follows below the mouse vertically, due to mouseY+125 //+125 to mouseY makes the head follow at 125 pixels below the mouse position ellipse(200,mouseY+125,100,100); //draw bunny's eyes********************************* //set fill to black fill(0); //follows below the mouse vertically, due to mouseY+125 and mouseY+118 //+125 and +118 to mouseY makes the eyes follow at 125 and 118 pixels below the mouse position ellipse(185,mouseY+125,13,30); ellipse(213,mouseY+125,13,30); //sets color to white fill(255); ellipse(187,mouseY+118,5,5); ellipse(215,mouseY+118,5,5); //Draw Bunny's cheeks******************************* //set outline color to black stroke(0); //set color to a very light gray fill(200); //draw the bunny's cheeks //follows below the mouse vertically, due to mouseY+158 //+158 to mouseY makes the cheeks follow at 158 pixels below the mouse position ellipse(187,mouseY+158,25,12); ellipse(212,mouseY+158,25,12); //draws bunny's cheeks***************************************** //sets no outline for drawn shapes from this point onward until told otherwise noStroke(); //sets color to black fill(0); //draw the bunny's whiskers (left) //follows below the mouse vertically, due to mouseY+157 and mouseY+161 //+157 and +167 to mouseY makes the whiskers follow at 157 and 167 pixels below the mouse position ellipse(190,mouseY+157,3,3); ellipse(182,mouseY+157,3,3); ellipse(186,mouseY+161,3,3); //draw the bunny's whiskers (right) //follows below the mouse vertically, due to mouseY+157 and mouseY+161 //+157 and +167 to mouseY makes the whiskers follow at 157 and 167 pixels below the mouse position ellipse(208,mouseY+157,3,3); ellipse(216,mouseY+157,3,3); ellipse(212,mouseY+161,3,3); //Draw the bunny's nose******************************************* //sets outline to black stroke(0); //sets color to pink fill(246,167,245); //follows below the mouse vertically, due to mouseY+150 and mouseY+145 //+150 and +145 to mouseY makes the nose follow at 150 and 145 pixels below the mouse position ellipse(200,mouseY+150,8,15); ellipse(200,mouseY+145,15,10); //Draw magic hat***************************************************** //sets fill color to dark blue fill(6,25,62); //draws top of the hat rect(60,200,340,240); //draws the bottom of the hat rect(100,240,300,400); //sets color to white, second value sets opacity fill(255, 200); //draws the ribbon of the hat rect(100,240,300,280); //draw spotlight*************************************************** //sets no outline to drawn objects from this point onward until told otherwise noStroke(); //sets color to yellow, fourth value sets the opacity fill(252,252,0,60); //the spotlight will follow the X-position (horizontal) of the mouse due to mouseX+180 and mouseX-180 //one point of the drawn shape will follow behind the mouse by 180 pixels, while the other drawn point will follow ahead by 180 pixels //the other two drawn points won't follow the mouse quad(150,0,250,0,mouseX+180,400,mouseX-180,400); //draw curtains******************************************************* //sets fill color to red fill(180,33,33); //draws the curtain ellipse(20,40,100,300); ellipse(380,40,100,300); ellipse(20,300,90,250); ellipse(380,300,90,250); //sets fill color to yellow fill(250,255,3); //draws curtain strings ellipse(20,180,50,20); ellipse(380,180,50,20); //sets outline of drawn shapes //sets outline colour to dark red stroke(93,7,7); //sets thickness of outlines value to 1 strokeWeight(1); //draws lines for the appearance of curtain folds line(10,140,20,20); line(40,130,50,30); line(10,380,20,205); line(35,390,35,205); line(350,30,370,130); line(380,20,395,140); line(350,380,370,205); line(375,390,385,205); } //end draw cycle*********************************************************************************************** //sets commands for everytime the mouse is pressed************************************************************* void mousePressed(){ //sets the frame rate to 1 frame per second frameRate(1); //sets background color to black background(0); //create a stage to go along with the background*************************** //set a brown outline stroke(44,13,13); //set an outline thickness value strokeWeight(1); //sets stage colour to light brown fill(116,74,50); //creates the main stage rect(0,180,400,400); //creates the individual plank appearance line(20,400,40,180); line(60,400,80,180); line(100,400,120,180); line(140,400,160,180); line(230,400,210,180); line(270,400,250,180); line(310,400,290,180); line(350,400,330,180); line(390,300,370,180); //Draw hat******************************************** //sets fill color to dark blue fill(6,25,62); //draws top of the hat rect(60,200,340,240); //draws the bottom of the hat rect(100,240,300,400); //sets color to white, second value sets opacity fill(255, 200); //draws the bottom of the hat rect(100,240,300,280); //Draw spotlight**************************************** //sets no outline to drawn objects from this point onward until told otherwise noStroke(); //sets color to yellow, fourth value sets the opacity fill(252,252,0,60); //the spotlight will sit on the center of screen until the "draw cycle" repeats when the mouse is released quad(150,0,250,0,380,400,20,400); //Draw curtain****************************************** //Writes "Ta-Da" in the output println("Ta-Da"); //sets fill color to red fill(180,33,33); //draws the curtain ellipse(20,40,100,300); ellipse(380,40,100,300); ellipse(20,300,90,250); ellipse(380,300,90,250); //sets fill color to yellow fill(250,255,3); //draws curtain strings ellipse(20,180,50,20); ellipse(380,180,50,20); //sets outline of drawn shapes //sets outline colour to dark red stroke(93,7,7); //sets thickness of outlines value to 1 strokeWeight(1); //draws lines for the appearance of curtain folds line(10,140,20,20); line(40,130,50,30); line(10,380,20,205); line(35,390,35,205); line(350,30,370,130); line(380,20,395,140); line(350,380,370,205); line(375,390,385,205); } //End of the mousePressed cycle******************************************************************************************* //Sets the commands for when the mouse is released************************************************************************ void mouseReleased(){ //returns the frame rate to the default setting, and the setting for the draw cycle //sets frame rate to 60 frames per second frameRate(60); } //End mouseReleased cycle*************************************************************************************************