Class 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
    • 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)
      If composeStart(), composeTween(), and composeEnd() 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()
      Returns true if the animation is still playing.
      boolean isStopped()
      Returns true 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.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 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()
        Returns true if the animation is stopped or stopping.
        Returns:
        true if the animation is or will be stopped
      • isPlaying

        public boolean isPlaying()
        Returns true if the animation is still playing. (This will still be true after calling stop() 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)
        If composeStart(), composeTween(), and composeEnd() 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 interface FrameComposer
        Parameters:
        position -