0

The following will animate from 1 to 2.

const [props, set] = useSpring(() => ({ value:1 }));
set({value: 2});

However, let's assume Iwant the value to be instantly changed to 3, and then animated to 2, regardless of what it is currently. In other words, I'd like to avoid the smooth interpolation between 1 and 3.

const [props, set] = useSpring(() => ({ value:1 }));
set({value: 3, immediate: true}); //doesn't seem to work.
set({value: 3});

How do I do so?

John Smith
  • 3,863
  • 3
  • 24
  • 42

1 Answers1

0
const [props, set] = useSpring(() => ({ value:1 }));
set({from: {value: 3}, value:2, reset: true});
John Smith
  • 3,863
  • 3
  • 24
  • 42