Becklyn / mojave

A library of commonly used JavaScript tools and helpers by Becklyn
BSD 3-Clause "New" or "Revised" License
5 stars 3 forks source link

Animation: Allow animateCallback to register elements to use with stopAnimation #186

Open keichinger opened 5 years ago

keichinger commented 5 years ago

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.