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

feat: instant-set for zero duration #4766

Merged
merged 1 commit into from
May 3, 2020
Merged

Conversation

tivac
Copy link
Contributor

@tivac tivac commented May 3, 2020

Fixes #4399

This is something I recently needed again, I wanted to immediately set the store to a new value from the authoritative source and then start a tween based on the given rate of change of the value towards the min/max (depending on direction of change). I was getting weird numbers using the { duration : 1 } hack until I made the tweened .set() call live in a rAF which just seemed silly.

Now, if you call .set(<value>, { duration : 0 }) it'll just set immediately and as a bonus do way less work! Added a test that fails w/o this PR (though it fails due to node not having requestAnimationFrame, not due to the value not setting instantly).

Before submitting the PR, please make sure you do the following

  • It's really useful if your PR relates to an outstanding issue, so please reference it in your PR, or create an explanatory one for discussion. In many cases features are absent for a reason.
  • This message body should clearly illustrate what problems it solves. If there are related issues, remember to reference them.
  • Ideally, include a test that fails without this PR but passes with it. PRs will only be merged once they pass CI. (Remember to npm run lint!)

Tests

  • Run the tests tests with npm test or yarn test)

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

Successfully merging this pull request may close these issues.

Immediate tweened store value update with { duration: 0 } option
2 participants