1. Domino UI
  2. Animations
Top Basic Docs

Animations

Animates components and elements.

This class is used to animate an HTMLElement and provide a set of method to configure the animation and register callbacks like, onBeforeStart and onComplete

Example:

 

  Animation.create(htmlElement)
           .duration(1000)
           .transition(Transition.BOUNCE)
           .animate();

 

See also :

Examples

Animations A set of a predefined animations with handlers and callbacks.

API Docs: Animation

Constructors

public void Animation(Element element)
Creates a new Animation instance for the provided element.

element

an Element to be animated

public void Animation(HTMLElement element, int duration, int delay, boolean infinite)
Creates a new Animation instance for the provided element and specify the duration, delay and the if it will be an infinite animation or not.

element

an Element to be animated

duration

int duration of animation in milliseconds

delay

int delay in millisecond before the animation starts

infinite

boolean repeat this animation infinitely or until stop is called

Static methods

public static Animation create(Element element)
Factory method to create an animation for an Element

element

an Element to be animated



Returns:

an Animation instance

public static Animation create(IsElement<?> element)
static factory method to create an animation for an IsElement this method will create an animation for the HTMLElement wrapped in the IsElement

element

an IsElement to be animated



Returns:

an Animation instance

Public methods

public Animation duration(int duration)
sets the duration for this animation

duration

int duration in milliseconds



Returns:

same instance

public Animation delay(int delay)
Sets the time the animation should wait before actually animate the element after animate is called

delay

in delay in milliseconds



Returns:

same instance

public Animation infinite()
Sets the animation as infinite so once the animation starts it will repeat infinitely or until stop is called

Returns:

same instance

public boolean isInfinite()
Checks whether the animation is set to repeat infinitely.

Returns:

true if the animation repeats infinitely, false otherwise

public Animation setInfinite(boolean infinite)
Sets whether the animation should repeat infinitely or not.

infinite

boolean value indicating if the animation should repeat infinitely. Pass true to make the animation repeat indefinitely, or false to disable infinite repetition.



Returns:

the current instance of the Animation class for method chaining.

public Animation transition(Transition transition)
Sets the transition type for this animation.

transition

a Transition value



Returns:

same instance

public Animation repeat(double repeatCount)
Sets the animation to repeat for a specific number of times or until stop is called.

repeatCount

double, The number of times the animation to be repeated, Example 2.5 repeats the animation 2 times and a half



Returns:

same instance

public Animation callback(CompleteCallback callback)
Register a callback be executed when the animation is completed

callback

a CompleteCallback to be executed



Returns:

same instance

public Animation beforeStart(StartHandler startHandler)
Register a callback be executed before the animation starts

startHandler

StartHandler to be executed



Returns:

same instance

public Animation animate()
Starts animating the element, if there is a delay the animation will start after the delay

Returns:

same instance

public void stop()
stops the animation and calls the CompleteCallback if registered.
public void stop(boolean silent)
Stops the animation and calls the registered CompleteCallback only if silent is set to false.

silent

boolean, true to ignore the callback when animation completed, false to execute the callback.

We are a group of passionate people who love what we do

Donate & Support Us