()
| 18 | }, |
| 19 | }); |
| 20 | export default function ProgressIndicator() { |
| 21 | const init = Array(total) |
| 22 | .fill(1) |
| 23 | .map((x) => ({ r: new Animated.Value(1), a: new Animated.Value(1) })); |
| 24 | const [anim, setAnim] = useState(init); |
| 25 | |
| 26 | useEffect(() => { |
| 27 | console.log("update"); |
| 28 | const c = anim.map((v, i: number) => { |
| 29 | const t = 400 + Math.random() * 300; |
| 30 | const seq = Animated.parallel([ |
| 31 | Animated.sequence([ |
| 32 | Animated.timing(anim[i].r, { toValue: 3, duration: t - 50 }), |
| 33 | Animated.timing(anim[i].r, { toValue: 1, duration: t }), |
| 34 | ]), |
| 35 | Animated.sequence([ |
| 36 | Animated.timing(anim[i].a, { toValue: 0.1, duration: t - 50 }), |
| 37 | Animated.timing(anim[i].a, { toValue: 1, duration: t }), |
| 38 | ]), |
| 39 | ]); |
| 40 | return Animated.loop(seq); |
| 41 | }); |
| 42 | // console.log(c) |
| 43 | Animated.parallel(c).start(); |
| 44 | }, []); |
| 45 | |
| 46 | let circles = []; |
| 47 | const margin = 100 / (numX); |
| 48 | for (let x = 0; x < numX; x++) { |
| 49 | for (let y = 0; y < numY; y++) { |
| 50 | const i = y * numX + x; |
| 51 | circles.push({ |
| 52 | x: (x + 0.5) * margin, |
| 53 | y: (y) * margin, |
| 54 | r: anim[i].r, |
| 55 | a: anim[i].a, |
| 56 | }); |
| 57 | } |
| 58 | } |
| 59 | |
| 60 | return ( |
| 61 | <View style={styles.container}> |
| 62 | <Svg height="100%" width="100%" viewBox="0 0 100 100"> |
| 63 | {circles.map((c) => ( |
| 64 | <AnimatedCircle |
| 65 | key={c.y * numX + c.x} |
| 66 | cx={c.x} |
| 67 | cy={c.y} |
| 68 | r={c.r} |
| 69 | fill="white" |
| 70 | opacity={c.a} |
| 71 | /> |
| 72 | ))} |
| 73 | </Svg> |
| 74 | </View> |
| 75 | ); |
| 76 | } |
nothing calls this directly
no outgoing calls
no test coverage detected