【问题标题】:Loop Rive animation in ReactReact 中的 Loop Rive 动画
【发布时间】:2022-08-03 01:27:16
【问题描述】:

我制作了一个动画,它由一个小屋和几朵漂浮在天空中的云组成。我想循环整个动画,但找不到正确的方法来实现它。这是我目前的做法。

const { rive, RiveComponent } = useRive({
     src: Cabin,
     autoplay: true,
     onStop: () => {
        if (window.location.href === \"http://localhost:8000/profile\") { 
        // check the url to prevent error when switching pages, which also makes the animation stop
            rive.play()
        }
     }
})

它现在有效,但我仍然想知道是否有更清洁的方法来循环动画。

    标签: reactjs animation frontend rive


    【解决方案1】:

    您可能能够在设计时解决这个问题,而不是在代码中。 https://help.rive.app/editor/animate-mode/timeline#animation-type

    也许您可以尝试在这里使用循环选项!

    【讨论】:

      猜你喜欢
      • 2021-02-26
      • 1970-01-01
      • 2021-07-15
      • 1970-01-01
      • 2021-11-11
      • 2021-03-17
      • 2022-06-11
      • 2021-08-02
      • 2022-01-07
      相关资源
      最近更新 更多