Sequencing animation

  1. First, implement something that works, but has the promise version of the “callback hell” problem we saw in our discussion of using callbacks.

i’m still confused how i should implement it by callback hell

Hi @samuelharold327

An important section from the description is

The animate() method returns an Animation object. This object has a finished property, which is a Promise that is fulfilled when the animation has finished playing. So we can use this promise to know when to start the next animation.

This gives us the core part of all three versions: alice1.animate(aliceTumbling, aliceTiming).finished. Since this returns a promise we can use .then(...) on this line.

For the “Promise Hell” we need to start the second animation inside this then(). Finally, inside this second then() we can then start the third animation.

Does that help? If you need more help, just ask. :slightly_smiling_face:

Michael

2 Likes

Thank you, helpfully.

1 Like