Lottie-web: Event 'complete' and 'onComplete' not firing

Created on 8 Jun 2017  路  1Comment  路  Source: airbnb/lottie-web

I have an animation setup

var animation = bodymovin.loadAnimation({
    container: document.getElementById('network-build-vid'), // the dom element
    renderer: 'svg',
    loop: false,
    autoplay: false,
    path:"_json/data.json" // the animation data
});

I start the animation inside of another function:

function test(){
     animation.play();
}

I can't seem to get the event 'complete' or 'onComplete' to fire when the 1 second animation is done. I do get feedback from 'DOMLoaded' so I know I've set it up correctly.

animation.addEventListener('complete', test2);
animation.addEventListener('DOMLoaded', test3);

function test2(){
    console.log("say hi");
}

Most helpful comment

It fired. I should have checked my test AE animation; the entirety of the comp was rendered instead of the 1 second of animation that was created.

I found this out by using currentFrame and totalFrame to see the animation was 'still playing'.
``javascript console.log(animation.currentRawFrame); console.log(animation.totalFrames);

>All comments

It fired. I should have checked my test AE animation; the entirety of the comp was rendered instead of the 1 second of animation that was created.

I found this out by using currentFrame and totalFrame to see the animation was 'still playing'.
``javascript console.log(animation.currentRawFrame); console.log(animation.totalFrames);

Was this page helpful?
0 / 5 - 0 ratings

Related issues

phantomboogie picture phantomboogie  路  4Comments

cpdt picture cpdt  路  4Comments

joelponce picture joelponce  路  4Comments

ritsraghani picture ritsraghani  路  3Comments

DannyK123456 picture DannyK123456  路  3Comments