Here is the link for my week 2 assignment.
Based on work in week 1, I added more elements and properties to my balls. The changes doesn’t have certain exact meanings because at first I just wanted to explore functions as many as possible. Firstly, I created an object array to add more balls instead of having only one. And to make them more colorful, I changed the color but still kept certain color style. Instead of the red flicking rectangles, I made balls bounce on all of the sides. But since I made too many changes to their x speed, it was a little mess. So, later I still made them disappear on the boundary and reappear in the middle.
Since balls are all like falling by gravity, I added the function that the balls will float along the x-axis when the user presses the mouse. Since I changed background in the class method, I also control the number of balls under 100 to make the frames run normally.
Moreover, I added some shaking effect when the balls go up with sin function. And here is a brief demo video: