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

Fix: Decay (a.k.a intertia) with immediate #1444

Merged
merged 6 commits into from
Apr 27, 2021
Merged

Fix: Decay (a.k.a intertia) with immediate #1444

merged 6 commits into from
Apr 27, 2021

Conversation

joshuaellis
Copy link
Member

Why

This PR should resolve #1026 & because it's bugging me at the same time it should resolve #1437

What

If an animation has immediate set and that value changes it does not look to "start" the animation at all, it will if you change a value such as decay so the following code would work:

if(down)}{
 api.start({ pos, immediate: true })
}
else {
 api.start({ pos, config: { velocity: 2, decay: true } })
}

but in reality this is cumbersome and the following should work:

api.start({
 pos,
 immediate: down,
 config: { velocity 2, decay: true }
})

Which it now does.

Checklist

  • Documentation updated
  • Demo added
  • Ready to be merged

@codesandbox-ci
Copy link

codesandbox-ci bot commented Apr 22, 2021

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit 082aae4:

Sandbox Source
spring-card Configuration
spring-goo-blobs Configuration
spring-flip-card Configuration
spring-slide Configuration
spring-draggable-list Configuration
spring-cards-stack Configuration
spring-viewpager Configuration
spring-simple-transition Configuration
spring-image-fade Configuration
spring-list-reordering Configuration
react-spring touch scrolling example Issue #1026
Decay - V9.0.1 Jump Issue #1437
Decay - V9.0.1 Jump Issue #1437

@HQ92
Copy link

HQ92 commented Apr 24, 2021

Looking forward to this fix as I think it's the last piece of the puzzle to making natural feeling touch friendly draggable sliders with real physics based animations without any weird jumping! Looking forward to testing it out.

You can see the issue in my draggable slider currently at https://codesandbox.io/s/react-spring-912-inertial-spring-kyq3d?file=/src/index.js, I'm happy to test once it's been pushed.

@joshuaellis joshuaellis changed the base branch from master to beta April 27, 2021 17:30
@joshuaellis joshuaellis merged commit f9372fb into beta Apr 27, 2021
@joshuaellis joshuaellis deleted the fix/inertia branch April 27, 2021 17:33
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.

Decay animation jumps at the last frame Inertia/momentum incorrect behavior, and unexpected value jumping
2 participants