0

How can I add endless rotation to the object in SparkAR in code?

I tried something like this, but it doesn't work:

while(true)
{
myObject.transform.X  += 30; 
}
Rumata
  • 1,027
  • 3
  • 16
  • 47

1 Answers1

2

Try something like that:

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();
Artem Kirillov
  • 1,132
  • 10
  • 25