- 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
i’m still confused how i should implement it by callback hell
An important section from the description is
The
animate()
method returns anAnimation
object. This object has afinished
property, which is aPromise
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.
Michael
Thank you, helpfully.