DO: Create a sketch that includes (all of these):
- One element controlled by the mouse.
- One element that changes over time, independently of the mouse.
- One element that is different every time you run the sketch.
- e.g. Try refactoring your Week 1 HW by removing all the hard-coded numbers except for createCanvas(). Have some of the elements follow the mouse. Have some move independently. Have some move at random.
- e.g. Do the above but change color, alpha, and/or strokeWeight instead of position.
- Or do something completely different!
- I am thinking of making like minesweeper maybe?
- Or a landscape where you can plant flowers?
I ended up going with the landscape idea. I had no knowledge of what to do and how. By watching Shiffman (
I am going to have some scary dreams he was super helpful) and doing rigorous amounts of googling, I kinda mashed up all the code I found and got more familiar with functions like mousePressed ();, mouseClicked();, mouseReleased();, random(), etc. Though, to be honest I still don’t fully understand them.
My previous hurdle was drawing different kinds of shapes. This time by using the P5 Playground (whoever made it deserves a Nobel Peace Prize, because idk what I would have done without it). I achieved more than I’d hoped for thanks to this tool. I am a very visual person, so sitting and calculating/guessing locations of x and y is so last week. I got my green mountains done fairly quick.
I set the frame rate to 3 at the moment in order to prevent the constant flickering of the sun rays. It’s better when it’s set to 1, but then the placement of stars takes longer. Ideally, I’d like to slow down the speed of the sun rays’ changing colors. I tried setting a separate frame rate in a push pop enclosure – it didn’t work.
All in all, this time it took 5 hours to complete my sketch. I consider that a win, seeing as the previous one took me 3 hours.
The final result
So in my sketch you can click on the background and stars will appear. The sunset changes with every load of the sketch and the sun rays randomly change between certain values of RGB at all times. I think I nailed the three main criteria.
I could probably add more detail and some such and figure out how to code the disappearance of stars, but I am afraid it will take ten years.