Difference between revisions of "Animation"
Line 32: | Line 32: | ||
</shell> | </shell> | ||
==Moving block== | ==Moving block== | ||
+ | You can click on "Show" to see the full program. | ||
+ | |||
+ | The method drawFrame is called 20 times; frame is a different value each time, the graphics object is new each time. | ||
+ | Draws a yellow rectangle at coordinates (50,8*frame-20) which is (50,-20), (50,-12), (50,-2), (50,6) ... (50,172) | ||
+ | So the yellow box appears at the top of the image and moves down a little with each frame. | ||
<question copyFile="classes.jar" imgOut='anim.gif' | <question copyFile="classes.jar" imgOut='anim.gif' | ||
width='150' height='100' className="Anim" | width='150' height='100' className="Anim" |
Revision as of 10:20, 1 December 2015
The animations here rely on Gif89Encoder available from http://jmge.net/java/gifenc/ developed by JMG Elliot.
Moving block
You can click on "Show" to see the full program.
The method drawFrame is called 20 times; frame is a different value each time, the graphics object is new each time. Draws a yellow rectangle at coordinates (50,8*frame-20) which is (50,-20), (50,-12), (50,-2), (50,6) ... (50,172) So the yellow box appears at the top of the image and moves down a little with each frame.
[Font]
[Default]
[Show]
[Resize]
[History]
[Profile]
Shooting Star
[Font]
[Default]
[Show]
[Resize]
[History]
[Profile]