How to use WithSpring on useSharedValue({ x: 0, y: 0}) #2861
-
I have a useSharedValue with an object like this: const offset = useSharedValue({ x: 1, y: 1 }) To manipulate the values of the keys I've tried something like this: offset.value = {
x: withSpring(0, {
stiffness: 60,
overshootClamping: true,
}),
y: withSpring(0, {
stiffness: 60,
overshootClamping: true,
})
} But it gives an error. Is there another approach that can be used? |
Beta Was this translation helpful? Give feedback.
Answered by
JasonCareter
Jan 25, 2022
Replies: 1 comment 2 replies
-
why don't you separete the offset with offsetx = useSharedValue(1); offsety = useSharedValue(1); |
Beta Was this translation helpful? Give feedback.
2 replies
Answer selected by
vbylen
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
why don't you separete the offset with offsetx = useSharedValue(1); offsety = useSharedValue(1);
Object Shared Value is mainly used for recording some animation state .