chenglou / react-motion

A spring that solves your animation problems.
MIT License
21.68k stars 1.15k forks source link

on first call initate the prevTime with currenttime #571

Open bbosiljcic opened 4 years ago

bbosiljcic commented 4 years ago

The time returned by performance-now, which was used in componentDidMount and componentWillReceiveProps lifecycle functions to reset the animation, can be greater than the timestamp of requestAnimationFrame (raf) callback. Thus we got negative values for timeDelta. By initializing and resetting prevTime with null instead and setting it to to the timestamp of the first requestAnimationFrame callback, we can prevent negative values.

fixes #453