Complete Animation Worksheet.
Make an app page for the app with the requirements listed.
Here are the requirements (these are the same as on the worksheet)
- Create a new app and add a Canvas. Set the Width to "fill parent"
and the height to 400. Add three balls from the Animation folder.
Code Ball1 so that, upon app startup, it moves smoothly from the left
edge of the screen to the right at 100 px/second. Code and test this
before you move on.
Code Ball2 so that, upon app startup, it moves smoothly from the top edge to the bottom edge at 20 pixels a second.
Code Ball3 so that, upon app startup, it moves smoothly and diagonally
from the top-left corner to the right-bottom corner. at 50 pixels a
Code Ball1 so that when it hits the right edge it reverses and goes left. It can stop when it hits the left edge.
Add Faster and Slower buttons that change the speed of Ball2 by 10%.
Code Ball3 so that it changes color every 20 ms.
Hint: You can set the PaintColor of a ball (or anything) using either a
built-in color or a number. For instance, dark orange is the number
-29696. So try setting the PaintColor of the ball in the
Screen.Initialize event, then adding 100 to it every 20 ms. For more
info on colors, see
Code Ball2 so that if it hits another ball, it immediately jumps to the top of the screen.
Code Ball2 so that when it hits the bottom edge, it reverses course and
goes up, and when it hits the top edge, it reverses course and goes
down. So it should go top-to-bottom, bottom-to-top, continuously.