juliangarnier / anime

JavaScript animation engine
https://animejs.com
MIT License
49.65k stars 3.66k forks source link

** Feature Request ** Is there a way to add "markers" to animations? #523

Open zzseba78 opened 5 years ago

zzseba78 commented 5 years ago

Is your feature request related to a problem? Please describe. In a timeline, sometines we want to start two animations at the same time, we can achieve this with offset, relative to last animation or whole timeline. So, for example to start two distinct animations at the same time in a timeline we have to calculate the total animation time ( duration, delay ) of the previous animation. An offset can be relative to the last animation or absolute to the whole timeline.

Describe the solution you'd like It would be great if we can create "labels" to animations, so we can start the animation at the exact time we want, targeting the labels defined in the whole timeline ( like GSAP does for example ). I think this would be awesome for sequencing job.

Maybe this is already possible, or there is another simple way to do it ( callbacks functions? )

Thanks. Amazing library! Love it.

ghost commented 5 years ago

Bump ^

This is one big feature holding me back from switching to Anime. Labels are so useful in GSAP!

metadiv commented 2 years ago

Bump^

I agree. In most cases a time offset is fine, but I've had a couple of occasions where I've tried to sync two staggered animations together and had to manually calculate all the durations and stagger delays to work out the -= offset for the 2nd part. A label would have made that so much easier, plus if the number of items in the staggers changed I wouldn't have to recalculate everything again.