The simple animate versions are using a WeakMap to track which elements have been animated in order to call stopAnimation on them. However, using animateCallback the entire tracking and infrastructure process is ignored, thus making canceling/stopping animations on the same element using animate and animateCallback in conjunction unnecessarily hard.
Since you could theoretically do anything inside an animateCallback-callback, I'd recommend passing in extra parameter(s) to said callback that allows you to register/unregister elements to achieve desired effect.
The simple
animate
versions are using aWeakMap
to track which elements have been animated in order to callstopAnimation
on them. However, usinganimateCallback
the entire tracking and infrastructure process is ignored, thus making canceling/stopping animations on the same element usinganimate
andanimateCallback
in conjunction unnecessarily hard.Since you could theoretically do anything inside an
animateCallback
-callback, I'd recommend passing in extra parameter(s) to said callback that allows you to register/unregister elements to achieve desired effect.