Class AnimationRunner


  • public class AnimationRunner
    extends java.lang.Object

    An animation runner which can run only one effect at the same time.

    Example :

    AnimationRunner runner = new AnimationRunner();
    AlphaEffect effect = new AlphaEffect(shell, 0 , 255 , 4000 , new ExpoOut(), null , null );
    runner.runEffect( effect);

    • Field Summary

      Fields 
      Modifier and Type Field Description
      (package private) int delay
      Default is 50 fps.
      (package private) IEffect effect  
      (package private) boolean running  
      protected long startTime  
    • Constructor Summary

      Constructors 
      Constructor Description
      AnimationRunner()
      Create a new animation runner using the default framerate (50 fps)
      AnimationRunner​(int framerate)
      Create a new animation runner, which can run only one effect at the same time.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void cancel()
      Stops the current effect if any, and execute the corresponding onCancel runnable.
      private long getCurrentTime()
      Return elapsed time in this animation.
      IEffect getEffect()
      Get current effect, or null if no effect is currently running.
      void runEffect​(IEffect effect)
      Start a new effect, cancelling the previous one if any.
      private void startEffect()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • delay

        int delay
        Default is 50 fps.
      • running

        boolean running
      • startTime

        protected long startTime
    • Constructor Detail

      • AnimationRunner

        public AnimationRunner()
        Create a new animation runner using the default framerate (50 fps)
      • AnimationRunner

        public AnimationRunner​(int framerate)
        Create a new animation runner, which can run only one effect at the same time.
        Parameters:
        framerate - the animation framerate.
    • Method Detail

      • getEffect

        public IEffect getEffect()
        Get current effect, or null if no effect is currently running.
        Returns:
      • runEffect

        public void runEffect​(IEffect effect)
        Start a new effect, cancelling the previous one if any.
        Parameters:
        effect -
      • cancel

        public void cancel()
        Stops the current effect if any, and execute the corresponding onCancel runnable.
      • getCurrentTime

        private long getCurrentTime()
        Return elapsed time in this animation.
        Returns:
        time (ms)
      • startEffect

        private void startEffect()