Assignment P5 animation
- Nicole Nitz
- Apr 16, 2019
- 1 min read

For this assignment we made a square that was able to bounce off of the top and bottom as well as both sides of the canvas and when the square touched the edges it changed color. The image of my code doesn't have the part where it changes color, but to explain the code, we made a canvas that was set to a certain size (600x600) and we set an x and a y axis. If the square went beyond 600 on the x or y axis we told it to turn in the other direction which makes it bounce off the edges. We also make the speed of x and y different so that it bounces all over the screen. If the speeds were the same the square would just bounce in the diagonal direction only.
Comments