////Valerie - 2-10-2014 ////Project 2 - Create a book ////++++ String title="M Y B O O K (V 2.4)"; String mytitle="My first"; String mytitle1="book"; String mytitle2="to Dave S."; String author= "Valerie Courgis"; String mytitles="The LORD is"; String mytitles1="my shepherd I"; String mytitles2="shall not want."; float bookL=100, bookT=150, bookR=200, bookB=400; float bookM=bookL+200, bookN=bookT; float pages; float horizon; int score=0; void setup() { //initialization// size(600,480); horizon= height/4; textSize(9); } void draw() { background(100,100,255); book(); pages(); notes(); } void mousePressed() { //// Event handler for mouse click. score= score + 1; } void book() { fill(204, 102, 0); //fill(255); stroke(5); strokeWeight(10); rectMode(CORNERS); rect(bookL, bookT, bookR,bookB); rect(bookM, bookN, bookR,bookB); } void pages() { fill(255,0,255); ////left pages of book line(bookL+20, bookR-50, bookT-30,bookB); line(bookL+10, bookR-50, bookT-40,bookB); ////right pages of book line(bookL+180, bookR-50, bookT+130,bookB); line(bookL+190, bookR-50, bookT+140,bookB); // smooth(); pglines(); } void notes() { //// Messages on screen fill(0); text( title, 200, 30 ); text( score, width-100, 60 ); text( author, 20, height-20 ); //Messages on book pages on left//// text( mytitle, width-460, height-310 ); text( mytitle1, width-460, height-300 ); text( mytitle2, width-460, height-290 ); text( mytitle, width-460, height-280 ); text( mytitle1, width-460, height-270 ); text( mytitle2, width-460, height-260 ); text( mytitle, width-460, height-250 ); text( mytitle1, width-460, height-240 ); text( mytitle2, width-460, height-230 ); text( mytitle, width-460, height-220 ); text( mytitle1, width-460, height-210 ); text( mytitle2, width-460, height-200 ); text( mytitle, width-460, height-190 ); text( mytitle1, width-460, height-180 ); text( mytitle2, width-460, height-170 ); text( mytitle, width-460, height-160 ); text( mytitle1, width-460, height-150 ); text( mytitle2, width-460, height-140 ); //Messages on book pages on right//// text( mytitles, width-390, height-310 ); text( mytitles1, width-390, height-300 ); text( mytitles2, width-390, height-290 ); text( mytitles, width-390, height-280 ); text( mytitles1, width-390, height-270 ); text( mytitles2, width-390, height-260 ); text( mytitles, width-390, height-250 ); text( mytitles1, width-390, height-240 ); text( mytitles2, width-390, height-230 ); text( mytitles, width-390, height-220 ); text( mytitles1, width-390, height-210 ); text( mytitles2, width-390, height-200 ); text( mytitles, width-390, height-190 ); text( mytitles1, width-390, height-180 ); text( mytitles2, width-390, height-170 ); text( mytitles, width-390, height-160 ); text( mytitles1, width-390, height-150 ); text( mytitles2, width-390, height-140 ); } void pglines() { ////left side of book - lines in book strokeWeight(1); // Default for (int i = 5; i < height; i += 5) { line(bookL+100, bookR-30, width-460, height-310); // Set the color to white if (i < 35) { // When 'i' is less than 35... line(bookL+100, bookR-20, width-460, height-300); //...set the color to black } // line(30, i, 80, i); } //line(bookL+100, bookR-30, width-460, height-310); //line(bookL+100, bookR-20, width-460, height-300); //line(bookL+100, bookR-10, width-460, height-290); //line(bookL+100, bookR-0, width-460, height-280); //line(bookL+100, bookR+10, width-460, height-270); //line(bookL+100, bookR+20, width-460, height-260); //line(bookL+100, bookR+30, width-460, height-250); //line(bookL+100, bookR+40, width-460, height-240); //line(bookL+100, bookR+50, width-460, height-230); //line(bookL+100, bookR+60, width-460, height-220); //line(bookL+100, bookR+70, width-460, height-210); //line(bookL+100, bookR+80, width-460, height-200); //line(bookL+100, bookR+90, width-460, height-190); //line(bookL+100, bookR+100, width-460, height-180); //line(bookL+100, bookR+110, width-460, height-170); //line(bookL+100, bookR+120, width-460, height-160); //line(bookL+100, bookR+130, width-460, height-150); //line(bookL+100, bookR+140, width-460, height-140); //line(bookL+100, bookR+150, width-460, height-130); //line(bookL+100, bookR+160, width-460, height-120); //line(bookL+100, bookR+170, width-460, height-110); //line(bookL+100, bookR+180, width-460, height-100); //////right side of book - lines in book //line(bookL+200, bookR-30, width-390, height-310); //line(bookL+200, bookR-20, width-390, height-300); //line(bookL+200, bookR-10, width-390, height-290); //line(bookL+200, bookR-0, width-390, height-280); //line(bookL+200, bookR+10, width-390, height-270); //line(bookL+200, bookR+20, width-390, height-260); //line(bookL+200, bookR+30, width-390, height-250); //line(bookL+200, bookR+40, width-390, height-240); //line(bookL+200, bookR+50, width-390, height-230); //line(bookL+200, bookR+60, width-390, height-220); //line(bookL+200, bookR+70, width-390, height-210); //line(bookL+200, bookR+80, width-390, height-200); //line(bookL+200, bookR+90, width-390, height-190); //line(bookL+200, bookR+100, width-390, height-180); //line(bookL+200, bookR+110, width-390, height-170); //line(bookL+200, bookR+120, width-390, height-160); //line(bookL+200, bookR+130, width-390, height-150); //line(bookL+200, bookR+140, width-390, height-140); //line(bookL+200, bookR+150, width-390, height-130); //line(bookL+200, bookR+160, width-390, height-120); //line(bookL+200, bookR+170, width-390, height-110); //line(bookL+200, bookR+180, width-390, height-100); //bookmark(); smooth(); } void bookmark() { ////draw bookmarker fill(150,100,255); stroke(0); strokeWeight(2); rect(mouseX+30, mouseY+75, mouseX+70, mouseY-80); //// Draw bookmark design smooth(); fill(100, 70, 50); stroke(0); strokeWeight( random(3) ); ellipse( mouseX+40, mouseY+75, mouseX+60, mouseY-20); ellipse( mouseX+60, mouseY+55, mouseX+40, mouseY-60); ellipseMode(CORNERS); // Reset. stroke(0); strokeWeight( 1 ); fill( 255 ); }