Class AbstractEffect

    • Constructor Summary

      Constructors 
      Constructor Description
      AbstractEffect​(long lengthMilli, IMovement movement, java.lang.Runnable onStop, java.lang.Runnable onCancel)  
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      abstract void applyEffect​(long currentTime)
      Apply this effect.
      void cancel()
      Set the effect as done and run the cancel runnable.
      protected void doCancel()
      Run the onCancel runnable if any.
      void doEffect()
      Apply effect to the target according to the current time.
      protected void doStop()
      Run the onStop runnable if any.
      long getCurrentTime()  
      boolean isDone()  
      void processEnd()
      Check if the effect has ended.
      • Methods inherited from class java.lang.Object

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

      • runnableOnStop

        protected java.lang.Runnable runnableOnStop
      • runnableOnCancel

        protected java.lang.Runnable runnableOnCancel
      • length

        protected long length
      • startTime

        protected long startTime
      • done

        protected boolean done
      • easingFunction

        protected IMovement easingFunction
    • Constructor Detail

      • AbstractEffect

        public AbstractEffect​(long lengthMilli,
                              IMovement movement,
                              java.lang.Runnable onStop,
                              java.lang.Runnable onCancel)
    • Method Detail

      • applyEffect

        public abstract void applyEffect​(long currentTime)
        Apply this effect.
        Parameters:
        currentTime -
      • doCancel

        protected void doCancel()
        Run the onCancel runnable if any.
      • doStop

        protected void doStop()
        Run the onStop runnable if any.
      • getCurrentTime

        public long getCurrentTime()
      • processEnd

        public void processEnd()
        Check if the effect has ended. In that case, start the onStop runnable.
      • cancel

        public void cancel()
        Description copied from interface: IEffect
        Set the effect as done and run the cancel runnable.
        Specified by:
        cancel in interface IEffect
      • doEffect

        public void doEffect()
        Description copied from interface: IEffect
        Apply effect to the target according to the current time.
        Specified by:
        doEffect in interface IEffect
      • isDone

        public boolean isDone()
        Specified by:
        isDone in interface IEffect
        Returns:
        true if the effect as already reached its end.