mouse pressed to shift (tehcnically) the petals 'enter' to chaange petal cover
xxxxxxxxxx
//GLOBAL VARAIBLE SPACE---------------------
let petalArray;
let stemArray;
//PRELOAD-----------------------------------
//MAIN FUNCTIONS----------------------------
function setup() {
createCanvas(600, 600);
//INITIATE VARIABLE
petalArray = [color(255,80,51), color(255,64,0), color(147,113,108), color(249, 213, 229),color(91, 154, 160), color(184, 169, 201)];
stemArray = [rect(400,300,20,250), rect(350,250,20,250), rect(375,275,20,200)];
//MODE
//rectMode(CENTER);
ellipseMode(CENTER);
}//END SETUP
function draw() {
background(136,205,250);
//grass
noStroke();
fill(86,125,70);
rect(0,425,600,175);
for(let x=0; x<600; x+=10){
fill(86,125,70);
triangle(x,425,x+10,420,x+20,425)
}
//trees
noStroke();
fill(70,51,0);
rect(70,70,40,400);
noStroke();
fill(89,60,31);
rect(45,100,55,400);
noFill();
fill (85,107,47);
circle(100,50,200);
circle(140,125,75);
circle(160,100,70);
circle(180,70,55);
circle(190,40,50);
circle(190,5,60);
fill(107,142,35);
circle(45,135,70);
circle(10,135,70);
circle(10,10,300);
circle(150,5,60);
circle(140,45,60);
circle(125,70,60);
circle(110,100,50);
circle(90,130,50);
fill(25,52,0);
circle(110,450,85);
circle(100,470,70);
circle(130,430,50);
circle(125,465,60);
//SUNFLOWER
fill (0,93,50);
rect(400,300,20,250);
if(mouseIsPressed){
keyCode == 'DELETE';
translate(10,0);
}
//ellipse for flower petals refernce to p5js
fill(227,187,28);
translate(410, 275);
noStroke();
fill(227,187,28);
for (let i = 0; i < 10; i ++) {
ellipse(0, 30, 40, 80);
rotate(PI/5);
if (keyIsPressed){
keyCode === 'ENTER';
fill(random(petalArray));
frameRate(1);
}//flower
}
stroke(0);
strokeWeight(3);
fill(0);
line(390,290,395,307);
}//END DRAW