I use GSAP (Timeline) to show and hide an overlay. The overlay can be opened and closed without any problems. But when I want to open it again, it does not work.
function animate_media(overlay, reversed) {
var media_tl = gsap.timeline({repeat: 0, paused: true});
media_tl.from(overlay, {duration: 0.5, y: 30, autoAlpha: 0});
if(reversed) {
media_tl.reverse(0);
} else {
media_tl.play();
}
}
I pass the element and a boolean value to the function (depending on whether the overlay should open or close).
I noticed that the overlay keeps the following inline code after closing: opacity: 0; visibility: hidden; transform: translate(0px, 30px);
Is there a possibility to show the overlay again after closing, i.e. to play the animation again?