Rive 动画网站无法在 iPhone 上运行

问题描述 投票:0回答:1

我确信我错过了一些简单的东西......我遵循了这个:https://help.rive.app/runtimes/overview/web-js 它工作得很好,直到我将 src 从 ("src: "https://cdn.rive.app/animations/vehicles.riv",") 更改为我们的服务器 (src: "https://outofourmindsstudios.com/2024/车辆.riv",)。然后它就在 iPhone 上崩溃了。我缺少什么?我仍然在 Chrome 中工作。

`<!DOCTYPE html>
<html>
  <head>
    <title>Rive Hello World</title>
  </head>
  
  
  <body>
    <canvas id="canvas" width="500" height="500"></canvas>
    <script src="https://unpkg.com/@rive-app/[email protected]"></script>
    <script src="https://unpkg.com/rive-js"></script>
   


    <script>
      const r = new rive.Rive({
        src: "https://outofourmindsstudios.com/2024/vehicles.riv",
        canvas: document.getElementById("canvas"),
        autoplay: true,
        stateMachines: "bumpy",
        onLoad: () => {
          r.resizeDrawingSurfaceToCanvas();
        },
      });
    </script>

  </body>
</html>`
javascript ios animation rive
1个回答
0
投票

iPhone 会仔细执行 CORS 安全性。如果您的服务器未设置为接受来自托管 HTML 文件的源(通常是单独的域)的请求,浏览器将停止动画。

尝试模拟这一点并检查页面以检查控制台是否存在 CORS 问题。大多数时候,即使您直接应用 API 调用,也会发生这种情况。

© www.soinside.com 2019 - 2024. All rights reserved.