如何在SparkAR中向对象添加旋转?

时间:2019-06-06 18:49:09

标签: javascript facebook augmented-reality spark-ar-studio

如何在代码中向SparkAR中的对象添加无限旋转?

我尝试了类似的方法,但是它不起作用:

while(true)
{
myObject.transform.X  += 30; 
}

1 个答案:

答案 0 :(得分:0)

尝试类似的事情:

const Animation = require('Animation');

const timeDriver = Animation.timeDriver({durationMilliseconds: 2000, loopCount: Infinity, mirror: false});

const sampler = Animation.samplers.linear(0, 2 * Math.PI);

yourObject.transform.rotationY = Animation.animate(timeDriver, sampler);

timeDriver.start();