NOC – Week 1: Bouncing Cube – Tiger Tian

Date: 02-17-2019

Click here to visit on p5 Web Editor

Above is a demo video of me playing with the bouncing cube I made with p5 Web Editor. It features a squarish object bouncing up and down the screen. Its color changes based on its position on the x-axis and y-axis. The gravity changes direction upon every mouse click, or whenever the cube touches the blinking red spot on the side of the screen. When gravity changes, so does the background color. It leaves a trace because of the opacity of the background color. 

A newly added feature, which was not included in the video, is that the size of the cube changes based on the X and Y position of the mouse, using a map function to adjust the ratio of its size change.

There is a bug that the object will get stuck at the top or the bottom of the screen if it bounces too fast. I have not found a good way to solve it yet.

Leave a Reply