transformation of an object over time (could be move, or rotate, or color change, etc.)
two ways to do it: clock timer or with image sprite properties
instructor: show these.
we'll look at the clock timer method first
x and/or y property of an object changes on clock.timer event
for smooth animation, use a small Clock.TimerInterval
two ways to move to the right:
set image1.X -> image1.X + 5 or...
image1.MoveTo (Image1.X+5, Image1.Y) note that Y just stays as it is
note similarity to Molemash scoring: set HitLabel to HitLabel + 1
demo: a canvas with an image sprite.
move it to the right 20 pixels a second, as soon as app begins
move it to right at 20 pixels a second, but smoothly.
how would you make it so it doesn't move until button is clicked?
demo: edgeReached to get ball going back and forth
Animation programming tasks
Write a single app with the following features. Test each feature as you go.
0. Add a canvas to the app with width of "fill parent" and height 400. Add three balls from the Animation folder to the canvas.
1. Ball1 should move, smoothly, from left of screen to right at 100 pixels a second. Code and test this before you go on.
2. Ball2 should move smoothly from top of screen to bottom at 20 pixels a second.
3. Ball3 should move diagonally top-left to bottom-right at 50 pixels a second.
4. Make it so all the balls reverse their course when they reach an edge, e.g., when hit right side, go left. Note this should work for diagonal ball as well.
5. Add "Faster" and "Slower" buttons that change speed of the balls by 10%
6. Make it so one of the balls changes color every 20 ms. colors.
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 http://experimental.appinventor.mit.edu/learn/reference/blocks/colors.html.
7. If top-to-bottom ball hits another ball, have it immediately go back to top.