For this piece which had to incorporate arrays and objects, I was inspired by the poetry book called “the sun and her flowers” by rupi kaur. While I was looking around at my desk, in order to get inspired on what to work on, my eyes got fixated on the cover and at that moment I decided that I wanted to do something that incorporated the book into my code, as my life has been entangled with the book up to that point.
Hence I first started by designing the sunflower class. The hardest part for me in this was making small circles that would form a silhouette of a circle altogether in the middle of the sunflower. The math to figure out to make sure that the final shape was also a circle took some time as well as trial and error, as even when I incorporated the right math, sometimes my results would be different due to misusing other commands (such as int()). After being able to make the middle of the sunflower, the petals were similar to drawing as it was an iteration of the ellipses in an angle around the middle of the flower. For an artistic choice, I decided to make them a range of yellow with also a range of transparency, so that it would give a feeling for the range of differences between flowers, hence adding to each one of the flowers’ uniqueness.
After finishing up the flower object, I worked on the sun and moon which share the same class, and this was pretty straightforward to make by making the constructor pass on the starting location of the sun and moon as well as their color, the rest of qualities for the two were common.
One thing I decided later on was making the flowers move downwards as the sun went out of the frame and the moon came, while the background darkened. This was particularly hard, as the making of the petals, center, and stem for each flower was unique, and while going down they should not be changing in each frame. Trying to figure out the mechanics of this, defining its most central variables in the constructor while the actual drawing happening was in the draw function of the sunflower took some time to perfect, but in the end, I was able to print each flower going down while keeping the same composition for petals and stem, while the middle would be dynamic, giving in a way more life to the flowers.
Link to p5js:
https://editor.p5js.org/iremnaz/sketches/YpKfMJJaH