React Native Reanimated 2 动画 SVG 路径的长度

问题描述

我正在尝试在 React Native Reanimated 2 中将 SVG 路径的长度从 0 设置为全长。这是我的示例路径:

const Animatedpath = Animated.createAnimatedComponent(Path);

const animatedProps = useAnimatedProps(() => {
  const path =
    `M${width * 0.182} ${height * 0.59} ` +
    `L${width * 0.443} ${height * 0.59} ` +
    `L${width * 0.443} ${height * 0.39} `;
  return {
    d: path,};
});

return (
  <Svg height="100%" width="100%">
    <Animatedpath animatedProps={animatedProps} fill="none" stroke="red" strokeWidth="5" />
  </Svg>
);

我尝试在路径的宽度上添加一些插值,但没有成功。我还尝试查看 Redash 的 interpolatePath() 实现,但它似乎采用两条路径作为输出范围。还有什么我应该看的吗?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)