Question: Java script In this program you will make a flashing explosion wherever you click. STAGE 1 - Create Explosion: Define a helper method that creates
In this program you will make a flashing explosion wherever you click. STAGE 1 - Create Explosion: Define a helper method that creates an explosion at the coordinates given by parameters x and y. This method should create a circle with radius 0 and give it appropriate properties necessary to make it expand by EXPLOSION RATE every frame until it reaches EXPLTOSION_RADIUS and then contract back to radius 0 at the same rate. STAGE 2 - Mouse Down Method: Define a mouse down method that calls the create explosion helper method passing the mouse x and mouse y coordinates. STAGE 3 - Animate Explosion: Define a timer method that steps each explosion so each circle either increases or decreases by the EXPLOSION_RATE, depending on what stage of the animation it is in. Each circle should also change to a random color each frame, with a red value between 50 and 255, a green value between 0 and 255, and a blue value of 0. When a circle has completed it's explosion (radius has contracted back to O), it should be removed from both the canvas and from the array of explosions. In this program you will make a flashing explosion wherever you click. STAGE 1 - Create Explosion: Define a helper method that creates an explosion at the coordinates given by parameters x and y. This method should create a circle with radius 0 and give it appropriate properties necessary to make it expand by EXPLOSION RATE every frame until it reaches EXPLTOSION_RADIUS and then contract back to radius 0 at the same rate. STAGE 2 - Mouse Down Method: Define a mouse down method that calls the create explosion helper method passing the mouse x and mouse y coordinates. STAGE 3 - Animate Explosion: Define a timer method that steps each explosion so each circle either increases or decreases by the EXPLOSION_RATE, depending on what stage of the animation it is in. Each circle should also change to a random color each frame, with a red value between 50 and 255, a green value between 0 and 255, and a blue value of 0. When a circle has completed it's explosion (radius has contracted back to O), it should be removed from both the canvas and from the array of explosions
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
