[Request] Be able to set spring config per value
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 29.1k
- Forks
- 1.2k
- PR merge metrics
- No merged PRs in 30d
Description
🚀 Feature Proposal
The idea is to be able to set a spring config per value in a single useSpring.
Motivation + Example
I like to use a single useSpring per component where possible and when doing more complex motion design I need individual values to have their own spring config. This especially becomes important when the spring config is modified depending on the state of the app and user interactions. For example, I may have an opacity value that I want to always transition with a linear duration but an x value that toggles from being stiff to wobbly depending on its direction of motion (open or close).
Currently I have to make two springs to handle this case and then use their apis in sync.
Note: I thought I could use a useSpringRef for a single api to control both springs but I couldn't figure out how to change the config for individual springs this way.
Here is a sandbox: https://codesandbox.io/s/dreamy-turing-3kpom?file=/src/App.js
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the per-value configuration need in the linked CodeSandbox and reading the existing useSpring API behavior. Define how separate opacity and x configurations should work within one spring and verify that one API can control both values with their individual settings.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- react, typescript
- Domain
- frontend
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 28/100