Class TweenEngine

java.lang.Object
de.gurkenlabs.litiengine.tweening.TweenEngine
All Implemented Interfaces:
ILaunchable, IUpdateable

public class TweenEngine
extends java.lang.Object
implements IUpdateable, ILaunchable
The TweenEngine is the central manager for Tweens. It tracks all current Tween instances and applies their TweenEquation with every GameLoop update.
  • Constructor Summary

    Constructors 
    ConstructorDescription
    TweenEngine()
    Instantiates a new TweenEngine.
  • Method Summary

    Modifier and TypeMethodDescription
    Tweenbegin​(Tweenable target, TweenType type, int duration)
    Begins a new Tween.
    TweengetTween​(Tweenable target, TweenType type)
    Attempts to get a previously registered Tween or registers a new one.
    java.util.Map<Tweenable,​java.util.Map<TweenType,​Tween>>getTweens()
    Gets the map of registered Tweens.
    voidremove​(Tweenable target, TweenType type)
    Looks for a registered Tween instance with the given target and type.
    Tweenreset​(Tweenable target, TweenType type)
    Looks for a registered Tween instance with the given target and type.
    Tweenresume​(Tweenable target, TweenType type)
    Looks for a registered Tween instance with the given target and type.
    voidstart()
    Start.
    Tweenstop​(Tweenable target, TweenType type)
    Looks for a registered Tween instance with the given target and type.
    voidterminate()
    Terminate.
    voidupdate()
    Updates all registered Tweens by applying the TweenEquation.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • TweenEngine

      public TweenEngine()
      Instantiates a new TweenEngine.
  • Method Details

    • begin

      public Tween begin​(Tweenable target, TweenType type, int duration)
      Begins a new Tween. If a Tween is already registered for the Tweenable with the given TweenType, it is restarted with the given duration.
      Parameters:
      target - the Tweenable target object
      type - the TweenType determining which values of the target object will be modified.
      duration - the duration of the Tween in milliseconds.
      Returns:
      the Tween instance
    • getTween

      public Tween getTween​(Tweenable target, TweenType type)
      Attempts to get a previously registered Tween or registers a new one.
      Parameters:
      target - the Tweenable target object
      type - the TweenType determining which values of the target object will be modified.
      Returns:
      the Tween instance
    • getTweens

      public java.util.Map<Tweenable,​java.util.Map<TweenType,​Tween>> getTweens()
      Gets the map of registered Tweens.
      Returns:
      the map of registered Tweens.
    • reset

      public Tween reset​(Tweenable target, TweenType type)
      Looks for a registered Tween instance with the given target and type. Attempts to stop the Tween and reset the Tweenable values to the start values.
      Parameters:
      target - the Tweenable target object
      type - the TweenType determining which values of the target object will be modified.
      Returns:
      the Tween instance
    • resume

      public Tween resume​(Tweenable target, TweenType type)
      Looks for a registered Tween instance with the given target and type. Attempts to resume the Tween if it was stopped.
      Parameters:
      target - the Tweenable target object
      type - the TweenType determining which values of the target object will be modified.
      Returns:
      the Tween instance
    • start

      public void start()
      Start.
      Specified by:
      start in interface ILaunchable
    • remove

      public void remove​(Tweenable target, TweenType type)
      Looks for a registered Tween instance with the given target and type. Attempts to remove the Tween from the TweenEngine.
      Parameters:
      target - the Tweenable target object
      type - the TweenType determining which values of the target object will be modified.
    • stop

      public Tween stop​(Tweenable target, TweenType type)
      Looks for a registered Tween instance with the given target and type. Attempts to stop the Tween.
      Parameters:
      target - the Tweenable target object
      type - the TweenType determining which values of the target object will be modified.
      Returns:
      the Tween instance
    • terminate

      public void terminate()
      Terminate.
      Specified by:
      terminate in interface ILaunchable
    • update

      public void update()
      Updates all registered Tweens by applying the TweenEquation.
      Specified by:
      update in interface IUpdateable
      See Also:
      ClientConfiguration.setMaxFps(int)