Package ca.cgjennings.ui.anim
Class TweenAnimation
- java.lang.Object
-
- ca.cgjennings.ui.anim.TweenAnimation
-
- All Implemented Interfaces:
FrameComposer
public abstract class TweenAnimation extends java.lang.Object implements FrameComposer
A very simple animation with exactly three states: a start state, an end state, and one tween frame. It operates in one of two modes. In the first mode, it is assumed that the start state has already been in place for an unknown amount of time. The animator will immediately apply the tween frame and then (after allowing events generated by the tween frame to execute) apply the end frame as soon as possible. In the second mode, called two-shot, the start state is applied immediately, then the tween and end state are composed in sequence as above.- Author:
- Chris Jennings
-
-
Constructor Summary
Constructors Constructor Description TweenAnimation()TweenAnimation(boolean twoShot)TweenAnimation(boolean twoShot, FrameComposer composer)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcomposeEnd()Override this to compose the initial frame in a two-shot.voidcomposeFrame(float position)IfcomposeStart(),composeTween(), andcomposeEnd()are not overidden and no composer is set, this method is called to compose the animation.voidcomposeStart()Override this to compose the initial frame in a two-shot.voidcomposeTween()Override this to compose the initial frame in a two-shot.booleanisPlaying()Returnstrueif the animation is still playing.booleanisStopped()Returnstrueif the animation is stopped or stopping.voidplay()Play the animation.voidstop()Stop the animation as soon as possible if it is playing.
-
-
-
Constructor Detail
-
TweenAnimation
public TweenAnimation()
-
TweenAnimation
public TweenAnimation(boolean twoShot)
-
TweenAnimation
public TweenAnimation(boolean twoShot, FrameComposer composer)
-
-
Method Detail
-
play
public void play()
Play the animation.
-
stop
public void stop()
Stop the animation as soon as possible if it is playing.
-
isStopped
public boolean isStopped()
Returnstrueif the animation is stopped or stopping.- Returns:
trueif the animation is or will be stopped
-
isPlaying
public boolean isPlaying()
Returnstrueif the animation is still playing. (This will still betrueafter callingstop()until the animation actually halts.)- Returns:
trueif the animation is playing
-
composeStart
public void composeStart()
Override this to compose the initial frame in a two-shot. The base class delegates to the installed composer with position 0.
-
composeTween
public void composeTween()
Override this to compose the initial frame in a two-shot. The base class delegates to the installed composer with position 0.5.
-
composeEnd
public void composeEnd()
Override this to compose the initial frame in a two-shot. The base class delegates to the installed composer with position 1.
-
composeFrame
public void composeFrame(float position)
IfcomposeStart(),composeTween(), andcomposeEnd()are not overidden and no composer is set, this method is called to compose the animation. The base class implementation does nothing.- Specified by:
composeFramein interfaceFrameComposer- Parameters:
position-
-
-