-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathApp.js
More file actions
73 lines (69 loc) · 1.38 KB
/
App.js
File metadata and controls
73 lines (69 loc) · 1.38 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
import React, { useEffect } from "react";
import { StyleSheet, View } from "react-native";
import Animated, {
useAnimatedStyle,
useSharedValue,
withDelay,
withRepeat,
withTiming,
interpolate,
} from "react-native-reanimated";
const Ring = ({ delay }) => {
const ring = useSharedValue(0);
const ringStyle = useAnimatedStyle(() => {
return {
opacity: 0.8 - ring.value,
transform: [
{
scale: interpolate(ring.value, [0, 1], [0, 4]),
},
],
};
});
useEffect(() => {
ring.value = withDelay(
delay,
withRepeat(
withTiming(1, {
duration: 4000,
}),
-1,
false
)
);
}, []);
return <Animated.View style={[styles.ring, ringStyle]} />;
};
export default function AnimatedRingExample() {
return (
<View
style={{
flex: 1,
alignItems: "center",
justifyContent: "center",
flexDirection: "column",
backgroundColor:"#F7E2E2"
}}
>
<Ring delay={0} />
<Ring delay={1000} />
<Ring delay={2000} />
<Ring delay={3000} />
</View>
);
}
const styles = StyleSheet.create({
box: {
width: 100,
height: 100,
backgroundColor: "#F10086",
},
ring: {
position: "absolute",
width: 80,
height: 80,
borderRadius: 40,
borderColor: "#F10086",
borderWidth: 10,
},
});