public class Animation extends Object
HTMLElement
This class is used to animate an HTMLElement and provide a set of method to configure the animation, also provide some method to add some callback during different animation phases
For example:
Animation.create(htmlElement)
.duration(1000)
.transition(Transition.BOUNCE)
.animate();
| Modifier and Type | Class and Description |
|---|---|
static interface |
Animation.CompleteCallback
An implementation of this interface will provide some logic to be executed right after the
animation is completed
|
static interface |
Animation.StartHandler
An implementation of this interface will provide some logic to be executed right before the
animation starts
|
| Constructor and Description |
|---|
Animation(elemental2.dom.HTMLElement element) |
Animation(elemental2.dom.HTMLElement element,
int duration,
int delay,
boolean infinite) |
| Modifier and Type | Method and Description |
|---|---|
Animation |
animate()
starts animating the element, if there is a delay the animation will start after the delay
|
Animation |
beforeStart(Animation.StartHandler startHandler)
sets some logic to be executed before the animation starts
|
Animation |
callback(Animation.CompleteCallback callback)
sets some logic to be executed when the animation is completed
|
static Animation |
create(elemental2.dom.HTMLElement element)
static factory method to create an animation for an
HTMLElement |
static Animation |
create(org.jboss.elemento.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 |
Animation |
delay(int delay)
sets the time the animation should wait before actually animate the element after
animate() is called |
Animation |
duration(int duration)
sets the duration for this animation
|
Animation |
infinite()
sets the animation as infinite so once the animation starts it will repeat infinitely or until
stop() is called |
Animation |
repeat(double repeatCount)
sets the animation to repeat for a specific number of times or until
stop()
is called. |
void |
stop()
stops the animation and calls the
Animation.CompleteCallback if it is set. |
Animation |
transition(Transition transition)
sets the transition type for this animation.
|
public Animation(elemental2.dom.HTMLElement element)
element - an HTMLElement to be animatedpublic Animation(elemental2.dom.HTMLElement element,
int duration,
int delay,
boolean infinite)
element - an HTMLElement to be animatedduration - int duration of animation in millisecondsdelay - int delay in millisecond before the animation startsinfinite - boolean repeat this animation infinitely or until stop() is
calledpublic static Animation create(elemental2.dom.HTMLElement element)
HTMLElementelement - an HTMLElement to be animatedAnimation instancepublic static Animation create(org.jboss.elemento.IsElement<?> element)
IsElement this method will create
an animation for the HTMLElement wrapped in the IsElementelement - an IsElement to be animatedAnimation instancepublic Animation duration(int duration)
duration - int duration in millisecondspublic Animation delay(int delay)
animate() is calleddelay - in delay in millisecondspublic Animation infinite()
stop() is calledpublic Animation transition(Transition transition)
transition - a Transition valuepublic Animation repeat(double repeatCount)
stop()
is called.repeatCount - double the number of times the animation to be repeated e.g
2.5repeats the animation 2 times and a half
public Animation callback(Animation.CompleteCallback callback)
callback - a Animation.CompleteCallback to be executedpublic Animation beforeStart(Animation.StartHandler startHandler)
startHandler - Animation.StartHandler to be executedpublic Animation animate()
public void stop()
Animation.CompleteCallback if it is set.Copyright © 2019–2022 Dominokit. All rights reserved.