A. The value will increase quickly then slow down gradually
B. The value will jump instantly to 3 and stop
C. The value will decrease to zero immediately
D. The animation will loop forever without stopping
Solution
Step 1: Understand decay animation behavior
Decay animation starts with a velocity and slows down gradually due to deceleration.
Step 2: Analyze given parameters
Velocity 3 means value increases fast initially, deceleration 0.997 slows it down over time.
Final Answer:
The value will increase quickly then slow down gradually -> Option A
Quick Check:
Decay animation = fast start + slow stop [OK]
Hint: Decay = fast start, then slow down [OK]
Common Mistakes:
Thinking decay jumps instantly to velocity
Assuming decay decreases value immediately
Believing decay loops infinitely
4. Identify the error in this spring animation code:
const anim = new Animated.Value(0);
Animated.spring(anim, {toValue: 1, velocity: 5}).run();
medium
A. Missing toValue property in spring config
B. Using .run() instead of .start() to begin animation
C. Velocity is not a valid spring config property
D. Animated.Value should be initialized with 1
Solution
Step 1: Check method to start animation
Animated animations use .start() to begin, not .run().
Step 2: Verify spring config properties
toValue and velocity are valid properties; initial value 0 is fine.
Final Answer:
Using .run() instead of .start() to begin animation -> Option B
Quick Check:
Use .start() to run animations [OK]
Hint: Animations start with .start(), not .run() [OK]
Common Mistakes:
Using .run() instead of .start()
Removing toValue from config
Initializing Animated.Value incorrectly
5. You want to create a button that moves right with a spring animation and then slows to stop with a decay animation when released. Which sequence of code correctly achieves this behavior?
hard
A. Animated.spring(anim, {toValue: 100, velocity: 2}).start()
B. Animated.decay(anim, {velocity: 2}).start(() => Animated.spring(anim, {toValue: 100}).start())
C. Animated.spring(anim, {toValue: 100}).start(() => Animated.decay(anim, {velocity: 2}).start())
D. Animated.timing(anim, {toValue: 100, duration: 500}).start(() => Animated.decay(anim, {velocity: 2}).start())
Solution
Step 1: Understand desired animation sequence
First move right with spring (bouncy), then slow down with decay on release.
Step 2: Analyze options for correct order and methods
Animated.spring(anim, {toValue: 100}).start(() => Animated.decay(anim, {velocity: 2}).start()) runs spring first, then decay in callback, matching desired sequence.
Step 3: Check other options
Animated.spring(anim, {toValue: 100, velocity: 2}).start() performs only spring without decay. Animated.decay(anim, {velocity: 2}).start(() => Animated.spring(anim, {toValue: 100}).start()) (Animated.decay(anim, {velocity: 2}).start(() => Animated.spring(anim, {toValue: 100}).start())) reverses order. Animated.timing(anim, {toValue: 100, duration: 500}).start(() => Animated.decay(anim, {velocity: 2}).start()) uses timing instead of spring.
Final Answer:
Animated.spring(anim, {toValue: 100}).start(() => Animated.decay(anim, {velocity: 2}).start()) -> Option C
Quick Check:
Spring then decay = move then slow [OK]
Hint: Run spring first, then decay in callback [OK]
Common Mistakes:
Running decay before spring
Performing only spring without decay
Using timing instead of spring for bounce
Recommended
Ready to prove it?
Pass the test and this pattern moves unknownstrongwhile earning +1 Grip toward your certificate.