0
0
React Nativemobile~10 mins

Spring and decay animations in React Native - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to import the spring animation function from React Native Reanimated.

React Native
import { [1] } from 'react-native-reanimated';
Drag options to blanks, or click blank then click option'
Adecay
Bspring
Ctiming
DfadeIn
Attempts:
3 left
💡 Hint
Common Mistakes
Choosing 'decay' which is for decay animations, not spring.
Choosing 'timing' which is for timing animations.
2fill in blank
medium

Complete the code to start a spring animation on the shared value 'progress'.

React Native
progress.value = [1]({ toValue: 1 });
Drag options to blanks, or click blank then click option'
AwithDelay
Btiming
Cdecay
Dspring
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'decay' which causes a decay animation instead.
Using 'timing' which is a different animation type.
3fill in blank
hard

Fix the error in the decay animation code by completing the missing function call.

React Native
progress.value = [1]({ velocity: 1000 });
Drag options to blanks, or click blank then click option'
Adecay
BwithTiming
Cspring
Dtiming
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'spring' which requires a toValue instead of velocity.
Using 'timing' which is for timed animations.
4fill in blank
hard

Fill both blanks to create a spring animation with a custom damping and stiffness.

React Native
progress.value = spring({ toValue: 1, damping: [1], stiffness: [2] });
Drag options to blanks, or click blank then click option'
A15
B100
C50
D200
Attempts:
3 left
💡 Hint
Common Mistakes
Swapping damping and stiffness values.
Using very high damping causing no bounce.
5fill in blank
hard

Fill all three blanks to create a decay animation with a velocity, clamp the value between 0 and 100.

React Native
progress.value = decay({ velocity: [1], clamp: [[2], [3]] });
Drag options to blanks, or click blank then click option'
A500
B0
C100
D1000
Attempts:
3 left
💡 Hint
Common Mistakes
Using velocity too low causing slow animation.
Swapping clamp min and max values.