chenglou / react-tween-state

React animation.
Other
1.74k stars 70 forks source link

Add delay option #4

Closed benoneal closed 10 years ago

benoneal commented 10 years ago

This looks really cool and useful, but would really benefit from a delay option. Currently for us to use it as we intend, we'd have to wrap it in a setTimeout() everywhere.

icodeforlove commented 10 years ago

+1

chenglou commented 10 years ago

@benoneal delay is now added, but a few words on this. I tend toward leveraging language features rather than rolling sugar into a library. But in the case of delay, this was worthwhile because, for a destructive animation, starting the next one with a delay still immediately kills the previous tween. This is different than a setTimeout, which only replaces the tween after the timeout.

I don't think anyone would be bothered by this but if you really want the setTimeout behaviour, use that instead. Of course, for a additive animation, both behave identically.

(Published as v0.0.2).