Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Synchronously updating the config could stop the spring #5

Closed
appsforartists opened this issue Sep 12, 2017 · 0 comments
Closed

Synchronously updating the config could stop the spring #5

appsforartists opened this issue Sep 12, 2017 · 0 comments

Comments

@appsforartists
Copy link
Collaborator

In #4, I added a call to this._step() inside updateConfig(). That's needed to ensure that the default values in updateConfig() are current before the spring is reset. However, it's also the only place that _step() gets called synchronously.

This introduces the possibility that changes to the spring config could stop the spring before it even starts. For instance

spring.updateConfig({ toValue: 0 });
spring.start();
spring.updateConfig({ fromValue: 1 });

Previously, the config wasn't evaluated until the next frame, so this would cause a transition from 1 to 0. However, now that it can be evaluated synchronously, when both fromValue and toValue are 0, which would stop the spring before fromValue: 1 is evaluated.

I'm not sure if this is a desirable behavior or not, but since it's a change, I thought I would at least document it. If it causes problems in the future, I'll address it.

One potential solution: add a flag to _evaluateSpring to suppress notifications. When called during updateConfig, notifications would be suppressed, which would prevent onUpdate, onStop, and stop() from being called.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant