Is there a way to programatically define and start a css animation? I'd like to animate a div from one absolute position to another. Something like:
FlowPanel fp = new FlowPanel();
fp.getElement().getStyle().setPosition(Position.ABSOLUTE);
fp.getElement().getStyle().setLeft(50, Style.Unit.PX);
fp.getElement().getStyle().setTop(50, Style.Unit.PX);
...
// something like:
fp.setAnimation("top: 300px");
I saw that we could define a css animation in our css file, and changing the name of the div's style will trigger the animation. But I don't know if we can programatically modify an animation defined in css. For example:
// css file
.testAnimation {
top: 500px;
transition-property: top;
transition-duration: 1s;
}
...
// But we can't modify the "top" attribute here depending on runtime needs?:
fp.setStyleName("testAnimation"); // I may want "top" to be some other value here.
Thanks