Lottie-web: on complete fade out animation

Created on 3 Jul 2019  路  1Comment  路  Source: airbnb/lottie-web

I have an animation and on complete fuction, I want to fade it out or scale it out.
What is the best way to do it? I have seen some suggestions with barba.js, is that my only option?
*I will fade in as well before I anim.play

    var params = {
        container: document.getElementById('lottie'),
        renderer: 'svg',
        loop: false,
        autoplay: false,
        animationData: animationData
    };

    var anim;
    anim = lottie.loadAnimation(params);
     anim.addEventListener('DOMLoaded',function() {
            anim.play();
    });

    anim.addEventListener('complete',function() {
            // fade out code...
                    setTimeout(function(){
            anim.destroy();
        }, 2000);
    });

>All comments

if you are using fading animations you can add / remove a class to your container element and animate it via css changing the opacity value and setting the transition property to something like:
transition: opacity 500ms ease-out

Was this page helpful?
0 / 5 - 0 ratings

Related issues

leantide picture leantide  路  3Comments

cpdt picture cpdt  路  4Comments

ritsraghani picture ritsraghani  路  3Comments

phileastv picture phileastv  路  3Comments

hardy613 picture hardy613  路  4Comments