An Animation stores a list of {@link TextureRegion}s representing an animated sequence, e.g. for running or jumping. Each region of an Animation is called a key frame, multiple key frames make up the animation.
Allows any object to react to events and draw an animation at a fixed interval. All animation methods are executed on the EDT. For simplicities sake all components are animatable, however no animation will appear unless it is explicitly registered into the parent form. In order to stop animation callbacks the animation must be explicitly removed from the form (notice that this differs from removing the component from the form!).
@author Shai Almog
The animation interface. This interface is implemented by each animation. It handles the offsets, durations and listeners.
The following explanation should help to implement your own animation. Before you start, have a look at {@link AbstractAnimation}, it provides most of the default behavior.
An animation runner, holding the animation, waits until getStartOffset() is reached.
If the start offset is reached and the animation is not prepared, prepare() will be called.
For each next animation step, executeStep() is called. This method should normalize the time to match the duration. The {@link Interpolator} can be applied here to get e.g. accelerate effects. The animate() method must betriggered afterwards with the new time progress value. The executeStep() method must return true if the animation will have further steps, false if the last step was executed.
In the animate call, the target components value must be changed according to the current time progress in relation to the getDuration() value.
If the duration is reached, finish() is called. isFinished() must return the correct finish state to allow the runner to ignore the animation if the time progress is past the duration value.
The animation listeners should retrieve their events in prepare call and finish call.
Animation of Sprite's The implemented timer is the most important part of an animation design pattern. It must implement a real time iterator to avoid visual artefacts while drawing the animation on screen. Yet correctly Threaded, the timer, a.k.a animator, calls a small timing framework to mesure a informal framerate and to retrieve next animation frame. Thereby nothing is done until the first paint-frame call occurs, whereas the buffer/cache is call-back to get the most current frame from the image file cache.
@see RenderingSceneListener#reset()
@see Sprite
@author www.b23prodtm.info
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.