project03
var sunsize = 50;
var BR = 6;var BG = 6;var BB = 50;var BRG = 25;var BGG = 62;var BBG = 16;var SR = 255var SG = 255var SB = 255var sproutstemh = 610;
function setup() {
createCanvas(640, 480);
}
function draw() {
background(BR, BG, BB);
noStroke();
if ((mouseX >= 640) & (mouseX <= 640)){
mouseX = 640;
}
if ((mouseX > 0) & (mouseX < 400)){
BR = mouseX*((187-6)/400) + 6;
BG = mouseX*((235-6)/400) + 6;
BB = mouseX*((235-50)/400) + 50;
}
fill(SR, SG, SB);
var constrainy = constrain(mouseY, 0, 300);
var constrainx = constrain(mouseX, 0, 600);
ellipse(constrainx, constrainy, sunsize, sunsize);
if ((mouseX > 640) & (mouseX < 640)){
mouseX = 640;
}
if ((mouseX > 0) & (mouseX < 640)){
SR = mouseX*((255-255)/640) + 255;
SG = mouseX*((199-255)/640) + 255;
SB = mouseX*((5-255)/640) + 255;
}
sunsize = (0.5*(mouseX+mouseY));
fill(BRG, BGG, BBG);
rect(0, 400, 680, 100);
if ((mouseX > 640) & (mouseX < 640)){
mouseX = 640;
}
if ((mouseX > 0) & (mouseX < 640)){
BRG = mouseX*((78-25)/640) + 25;
BGG = mouseX*((174-62)/640) + 62;
BBG = mouseX*((55-16)/640) + 16;
} push();
translate(35, -mouseX+200); sproutS = rect(35, sproutstemh, 10, 300, 10);
sprout2S = rect(105, sproutstemh, 10, 300, 10);
sprout3S = rect(175, sproutstemh, 10, 300, 10);
sprout4S = rect(245, sproutstemh, 10, 300, 10);
sprout5S = rect(315, sproutstemh, 10, 300, 10);
sprout6S = rect(385, sproutstemh, 10, 300, 10);
sprout7S = rect(455, sproutstemh, 10, 300, 10);
sprout8S = rect(525, sproutstemh, 10, 300, 10);
pop();
if ((mouseX > 450)){ sproutL = ellipse(60, 380, 25, 20);
sprout3L = ellipse(200, 370, 25, 20);
sprout7L = ellipse(480, 360, 25, 20);
}
if ((mouseX > 480)){ sprout2L = ellipse(130, 385, 25, 20);
sprout4L = ellipse(300, 360, 25, 20);
sprout6L = ellipse(410, 370, 25, 20);
sproutL2 = ellipse(90, 320, 25, 20);
sprout3L2 = ellipse(230, 320, 25, 20);
sprout7L2 = ellipse(510, 330, 25, 20);
}
if ((mouseX > 520)){ sprout5L = ellipse(340, 355, 25, 20);
sprout8L = ellipse(580, 350, 25, 20);
sprout2L2 = ellipse(160, 325, 25, 20);
sprout3L3 = ellipse(200, 300, 25, 20);
sprout4L2 = ellipse(270, 310, 25, 20);
sprout6L2 = ellipse(440, 320, 25, 20);
sprout7L3 = ellipse(480, 290, 25, 20);
}
if ((mouseX > 540)){ sproutL3 = ellipse(60, 260, 25, 20);
sprout2L3 = ellipse(130, 280, 25, 20);
sprout3L4 = ellipse(230, 275, 25, 20);
sprout4L3 = ellipse(300, 255, 25, 20);
sprout5L2 = ellipse(370, 260, 25, 20);
sprout6L3 = ellipse(410, 260, 25, 20);
sprout7L4 = ellipse(510, 250, 25, 20);
sprout8L2 = ellipse(550, 260, 25, 20);
}
if ((mouseX > 575)){ fill(247, 154, 185); ellipse(50, 200, 40, 40);
fill(255, 180, 0); ellipse(190, 200, 40, 40);
fill(191, 63, 63); ellipse(120, 200, 40, 40);
fill(31, 144, 0); ellipse(330, 200, 40, 40);
fill(255, 234, 0); ellipse(260, 200, 40, 40);
fill(136, 73, 189); ellipse(470, 200, 40, 40);
fill(17, 46, 173); ellipse(400, 200, 40, 40);
fill(70, 63, 69); ellipse(540, 200, 40, 40);}
if ((mouseX > 565)){ fill(247, 154, 185); ellipse(100, 200, 40, 40);
fill(255, 180, 0); ellipse(240, 200, 40, 40);
fill(191, 63, 63); ellipse(170, 200, 40, 40);
fill(31, 144, 0); ellipse(380, 200, 40, 40);
fill(255, 234, 0); ellipse(310, 200, 40, 40);
fill(136, 73, 189); ellipse(520, 200, 40, 40);
fill(17, 46, 173); ellipse(450, 200, 40, 40);
fill(70, 63, 69); ellipse(590, 200, 40, 40);}
if ((mouseX > 570)){ fill(247, 154, 185); ellipse(75, 180, 40, 40);
fill(255, 180, 0); ellipse(215, 180, 40, 40);
fill(191, 63, 63); ellipse(145, 180, 40, 40);
fill(31, 144, 0); ellipse(355, 180, 40, 40);
fill(255, 234, 0); ellipse(285, 180, 40, 40);
fill(136, 73, 189); ellipse(495, 180, 40, 40);
fill(17, 46, 173); ellipse(425, 180, 40, 40);
fill(70, 63, 69); ellipse(565, 180, 40, 40);}
if ((mouseX > 555)){ fill(247, 154, 185); ellipse(60, 225, 40, 40);
fill(255, 180, 0); ellipse(200, 225, 40, 40);
fill(191, 63, 63); ellipse(130, 225, 40, 40);
fill(31, 144, 0); ellipse(340, 225, 40, 40);
fill(255, 234, 0); ellipse(270, 225, 40, 40);
fill(136, 73, 189); ellipse(480, 225, 40, 40);
fill(17, 46, 173); ellipse(410, 225, 40, 40);
fill(70, 63, 69); ellipse(550, 225, 40, 40);}
if ((mouseX > 560)){ fill(247, 154, 185); ellipse(90, 225, 40, 40);
fill(255, 180, 0); ellipse(230, 225, 40, 40);
fill(191, 63, 63); ellipse(160, 225, 40, 40);
fill(31, 144, 0); ellipse(370, 225, 40, 40);
fill(255, 234, 0); ellipse(300, 225, 40, 40);
fill(136, 73, 189); ellipse(510, 225, 40, 40);
fill(17, 46, 173); ellipse(440, 225, 40, 40);
fill(70, 63, 69); ellipse(580, 225, 40, 40);}
if ((mouseX > 550)){ fill(211, 86, 115); ellipse(75, 205, 25, 25);
fill(194, 139, 7); ellipse(215, 205, 25, 25);
fill(160, 38, 38); ellipse(145, 205, 25, 25);
fill(21, 99, 0); ellipse(355, 205, 25, 25);
fill(220, 202, 0); ellipse(285, 205, 25, 25);
fill(96, 39, 144); ellipse(495, 205, 25, 25);
fill(8, 32, 132); ellipse(425, 205, 25, 25);
fill(33, 30, 31); ellipse(565, 205, 25, 25);
}}
1) You can only see the flowers fully grow if you’re looking at the code on a full 640×480 canvas
This project was really difficult for me because there were so many options that I could have done and it was hard for me to really decide what I wanted to code for this project.


These were some initial sketches I did of possible things that I could have attempted to code (unsure if the drawings even make sense), but I decided to try and stick with my theme that I had in my last project, which is the idea of using sprouts. I wanted to try to make the sprouts look like they were growing depending on where the sun is (on the x-axis) and I wanted to change the color of the sky, grass, and the sun depending on where the mouse is (on the x-axis) and also allowing the sun to grow smaller and bigger depending on where it is on the canvas.
It was difficult for me to try and figure out how to code certain things, especially the growing stems for the plants because I tried to do that for my last project. I figured out a way to do it, but I’m sure there is a more efficient way to do it that I want to try and figure out next time.
Another aspect that I wanted to incorporate in this project was to try and draw different flowers like sunflowers, but I found it too difficult to do sadly. Maybe next time.