Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Make a ball bouncing. The ball can be an image (Redball.png as attached). You are welcome draw your own, which might be better. You are

  1. Make a ball bouncing. The ball can be an image (Redball.png as attached). You are welcome draw your own, which might be better. You are expected to submit three files: ball.html, ball.css, and ball.js. You can access its tyle attribute by using document.getElementByID(ball). You can create a .css for the html so that the ball and its box look like this:

image text in transcribed

The ball should start bouncing as soon as the web page is loaded (look up window.onload). E.g. window.onload = function()

Write two separate .js file and make sure your code can do the following:

  1. (4pts) The ball keep bounces at a constant speed without decay( constant bouncing).

  1. (3pts) The ball bounces but the speed decays to zero.

  1. (3pts)The ball bounces but also moves to the right end of the wall and disappears.

  1. (5pts) Modify your code so that when you press the Z key, the ball slows down, and when you press the X key, it speeds up. Once that is working, use C to make the ball smaller and V make it larger.

Hint: the animation is created by changing the position of the ball.

You might find the following code snippets helpful:

var ball = document.getElementById("ball");

ball.style.top = ballY + "px";

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Microsoft Visual Basic 2008 Comprehensive Concepts And Techniques

Authors: Gary B. Shelly, Corinne Hoisington

1st Edition

1423927168, 978-1423927167

More Books

Students also viewed these Databases questions