I have a hypothesis that the only time the spring should automatically start is if toValue changes. If the spring is already animating when the config is updated, it will continue to animate with new parameters. If it is already at rest when a setting or an initial value is changed, the spring should probably stay put.
I think if we do this, we should write a test for it.
It seems like if we set fromValue or initialVelocity in updateConfig without restarting the spring, some weird things would happen because we're changing x0 and v0.
Hmm, maybe I should try this and graph the values so I can visualize what happens.
Ahh - right. You need to reset the time for the simulation to continue with those values.
We could either break out the spring reset logic, or only call start if either toValue is set or initialVelocity/fromValue is set and _currentAnimationStep is set.
Do you agree that setting values other than toValue shouldn't automatically start the simulation?
Since calling _reset resets currentTime to 0.0, it's unclear to me exactly what change this diff makes in practical terms. It seems like calling _reset is basically just like calling start, except without queuing the rAF.
If the point is to just not start the animation when it isn't already running if the values change -- it seems like we should:
To be explicit, the new behavior will allow an animating spring that has it's config changed to behave correctly, and a spring that is at rest needs to be explicitly started again with .start().