Repeat current step
Hi everyone,
I would like to replay / repeat the actual step of an animation as long till I klick on the “next step”.
Background: Using the HoloLens the user should see the same step again and again to not miss the information (because he needs to turn around and move in the room to capture/find everything). When he finished the step, he should klick on “next” and the next step will be played and repeated.
I tried to use intervals, but this is not working well because all steps needs to be 4500ms long and Vuforia is having problems with the delay (after a while it plays multiple steps at the same time)
$scope.Repeat = function() {
// Play current step
angular.element(document.getElementById('model-3')).scope().play();
// Rewind current step
$timeout(function(){ angular.element(document.getElementById('model-3')).scope().rewind(); }, 4000);
// And start again after 4500ms, 10 times
$scope.intervalPromise = $interval($scope.Repeat, 4500, 10);
}
$scope.Next = function() {
// cancel the Interval from above
$interval.cancel($scope.Repeat);
// Wait a bit (500ms) and stop current step (in case something is still playing)
$timeout(function(){ angular.element(document.getElementById('model-3')).scope().Stop(); }, 500);
$timeout(function(){ angular.element(document.getElementById('model-3')).scope().Repeat(); }, 700);
}

