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 void
composeEnd()
Override this to compose the initial frame in a two-shot.void
composeFrame(float position)
IfcomposeStart()
,composeTween()
, andcomposeEnd()
are not overidden and no composer is set, this method is called to compose the animation.void
composeStart()
Override this to compose the initial frame in a two-shot.void
composeTween()
Override this to compose the initial frame in a two-shot.boolean
isPlaying()
Returnstrue
if the animation is still playing.boolean
isStopped()
Returnstrue
if the animation is stopped or stopping.void
play()
Play the animation.void
stop()
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()
Returnstrue
if the animation is stopped or stopping.- Returns:
true
if the animation is or will be stopped
-
isPlaying
public boolean isPlaying()
Returnstrue
if the animation is still playing. (This will still betrue
after callingstop()
until the animation actually halts.)- Returns:
true
if 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:
composeFrame
in interfaceFrameComposer
- Parameters:
position
-
-
-