Package icyllis.modernui.animation

# Class AnimationHandler

java.lang.Object
icyllis.modernui.animation.AnimationHandler

@Internal public class AnimationHandler extends Object
This custom, static handler handles the timing pulse that is shared by all active ValueAnimators. This approach ensures that the setting of animation values will happen on the same thread that animations start on, and that all animations will share the same times for calculating their values, which makes synchronizing animations possible.

- ## Nested Class Summary

  Nested Classes
  Modifier and Type
  Class
  Description
  `static interface`
  `AnimationHandler.FrameCallback`
  Callbacks that receives notifications for animation timing.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `addFrameCallback(AnimationHandler.FrameCallback callback, long delay)`
  Register to get a callback on the next frame after the delay.
  `static int`
  `getAnimationCount()`
  Return the number of callbacks that have registered for frame callbacks.
  `static AnimationHandler`
  `getInstance()`
  `void`
  `removeCallback(AnimationHandler.FrameCallback callback)`
  Removes the given callback from the list, so it will no longer be called for frame related timing.

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Method Details

  - ### getInstance

    @NonNull public static AnimationHandler getInstance()

  - ### getAnimationCount

    public static int getAnimationCount()
    Return the number of callbacks that have registered for frame callbacks.

  - ### addFrameCallback

    public void addFrameCallback(@NonNull AnimationHandler.FrameCallback callback, long delay)
    Register to get a callback on the next frame after the delay. If the callback is ever registered, the delay will be overridden.
    Parameters:
      `callback` - the callback to register
      `delay` - delayed time in milliseconds, if > 0

  - ### removeCallback

    public void removeCallback(@NonNull AnimationHandler.FrameCallback callback)
    Removes the given callback from the list, so it will no longer be called for frame related timing.
    Parameters:
      `callback` - the callback to unregister