Challenge: Falling Circle

Can you make a circle that will change color when it touches the base of the SVG canvas?

Problem statement

The tasks in this challenge are as follows:

  • Draw a canvas of size 500 x 500.
  • Draw a circle of radius (r=50) with the origin at (250,50).
  • The circle should transition to the bottom of the canvas and stop there.
  • The circle should change its color from black to green when it touches the base of the SVG canvas.
  • The transition time between the falling of the circle and the changing of the color when it touches the base should be 3000 ms.

Expected output

The output of your code should look like this:

Expected output

Coding exercise

The problem is designed to check your understanding, so you are encouraged to solve it on your own. If you are completely stuck then refer to the next lesson which will explain the solution in detail.

Coding exercise