如何在 Spark AR studio 中使用脚本访问资产(动画序列)

How can I access a assets (animation sequence) using scripting in Spark AR studio

我正在尝试使用 JS 中的脚本更改动画序列的当前帧 我找不到相当于 Scene.root.find.... 的资产... 我正在尝试创建一个 "Which ____ are you?" 并为滚动图像制作代码,但我不知道如何使用脚本访问它?

如果我做对了,这会对你有所帮助。


const Materials = require('Materials');
const mat = Materials.get('matName');
// set your number here, or an animation
mat.diffuse.currentFrame = 1;

2021 年 5 月 8 日更新: 现在你应该使用异步方法:


const M = require("Materials"); 
const D = require("Diagnostics");
(async function () {
    const mat = await M.findFirst("material0");
    const diff = await mat.getDiffuse();
    diff.currentFrame = 1;
})();