I'm attempting to fade an element away from the screen with the following code:
comp.addStyleName("fade-out");
.fade-out {
@include valo-animate-out-fade(2500ms, 1000ms);
}
However, once the animation finishes, the element reverts back to its original state on the screen. Is there a way to receive a callback when the animation completes so I can remove it? Alternatively, is it possible to achieve this using pure SCSS?
I've noticed that once the animation runs once, it cannot be repeated by removing and adding back the style. Is this the expected behavior?
EDIT: The issue of not being able to rerun the animation was due to removing and adding styles in quick succession within a listener. This goes unnoticed by the client, preventing the animation from occurring. Resolved this by separating the removal and application of styles through server pushing.
EDIT 2: To remove the element after the animation, I managed to achieve it by initiating a thread, pausing for the duration of the animation, and then performing the removal. While effective, it does seem like a clunky solution. Are there any better alternatives?