/* Doodle Book Interactive Drawing _________________________________________________ Creator: CJ O'Heany Introduction to Media Computation September 17, 2018 Instructor: Nicolas Hesler _________________________________________________ Move the mouse around to draw on the screen. Click the mouse to reset the page, not the entire screen. Press and hold a key to slow down the framerate to draw straight lines. Release the key to reset the framerate back to 60. Press the mouse and move to thicken the drawing line Release the mouse to reset the lines thickness _________________________________________________ Draw to your hearts content! _______________________________________________*/ void setup(){ //Sets up defaults for the majority of the drawing size(400,400); noStroke(); rectMode(CORNERS); background(225,200,130); frameRate(60); /*Drawing in setup allows for me to reset certain areas and allow the player to draw Gradiant shadow in the foreground */ fill(110,100,65); rect(0,390,400,400); fill(160,145,110); rect(0,380,400,390); //The light flash in the top right corner for aesthetic purposes fill(255,235,190); quad(450,-50,370,200,360,40,200,20); //Top Page (The layer that will be mainly written on fill(255); stroke(128); rect(-1,50,310,350); } void draw(){ /*This is the code that draws a line ____________________________________________________________________________ It is above the rest of the code so I can reset the strokeWeight later on */ line(pmouseX,pmouseY,mouseX,mouseY); strokeWeight(1); /*Sketchbook Drawings ____________________________________________________________________________ Black Exterior This isn't a single rectangle so I can draw on the top page*/ noStroke(); fill(0); rect(-5,30,330,50,5); rect(310,30,330,370,5); rect(-5,350,330,370,5); /*Back Page (White between the inner page lines) ___________________________________________________________________________ Is not a single rectangle for the same reason that the "Black Exterior" is */ strokeWeight(1); fill(255); rect(0,40,320,50); rect(310,40,320,360); rect(0,350,320,360); /*Inner pages (lines) ___________________________________________________________________________ The lines grow or shrink to simulate depth Top*/ stroke(128); line(0,42,318,42); line(0,44,316,44); line(0,46,314,46); line(0,48,312,48); //Bottom line(0,352,312,352); line(0,354,314,354); line(0,356,316,356); line(0,358,318,358); //Side line(312,352,312,48); line(314,354,314,46); line(316,356,316,44); line(318,358,318,42); /*Eraser __________________________________________________________________________ The rectangles are the faces facing directly towards the POV The quads are meant to simulate depth Eraser (Whites) */ fill(255); stroke(0); rect(340,100,380,140); //Eraser (Whites) *DEPTH* quad(380,100,390,110,390,140,380,130); /*Eraser Case _________________________________________________________________________ Set the case color to blue */ fill(75,100,255); rect(339,130,381,220); //Eraser case depth quad(381,130,391,140,391,230,381,220); //Sets the background colour to a darker blue for shading effect fill(20,50,255); quad(341,220,381,220,391,230,351,230); } /*The following methods are meant as additional tools for the user to use _______________________________________________________________________ This method slows down the framerate of the draw method allowing the user to draw straight lines easier _______________________________________________________________________ keyPressed() only changes anything while a key is pressed and remains pressed*/ void keyPressed(){ frameRate(2); } /*This method refreshes the framerate back to its original setting. ______________________________________________________________________ keyReleased() triggers when a key is released from being pressed thus in synergy with keyPressed(), an effect is created */ void keyReleased(){ frameRate(60); } /*This method makes the stroke weight (how thick the lines are) larger _____________________________________________________________________ mouseDragged() only triggers when the mouse button is pressed and is simultaneously moved */ void mouseDragged(){ strokeWeight(5); } /*This method resets the stroke weight back to 1 pixel (the default) _____________________________________________________________________ mouseReleased() only triggers when the mouse is released from being pressed */ void mouseReleased(){ strokeWeight(1); } /*This method resets the white canvas of the sketchbook ____________________________________________________________________ mouseClicked() works when a mouse is pressed and released in a short amount of time. This is different from triggering mousePressed() and mouseReleased() due to the 2 requirements for this function to work */ void mouseClicked(){ fill(255); stroke(128); rect(-1,50,310,350); }