This assignment is to create a project that involves object-oriented programming with some interactivity. Inspired by Samantha’s project last week of dandelion, I aimed to develop a project of dandelion the leaves of which will be blown to all directions after the mouse is clicked.
I started with creating a static dandelion. The branch was created with simple rect() and ellipse() and I created one piece of leaf as a unit using vertex().
The unit should align around the pistil, so an array was used to store the rotation degree of 150 units of leaves. And here is the picture of my static dandelion.
To achieve the interactivity, the mouseClicked() function was used to detect the condition whether the mouse has clicked. And translation function was used to change the position of the leaves. And here is what I finally achieved.
I didn’t encounter any difficulty that would stop me for a while during this assignment. However, I think the visual effect could be greatly improved in the future. First, the leaves actually turned around before going out in its blown direction, which could be fixed with the translate function. Second, all the leaved were going out in almost the same speed, which could be improved with more arrays to customize the speed of each leave. And finally, the leaves goes in similar directions after blown in reality, so this is a point to further consider in order to improve this project.