0

I need to get loop animation progress (and looped) information (if it will be in patch editor, it 's the outputs). But I can't find this information on documentation. How can I get needed information?

1 Answers1

0

For "looped" you can use onAfterIteration event on the TimeDriver: https://sparkar.facebook.com/ar-studio/learn/documentation/reference/classes/animationmodule.timedriver

For progress, unfortunately there isn't a progress available on the TimeDriver, but you can use a multiTrigger event listener on the animation signal. Depending on what exactly you are trying to achieve, there are a few different ways of doing it: https://sparkar.facebook.com/ar-studio/learn/documentation/reference/classes/reactivemodule.scalarsignal

For example:

//setup your animation
const Animation = require('Animation');
let driver = Animation.timeDriver({durationMilliseconds:1000, loopCount:Infinity});
let sampler = Animation.samplers.linear(0,1);
let animation = Animation.animate(driver, sampler);

//add listener for "looped" to the driver
driver.onAfterIteration().subscribe(function(e){
  //do stuff on here...

});

//add listener for progress to the animation signal
//this will trigger when the animation signal goes above .5
animation.multiTrigger(.5).subscribe(function(e){
  //do stuff here...

})
JackKalish
  • 1,555
  • 2
  • 15
  • 24