Class Animator


public class Animator extends AnimBuilder
Handles creation and management of animations. Animations may involve the tweening of a geometric property of a layer (x, y, rotation, scale, alpha), or simple delays, or performing actions. Animations can also be sequenced to orchestrate complex correlated actions.

onPaint should be connected to a paint signal to drive the animations.

  • Field Details

    • onPaint

      public final react.Slot<Clock> onPaint
      Performs per-frame animation processing. This should be connected to a paint signal.
  • Constructor Details

    • Animator

      public Animator()
      Creates an animator which is not connected to a frame signal. You must manually connect onPaint to a frame signal to drive this animator.
    • Animator

      public Animator(react.Signal<Clock> paint)
      Creates an animator which is permanently connected to paint. This is useful when you are connecting to a paint signal whose lifetime is the same as this animator because there's no way to ever disconnect the animator from the signal.
  • Method Details

    • addBarrier

      public void addBarrier()
      Causes this animator to delay the start of any subsequently registered animations until all currently registered animations are complete.
    • addBarrier

      public void addBarrier(float delay)
      Causes this animator to delay the start of any subsequently registered animations until the specified delay (in milliseconds) has elapsed after this barrier becomes active. Any previously registered barriers must first expire and this barrier must move to the head of the list before its delay timer will be started. This is probably what you want.
    • clear

      public void clear()
      Clears out any pending animations. NOTE all animations simply disappear. Any queued animations that invoked actions will not execute, nor will the cleanup actions of any animations that involve cleanup. This should only be invoked if you know the layers involved in animations will be destroyed separately.
    • add

      public <T extends Animation> T add(T anim)
      Registers an animation with this animator. It will be started on the next frame and continue until cancelled or it reports that it has completed.
      Specified by:
      add in class AnimBuilder