How do I update a "to" property config between steps? #1827
Unanswered
varunarora
asked this question in
Support
Replies: 2 comments 3 replies
-
In your case I would just simply use the imperative API. This way you can pass an individual config for each animation / spring. |
Beta Was this translation helpful? Give feedback.
3 replies
-
I faced the same problem, and couldn't find any example anywhere, but this seems to work: // "@react-spring/web": "^9.7.4",
const springRef = useSpringRef()
const spring = useSpring({
ref: springRef,
from: {transform: 'scale(1)'},
})
const onClickElem = () => {
springRef.start({
to: [
{
transform: 'scale(0.6)',
config: {duration: 1000}, // You can just pass config inside the step object!
},
{
transform: 'scale(1)',
config: {duration: 5000},
},
],
})
} |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi!
I am doing a multi-step animation on the same component.
However, after the first step ends, I wish to change the animation config on the component (e.g. duration) on the component. For example, the first step should take 1 second, and the second should take 5 seconds.
Even though this seems like a very simple use case, I have read and re-read and re-read the docs, and can't find a way to do this. I feel
useChain
oruseTransition
is not correct for this, since all the springs and steps for a simple component are declared together. Either way, I feel really lost.Could you kindly point me in the right direction?
Beta Was this translation helpful? Give feedback.
All reactions