Complete the code to create a new animated value starting at 0.
const opacity = new Animated.Value([1]);The Animated.Value constructor needs a starting numeric value. Here, 0 means fully transparent.
Complete the code to start a timing animation that changes opacity to 1 over 500ms.
Animated.timing(opacity, { toValue: [1], duration: 500, useNativeDriver: true }).start();toValue should be 1 to animate opacity from 0 to fully visible.
Fix the error in the code to animate the scale of a view from 1 to 2.
const scale = new Animated.Value(1); Animated.timing(scale, { toValue: [1], duration: 300, useNativeDriver: true }).start();
toValue must be a number 2 to scale up the view. A string '2' is invalid.
Fill in the blank to create an animated style that changes opacity and scale.
const animatedStyle = {
opacity: opacity,
transform: [{ scale: [1] }]
};
return <Animated.View style={animatedStyle} />;The transform property expects an object with the scale key set to the animated value.
Fill all three blanks to create a fade-in and scale-up animation using Animated.parallel.
Animated.parallel([
Animated.timing(opacity, { toValue: [1], duration: 400, useNativeDriver: true }),
Animated.timing(scale, { toValue: [2], duration: 400, useNativeDriver: true })
]).start([3]);Opacity animates to 1 (visible), scale animates to 2 (double size), and the callback logs when done.