【发布时间】:2020-01-01 20:21:41
【问题描述】:
我正在尝试在我的游戏中的 Phaser 3 中添加 Lottie 动画。
但我无法添加。这里的问题是,我将此动画附加到 HTML DOM 元素,因此动画位于 Phaser 游戏画布上方,由于我无法与我的 Phaser 游戏元素交互。我无法在我的 Phaser 游戏画布中包含 Lottie 动画 JSON 文件。
我也尝试让容器成为画布,但它不起作用。
以下是 HTML5 中使用的 Lottie 动画示例:Lottie animation Demo
这是 Lottie 动画文件的链接: Lottie animation JSON file example
这是我为此使用的代码,
this.animation = bodymovin.loadAnimation({
container: document.getElementById("game"), // Required
path: "assets/json/RainLoop.json", // Required
renderer: "canvas", // Required
loop: true, // Optional
autoplay: true, // Optional
name: "Hello World", // Name for future reference. Optional.
});
我想将这个 Lottie 动画包含在 Phaser 游戏画布中,但它只包含在我的 HTML DOM 元素中。
【问题讨论】:
标签: javascript animation html5-canvas phaser-framework lottie