Я пытаюсь анимировать SVG с помощью этого кода:
//create animated path component
const AnimatedPath = Animated.createAnimatedComponent(Path);
P1 = new Animated.ValueXY({x: 0, y: 1});
P2 = new Animated.ValueXY({x: 1, y: 1});
P3 = new Animated.ValueXY({x: 2, y: 1});
path = `M ${this.P1._value} ${this.P1._value} S ${this.P2.x._value} ${this.P2.y._value} ${this.P3.x._value} ${this.P3.y._value}`;
Animated.timing(this.P1, {
toValue: {x: 3, y: 3},
duration: 300,
useNativeDriver: 'true',
}).start();
<Svg height="50%" width="50%" viewBox="0 0 4 4 " fill="blue">
{/* <Path /> */}
{console.log('this.P1.x: ', this.P1.x)}
<AnimatedPath
d={this.path}
// d="M 0 1 S 1 1 2 1"
fill="none"
stroke="red"
/>
</Svg>
но он не работает. Есть ли способ сделать его анимацией?
также должны ли мы использовать react-native-reanimated2?