Animate's call property not being "called"

When using rewind and loop properties, call isn't being executed. In my code, this means my Promise not resolving. "shake done" is never reached.

        const shake = async (axis) => {
            return new Promise(resolve => {
                console.log("shake start");
                disp.animate({
                    props: {[axis]: disp[axis] - 8},
                    time: .075,
                    rewind: true,
                    loop: 2,
                    ease: "easeInOut",
                    call: () => {
                        console.log("shake done");
                        resolve();
                    }
                });
            });
        }

There is an error in your code. If you do as follows, you will get what you want.
time: .075,
rewind: true,
loop:true,
loopCount: 3,
ease: "easeInOut",
call: () => {
console.log("shake done");
resolve();
}

1 Like

Yes - loop is only a Boolean. If you use loopCount:2 then it will call. Also, you do not need loop if you have a loopCount. And a reminder that there is a loopCall if you ever need a callback as it is looping. And a rewindCall.

2 Likes

Thank you both!

2 Likes