• Resolved benjaminwhite

    (@benjaminwhite)


    Can you add a way to start a function on completion of the bodymovin animation? I’m using ScrollMagic with Bodymovin and it would be great to have them work together.
    Maybe this would work?

    var anim;
    var animData = {
    container: document.getElementById(‘bodymovin’),
    renderer: ‘svg’,
    loop: false,
    autoplay: true,
    rendererSettings: {
    progressiveLoad:false
    },
    path: ‘thelogo.json’
    };
    anim = bodymovin.loadAnimation(animData);

    anim.addEventListener(‘complete’,doalert);

    function doalert() {
    console.log(‘test completed’);
    }

Viewing 1 replies (of 1 total)
  • Plugin Author iodsgn

    (@develoved)

    There is a js Array that holds the animations data and instances.
    So to access for example the first animation’s instance and add the event listener you would do this:

    wpbodymovin.animations[0].instance.addEventListener('complete',doalert);
    
    function doalert() {
       console.log('test completed');
    }
Viewing 1 replies (of 1 total)

The topic ‘Start Function on Completion – Feature Request’ is closed to new replies.