# Class AnimationManager

java.lang.Object
com.codename1.ui.AnimationManager

public final class AnimationManager extends Object
Animation manager concentrates all of the animations for a given form into a single place that allows us to manage all mutations to a Form in a way the prevents collisions between mutations. The one type of animation that isn't handled by this class is the form level transition, replace transitions are handled by this class.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `addAnimation(ComponentAnimation an)`
  Adds the animation to the end to the animation queue
  `void`
  `addAnimation(ComponentAnimation an, Runnable callback)`
  Adds the animation to the end to the animation queue
  `void`
  `addAnimationAndBlock(ComponentAnimation an)`
  Adds the animation to the end of the animation queue and blocks the current thread until the animation completes
  `void`
  `addUIMutation(Container container, ComponentAnimation an)`
  Adds a UIMutation to the animation manager.
  `void`
  `addUIMutation(Container container, ComponentAnimation an, Runnable callback)`
  Adds a UIMutation to the animation manager.
  `void`
  `flushAnimation(Runnable r)`
  Invokes the runnable when all animations have completed
  `boolean`
  `isAnimating()`
  Returns true if an animation is currently in progress
  `void`
  `onTitleScrollAnimation(ComponentAnimation... cna)`
  Performs a step animation as the user scrolls down/up the page e.g.
  `void`
  `onTitleScrollAnimation(Container content, ComponentAnimation... cna)`
  Performs a step animation as the user scrolls down/up the page e.g.

  ### Methods inherited from class Object

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

- ## Method Details

  - ### isAnimating

    public boolean isAnimating()

    Returns true if an animation is currently in progress

    ###### Returns

    true if an animation is currently in progress

  - ### addUIMutation

    public void addUIMutation(Container container, ComponentAnimation an)

    Adds a UIMutation to the animation manager. If there are any current compatible UIMutations in the animation queue, then this mutation will be added to that mutation. Otherwise it will appended to the end of the queue to be run sequentially.

    ###### Parameters

    - `container`: The container that is being mutated.

    - `an`: The animation

    ###### Since

    7.0

    ###### See also

    - UIMutation

  - ### addAnimation

    public void addAnimation(ComponentAnimation an)

    Adds the animation to the end to the animation queue

    ###### Parameters

    - `an`: the animation object

  - ### addAnimationAndBlock

    public void addAnimationAndBlock(ComponentAnimation an)

    Adds the animation to the end of the animation queue and blocks the current thread until the animation completes

    ###### Parameters

    - `an`: the animation to perform

  - ### addAnimation

    public void addAnimation(ComponentAnimation an, Runnable callback)

    Adds the animation to the end to the animation queue

    ###### Parameters

    - `an`: the animation object

    - `callback`: invoked when the animation completes

  - ### addUIMutation

    public void addUIMutation(Container container, ComponentAnimation an, Runnable callback)

    Adds a UIMutation to the animation manager. If there are any current compatible UIMutations in the animation queue, then this mutation will be added to that mutation. Otherwise it will appended to the end of the queue to be run sequentially.

    ###### Parameters

    - `container`: The container that is being mutated.

    - `an`: The animation

    - `callback`: A callback to be run on completion.

    ###### Since

    7.0

    ###### See also

    - UIMutation

  - ### onTitleScrollAnimation

    public void onTitleScrollAnimation(ComponentAnimation... cna)

    Performs a step animation as the user scrolls down/up the page e.g. slowly converting a title UIID from a big visual representation to a smaller title for easier navigation then back again when scrolling up

    ###### Parameters

    - `cna`: the animation to bind to the scroll event

  - ### onTitleScrollAnimation

    public void onTitleScrollAnimation(Container content, ComponentAnimation... cna)

    Performs a step animation as the user scrolls down/up the page e.g. slowly converting a title UIID from a big visual representation to a smaller title for easier navigation then back again when scrolling up

    ###### Parameters

    - `content`: the scrollable container representing the body

    - `cna`: the animation to bind to the scroll event

  - ### flushAnimation

    public void flushAnimation(Runnable r)

    Invokes the runnable when all animations have completed

    ###### Parameters

    - `r`: the runnable that will be invoked after the animations