juliangarnier / anime

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

Add an initialDelay/beginDelay property parameter #745

Open bobdimin opened 3 years ago

bobdimin commented 3 years ago

It would be nice to have an initialDelay (or beginDelay) property parameter in addition to the already available delay and endDelay parameters.

The reason for this would be to allow the delay to only happen when the animation first begins but not for every loop/iteration when setting loop to true.

I know you can wrap the animation in a setTimeout to solve for this, but when doing that, the timeout will not be canceled/cleared when using anime.remove(). Also, when wanting to stagger just the start of a looping animation on a collection of targets it gets pretty messy, when there is already such a clean way of using anime.stagger() on the existing delay parameter.

spacecodeur commented 2 years ago

currently, the 'setTImeout' is the least worst way ?

juliangarnier commented 2 years ago

Currently yes. I'm working on this for V4, it's probably going to be beginDelay or startDelay. Will share something soon!