I am currently implementing an animation on specific elements that have their opacity set to 0
in the CSS. The animation is triggered onClick, and via keyframes, it transitions the opacity from 0
to 1
, among other things.
However, once the animation completes, the elements revert back to opacity: 0
(across both Firefox and Chrome). I had assumed that animated elements would retain their final state, thus overriding their initial properties. Is my understanding incorrect? If so, what approach can be taken to ensure the element maintains its final appearance?
The code snippet (prefixed versions excluded):
@keyframes bubble {
0% { transform:scale(0.5); opacity:0.0; }
50% { transform:scale(1.2); opacity:0.5; }
100% { transform:scale(1.0); opacity:1.0; }
}