Bouncing Balls Project Description This project will show bouncing balls in the browser. The user will be given three options: how many balls they want bouncing (max of 5), what color they want the balls to be (red, green, blue, or random), and whether or not they will fade in and out. These options will be written in a form containing a text box, radio buttons, and check boxes. After these are filled out, the user clicks a “submit” button. Their results will show in a “ball pit” which is the area the balls will be bouncing in. This will fade in showing the bouncing balls. The form and the ball pit will use different z-‐
indexes and opacities to switch between what is shown. Once the simulation is complete after 10-‐15 seconds, the form will appear again allowing the user to redo the simulation with different options. Pseudocode: Instructions to user: Fill out the form selecting your desired options. Click the submit button to see the bouncing ball simulation. Form: 1) Text box = number of balls (please enter a number equal to or less than five) 2) Radio buttons = color options 3) Check boxes = fade in and out yes or no 4) Submit button = run the animation When the user clicks the submit button. If (greater than 5 or less than 1) { Alert(number must be between 1-‐5) Stop, don’t continue. } Hide form and show ‘ball pit’ Start Timer for simulation end Based on input – generate balls (Array of Points and Array of ‘velocities’) Create drawing interval (repeats for each frame) { Clear Screen for (ball in balls) { Update position of ball if (touching wall) { Update velocity of ball } } } When simulation timer ends { If (fade checkbox selected) { for (ball in balls) { Fade out ball } } Remove all balls Show form and fade out ball pit } Visual Design Fill out the form selecting your desired options. Click the submit button to see the bouncing ball simulation. Form: 1) Text box = number of balls (please enter a number equal to or less than five) 2) Radio buttons = color options 3) Check boxes = fade in and out yes or no 4) Submit button = run the animation [Form disappears and simulation appears] Testing I will build this project step by step by adding in a section of code and then checking it. If it works the way I want, I move on. This will allow me to test as I build and catch any problems before proceeding to the next step. Once all the code is written, I will test the simulation multiple times with different inputs in the form to make the sure the bouncing balls are working correctly. I will check to see if the program is adding in the right number of balls, if it makes the balls the correct color, and if it makes the balls fade in and out. I will also check to see how well the form and the ball pit appearing and disappearing works.
© Copyright 2026 Paperzz