//////////////Ariana Tomcsak//////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////
//////ASSIGNMENT 1 - INTERACTIVE DRAWING////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////
///////////PEEK-A-BOO IN THE DESERT///////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////
////////////////LET'S PLAY!///////////////////////////////////////////////////////
////Use the fly (cursor) to play peek-a-boo with the sun, move it up and down/////
////Move the fly left and right to watch the clouds hide behind the sun///////////
////Press some keys to see some colors change/////////////////////////////////////
////Click the fly to see the cactus flowers shrink////////////////////////////////
/***Make sure to click last since frameRate will slow down***/////////////////////
////////////////////////Setup the size////////////////////////////////////////////
void setup() {
size(400,400);
frameRate(60);
}
////////////////////////Setup the canvas////////////////////////////////////////////
void draw() {
////Set background color to white///
background(225);
////Set rect and ellipse Modes//////
rectMode(CENTER);
ellipseMode(CENTER);
////Set noStroke////////////////////
noStroke();
////Draw sky with color///////////////
//Draw sky 1 rect
fill(255, 158, 118, 155);
rect(200, 20, 400, 40);
//Draw sky 2 rect
fill(255, 212, 137, 155);
rect(200, 60, 400, 40);
//Draw sky 3 rect
fill(186, 158, 96, 155);
rect(200, 100, 400, 40);
//Draw sky 4 rect
fill(160, 171, 105, 155);
rect(200, 140, 400, 40);
//Draw sky 5
fill(136, 178, 177, 155);
rect(200, 180, 400, 40);
//Draw sky 6 rect
fill(81, 107, 106, 180);
rect(200, 220, 400, 40);
//Draw sky 7 rect
fill(134, 187, 189, 155);
rect(200, 260, 400, 40);
////Draw cloud c with color////
//cloud c (right-hand side cloud)*/
fill(201, 155, 164, 100);
ellipse(mouseX, 40, 80, 40);
////Draw sun & beams with color////
/*Draw beam 2 (futher beam behind sun)*/
fill(246, 197, 121, 120);
ellipse(300,mouseY,140,140);
/*Draw beam 1 (closer beam behind sun)*/
fill(246, 171, 121, 140);
ellipse(300, mouseY, 100, 100);
/*Draw sun*/
fill(247, 203, 65);
ellipse(300, mouseY, 60, 60);
////Draw clouds a & b with color////
//cloud a (left-hand side cloud)
fill(128, 180, 186, 100);
ellipse(mouseX*0.9-90, 50, 60, 40);
//cloud b (middle cloud)
fill(98, 138, 143, 130);
ellipse(mouseX*1.1-50, 60, 80, 40);
////Draw white rect behind ground to mask the sun when it goes down////
fill(255);
rect(200, 340, 400, 120);
////Draw mountains & color////
/*Mountain 'tc' (shortest, back mountain)*/
//Draw tc1
fill(10);
triangle(320, 280, 335, 260, 350, 280);
//Draw tc2
fill(100);
triangle(335, 260, 350, 240, 360, 250);
//Draw tc3
fill(130);
triangle(335, 260, 360, 250, 350, 280);
//Draw tc4
fill(150);
triangle(350, 280, 360, 250, 380, 280);
/*Mountain 'ta' (second tallest, back mountain)*/
//Draw ta1
fill(0);
triangle(210, 280,220, 260, 250, 280);
//Draw ta2
fill(100);
triangle(220, 260, 260, 230, 250, 280);
//Draw ta3
fill(200);
triangle(220, 260, 250, 210, 260, 230);
//Draw ta4
fill(255);
triangle(250, 280, 260, 230, 280, 280);
/*Mountain 't' (second peak of mountain 'tb')*/
//Draw t
fill(245);
triangle(300, 280, 320, 210, 350, 280);
/*Mountain 'tb' (tallest, front mountain)*/
//Draw tb1
fill(60);
triangle(240, 280, 283, 220, 280, 280);
//Draw tb2
fill(120);
triangle(283, 220, 300, 200, 323, 240);
//Draw tb3
fill(230);
triangle(280, 280, 283, 220, 323, 240);
//Draw tb4
fill(245);
triangle(280, 280, 323, 240, 350, 280);
////Draw ground with color////
/*Draw purple ground*/
fill(145, 127, 140, 155);
rect(200, 340, 400, 120);
/*Draw yellow sand ground*/
fill(246, 224, 188, 155);
//Draw bottom yellow sand rect
rect(200, 385, 400, 30);
//Draw middle yellow sand rect
rect(200, 345, 400, 30);
//Draw top yellow sand rect
rect(200, 295, 400, 10);
//////Draw cactus & color//////
///Draw cactus hands & color///
/*Draw left cactus hand & color*/
//Draw ca1
fill(236,176,55);
rect(45, 265, 10, 50);
//Draw ca2
fill(155, 154, 55);
rect(55, 265, 10, 30);
//Draw ca3
fill(236,176,55);
rect(60, 295, 40, 10);
//Draw ca4
fill(155, 154, 55);
rect(65, 285, 30, 10);
/*Draw left cactus hand & color*/
//Draw cb1
fill(194, 172, 55);
rect(205, 200, 10, 40);
//Draw cb2
fill(200, 122, 44);
rect(215, 210, 10, 40);
//Draw cb3
fill(51, 76, 52);
rect(225, 205, 10, 70);
//Draw cb4
fill(194, 172, 55);
rect(195, 225, 30, 10);
//Draw cb5
fill(200, 122, 44);
rect(200, 235, 40, 10);
//Draw cb6
fill(51, 76, 52);
rect(205, 245, 50, 10);
///Draw cactus main body & color///
//Draw c1
fill(73, 102, 65);
rect(90, 300, 20, 200);
//Draw c2
fill(50, 71, 1);
rect(110, 270, 20, 260);
//Draw c3
fill(125, 150, 83);
rect(130, 280, 20, 320);
//Draw c4
fill(180, 155, 101);
rect(150, 275, 20, 250);
//Draw c5
fill(163, 166, 53);
rect(170, 290, 20, 220);
////Draw flowers on cactus & color////
//Draw right flower (f1) & color//
/*Draw right flower (f1) petal 1 (p1) & color*/
//Draw f1, p1
fill(224, 192, 56);
ellipse(150,250, 20, 20);
/*Draw right flower (f1) petal 2 (p2) & color*/
//Draw f1, p2
fill(217, 32, 2);
ellipse(160,250, 23, 23);
/*Draw right flower (f1) petal 3 (p3) & color*/
//Draw f1, p3
fill(224, 192, 56);
ellipse(155,260, 15, 15);
//Draw left flower (f2) & color//
/*Draw left flower (f2) petal 1 (p1) & color*/
//Draw f2, p1
fill(224, 192, 56);
ellipse(100, 300, 20, 20);
/*Draw right flower (f2) petal 2 (p2) & color*/
//Draw f1, p2
fill(217, 32, 2);
ellipse(110, 290, 30, 30);
/*Draw right flower (f2) petal 3 (p3) & color*/
//Draw f1, p3
fill(224, 192, 56);
ellipse(110, 305, 23, 23);
/////Draw fly/cursor////
//Draw fly wing back
fill(255, 150);
ellipse(mouseX, mouseY - 5, 7, 10);
//Draw fly body
fill(0);
ellipse(mouseX, mouseY, 10, 10);
//Draw fly wing front
fill(255, 170);
ellipse(mouseX + 3, mouseY - 5, 7, 10);
}
/////////RE-DRAW AND RE-COLOR MOUNTAINS AND CACTUS WITH FLOWERS FOR KEYBOARD PRESS FUNCTION////////
void keyPressed() {
////Draw mountains & color////
/*Mountain 'tc' (shortest, back mountain)*/
//Draw tc1
fill(73, 102, 65);
triangle(320, 280, 335, 260, 350, 280);
//Draw tc2
fill(50, 71, 1);
triangle(335, 260, 350, 240, 360, 250);
//Draw tc3
fill(125, 150, 83);
triangle(335, 260, 360, 250, 350, 280);
//Draw tc4
fill(180, 155, 101);
triangle(350, 280, 360, 250, 380, 280);
/*Mountain 'ta' (second tallest, back mountain)*/
//Draw ta1
fill(163, 166, 53);
triangle(210, 280,220, 260, 250, 280);
//Draw ta2
fill(194, 172, 55);
triangle(220, 260, 260, 230, 250, 280);
//Draw ta3
fill(200, 122, 44);
triangle(220, 260, 250, 210, 260, 230);
//Draw ta4
fill(51, 76, 52);
triangle(250, 280, 260, 230, 280, 280);
/*Mountain 't' (second peak of mountain 'tb')*/
//Draw t
fill(200, 122, 44);
triangle(300, 280, 320, 210, 350, 280);
/*Mountain 'tb' (tallest, front mountain)*/
//Draw tb1
fill(236,176,55);
triangle(240, 280, 283, 220, 280, 280);
//Draw tb2
fill(155, 154, 55);
triangle(283, 220, 300, 200, 323, 240);
//Draw tb3
fill(125, 150, 83);
triangle(280, 280, 283, 220, 323, 240);
//Draw tb4
fill(163, 166, 53);
triangle(280, 280, 323, 240, 350, 280);
//////Draw cactus & color//////
///Draw cactus hands & color///
/*Draw left cactus hand & color*/
//Draw ca1
fill(23);
rect(45, 265, 10, 50);
//Draw ca2
fill(240);
rect(55, 265, 10, 30);
//Draw ca3
fill(23);
rect(60, 295, 40, 10);
//Draw ca4
fill(240);
rect(65, 285, 30, 10);
/*Draw left cactus hand & color*/
//Draw cb1
fill(19);
rect(205, 200, 10, 40);
//Draw cb2
fill(35);
rect(215, 210, 10, 40);
//Draw cb3
fill(51);
rect(225, 205, 10, 70);
//Draw cb4
fill(19);
rect(195, 225, 30, 10);
//Draw cb5
fill(35);
rect(200, 235, 40, 10);
//Draw cb6
fill(51);
rect(205, 245, 50, 10);
///Draw cactus main body & color///
//Draw c1
fill(73);
rect(90, 300, 20, 200);
//Draw c2
fill(50);
rect(110, 270, 20, 260);
//Draw c3
fill(125);
rect(130, 280, 20, 320);
//Draw c4
fill(180);
rect(150, 275, 20, 250);
//Draw c5
fill(163);
rect(170, 290, 20, 220);
////Draw flowers on cactus & color////
//Draw right flower (f1) & color//
/*Draw right flower (f1) petal 1 (p1) & color*/
//Draw f1, p1
fill(217, 32, 2);
ellipse(150,250, 20, 20);
/*Draw right flower (f1) petal 2 (p2) & color*/
//Draw f1, p2
fill(224, 192, 56);
ellipse(160,250, 23, 23);
/*Draw right flower (f1) petal 3 (p3) & color*/
//Draw f1, p3
fill(217, 32, 2);
ellipse(155,260, 15, 15);
//Draw left flower (f2) & color//
/*Draw left flower (f2) petal 1 (p1) & color*/
//Draw f2, p1
fill(217, 32, 2);
ellipse(100, 300, 20, 20);
/*Draw right flower (f2) petal 2 (p2) & color*/
//Draw f1, p2
fill(224, 192, 56);
ellipse(110, 290, 30, 30);
/*Draw right flower (f2) petal 3 (p3) & color*/
//Draw f1, p3
fill(217, 32, 2);
ellipse(110, 305, 23, 23);
////Set frameRate to 5////
frameRate(5);
}
/////////RE-DRAW CACTUS MAIN BODY FOR MOUSE CLICK FUNCTION///////////////////////////
void mousePressed() {
///Draw cactus main body & color///
//Draw c1
fill(73, 102, 65);
rect(90, 300, 20, 200);
//Draw c2
fill(50, 71, 1);
rect(110, 270, 20, 260);
//Draw c3
fill(125, 150, 83);
rect(130, 280, 20, 320);
//Draw c4
fill(180, 155, 101);
rect(150, 275, 20, 250);
//Draw c5
fill(163, 166, 53);
rect(170, 290, 20, 220);
////Draw flowers on cactus & color////
//Draw right flower (f1) & color//
/*Draw right flower (f1) petal 1 (p1) & color*/
//Draw f1, p1
fill(217, 32, 2);
ellipse(155,250, 15, 15);
/*Draw right flower (f1) petal 2 (p2) & color*/
//Draw f1, p2
fill(224, 192, 56);
ellipse(155,250, 18, 18);
/*Draw right flower (f1) petal 3 (p3) & color*/
//Draw f1, p3
fill(217, 32, 2);
ellipse(155,255, 10, 10);
//Draw left flower (f2) & color//
/*Draw left flower (f2) petal 1 (p1) & color*/
//Draw f2, p1
fill(217, 32, 2);
ellipse(110, 300, 15, 15);
/*Draw right flower (f2) petal 2 (p2) & color*/
//Draw f1, p2
fill(224, 192, 56);
ellipse(110, 295, 25, 25);
/*Draw right flower (f2) petal 3 (p3) & color*/
//Draw f1, p3
fill(217, 32, 2);
ellipse(105, 305, 18, 18);
////Set frameRate to 10////
frameRate(10);
}