Assignment 9
Link to Assignment
Concept / Inspiration
For this homework assignment, I was inspired by our final sketch in class in which we experimented with creating a spring class. It made me think a bit of a yoyo, so I attempted to create a yoyo that uses the spring mechanism to bounce from a static point.
Additionally, I wanted to add some other force to make it more dynamic, so I added a light wind that applies every third frame of the sketch. Furthermore, I added a simple particle class to help visualize the force of the wind on the yoyo.
Construction
This sketch includes three main classes: Ball, Wind, and Yoyo. The ball class is the basic construction for both the static top point and the structure of the yoyo that swings down. Because I want the top point to remain static, throughout the sketch it only updates and displays itself whereas the large ellipse that moves also applies the force of wind, checks collision against the top ball (so as to deflect off of it) and can use the ‘drop’ method which increases its y value while mouseIsPressed().
Meanwhile, the Yoyo class is the spring mechanism. While it is constantly displayed, it only updates when the mouse is not pressed so as to not interfere with dropping the ball. It functions using Hook’s law just as we setup the ‘Spring’ class in class.
Finally, the Wind class is a super basic class that simply draws a set of small ellipses that constantly move left to help visualize the wind force that’s applied to the ball. The number of particles remains static and they simply reset to the screen width once they hit 0. The wind in the Wind class is actually not correlated at all to the windForce applied to the ball, its simply a mechanism for visualizing the force.
Overall, the sketch mimics a yoyo blowing in the wind. When the user presses the mouse, the yoyo extends downward and, when released, springs back up towards its central point. An issue that arises, however, is if you leave the yoyo to move left with the wind, it reaches a point where it becomes static and no longer springs away lightly from the static point as would be expected if under the influence of wind.
Final Remarks
This sketch was really helpful in practicing the concept of ‘spring’ and motion. I’d like to figure out how to make the motion more fluid and somehow allow the line to curve or bend as the ball springs rather than remain straight as its currently coded. Furthermore, once a string, weighted on one end, is dropped to its full extent, it sends a vibration through the string itself upwards towards the source. I’d like to figure out how to mimic this motion to create a more realistic yoyo.