# Class ComponentAnimation

java.lang.Object
com.codename1.ui.animations.ComponentAnimation

Direct Known Subclasses:
  `ComponentAnimation.UIMutation`

public abstract class ComponentAnimation extends Object
Parent class representing an animation object within the AnimationManager queue.

- ## Nested Class Summary

  Nested Classes
  Modifier and Type
  Class
  Description
  `static class`
  `ComponentAnimation.UIMutation`
  A special kind of ComponentAnimation that encapsulates a mutation of the user interface.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `ComponentAnimation()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `addOnCompleteCall(Runnable r)`
  Invokes the runnable just as the animation finishes thus allowing cleanup of the UI for the upcoming animations, this is useful when running a complex sequence
  `static ComponentAnimation`
  `compoundAnimation(ComponentAnimation... anims)`
  Allows us to create an animation that compounds several separate animations so they appear as a single animation to the system and process in parallel
  `void`
  `flush()`
  Flushes the animation immediately, this will be called if the form is de-initialized
  `int`
  `getMaxSteps()`
  The total number of steps in this animation.
  `int`
  `getStep()`
  `abstract boolean`
  `isInProgress()`
  Indicates if the animation is in progress
  `boolean`
  `isStepModeSupported()`
  Step mode allows stepping thru an animation one frame at a time, e.g.
  `static ComponentAnimation`
  `sequentialAnimation(ComponentAnimation... anims)`
  Allows us to create an animation that places several separate animations in a sequence so they appear as a single animation to the system and process one after the other
  `final void`
  `setNotifyLock(Object l)`
  This method is used internally by the addAnimationAndBlock method of AnimationManager and shouldn't be used outside of that.
  `final void`
  `setOnCompletion(Runnable r)`
  This method is used internally by the addAnimation method of AnimationManager and shouldn't be used outside of that.
  `void`
  `setStep(int step)`
  Sets the current animation step to a value between 0 and maxSteps
  `final void`
  `updateAnimationState()`
  Invoked by the animation manager internally
  `protected abstract void`
  `updateState()`
  Updates the animation state

  ### Methods inherited from class Object

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

- ## Constructor Details

  - ### ComponentAnimation

    public ComponentAnimation()

- ## Method Details

  - ### compoundAnimation

    public static ComponentAnimation compoundAnimation(ComponentAnimation... anims)

    Allows us to create an animation that compounds several separate animations so they appear as a single animation to the system and process in parallel

    ###### Parameters

    - `anims`: the animations

    ###### Returns

    the compounded animation

  - ### sequentialAnimation

    public static ComponentAnimation sequentialAnimation(ComponentAnimation... anims)

    Allows us to create an animation that places several separate animations in a sequence so they appear as a single animation to the system and process one after the other

    ###### Parameters

    - `anims`: the animations

    ###### Returns

    the sequential animation

  - ### addOnCompleteCall

    public void addOnCompleteCall(Runnable r)

    Invokes the runnable just as the animation finishes thus allowing cleanup of the UI for the upcoming animations, this is useful when running a complex sequence

    ###### Parameters

    - `r`: the runnable to call when the animation is done

  - ### isStepModeSupported

    public boolean isStepModeSupported()

    Step mode allows stepping thru an animation one frame at a time, e.g. when scrolling down an animation might change title elements then change them back as we scroll up.

    ###### Returns

    true if this animation can be stepped in which case the setStep etc. methods should work.

  - ### getStep

    public int getStep()

  - ### setStep

    public void setStep(int step)

    Sets the current animation step to a value between 0 and maxSteps

    ###### Parameters

    - `step`: the current step

  - ### getMaxSteps

    public int getMaxSteps()

    The total number of steps in this animation.

    ###### Returns

    the number of steps

  - ### isInProgress

    public abstract boolean isInProgress()

    Indicates if the animation is in progress

    ###### Returns

    true if in progress

  - ### updateState

    protected abstract void updateState()
    Updates the animation state

  - ### updateAnimationState

    public final void updateAnimationState()
    Invoked by the animation manager internally

  - ### flush

    public void flush()
    Flushes the animation immediately, this will be called if the form is de-initialized

  - ### setNotifyLock

    public final void setNotifyLock(Object l)

    This method is used internally by the addAnimationAndBlock method of AnimationManager and shouldn't be used outside of that.

    ###### Parameters

    - `l`: the lock object

  - ### setOnCompletion

    public final void setOnCompletion(Runnable r)

    This method is used internally by the addAnimation method of AnimationManager and shouldn't be used outside of that.

    ###### Parameters

    - `r`: the callback