-
Is it possible to somehow create a custom entering/exiting animation that would modify const AnimatedBlurView = Animated.createAnimatedComponent(BlurView);
const BlurIn = (targetValues: any) => {
"worklet";
const animations = {
animatedProps: {
intensity: withTiming(60, {
duration: 1000,
}),
},
};
const initialValues = {
animatedProps: {
intensity: 0,
},
};
return {
initialValues,
animations,
};
};
...
<AnimatedBlurView
entering={BlurIn}
tint="light"
style={StyleSheet.absoluteFill}
/> |
Beta Was this translation helpful? Give feedback.
Answered by
MatiPl01
Aug 19, 2024
Replies: 1 comment 2 replies
-
Hey! The easiest way to achieve layout animation like behavior is to use const animatedProps = useAnimatedProps(() => ({
intensity: withSequence(
withTiming(0, {duration: 0}),
withTiming(60, {duration: 1000}),
),
}));
...
<AnimatedBlurView
animatedProps={animatedProps}
tint="light"
style={StyleSheet.absoluteFill}
/> |
Beta Was this translation helpful? Give feedback.
2 replies
Answer selected by
vovacodes
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hey!
Unfortunately, layout animations work only with style properties. To animate
animatedProps
when component mounts, you would have to useuseAnimatedProps
.The easiest way to achieve layout animation like behavior is to use
withSequence
withwithTiming(0, {duration: 0})
, which sets the initial value of theintensity
andwithTiming(60, {duration: 1000})
, which animates to the desired value.