Answers for "how to play our animation sequence by sequence in vuforia studio using javasript"

0

how to play our animation sequence by sequence in vuforia studio using javasript

$scope.setSequenceList = function(){
  $scope.app.params['sequenceList'] = [
    {
      "display":"Figure 1",
      "value":"app/resources/Uploaded/l-Creo 3D - Figure 1.pvi"
    },
    {
      "display":"Figure 2",
      "value":"app/resources/Uploaded/l-Creo 3D - Figure 2.pvi"
    }
  ]
}
//calling this code after the model Loading is completed
$rootScope.$on('modelLoaded', function() { 
 
$scope.setSequenceList();
// this is 2 ways to do the same  
console.warn($scope.app.params.sequenceList)
console.warn($scope.app.params['sequenceList'])
 
  //start here the new function
$scope.app.playModelStep("Figure 1","model-1",3,true)
  
})

//////////////
//definition of the new function function
$scope.app.playModelStep = function (sequence,modelName,step_number,play) {
//sequnece -sequnece name e.g. TestFigure1 - as shown in UI
//modelName - model name e.g. model-1
//step_number - set this number to current step
//play   true/false execute play for the model
 
$scope.$applyAsync(()=>{$scope.setWidgetProp(modelName, 'sequence',  '');});


  $timeout(function () {
  $scope.$applyAsync(()=>{$scope.setWidgetProp(modelName, 'sequence',  'app/resources/Uploaded/l-Creo 3D - '+sequence +'.pvi');});  
  },50);

  $timeout(function () {
     
  $scope.$applyAsync(()=>{$scope.setWidgetProp(modelName, 'currentStep', parseInt(step_number));});
  
 if(play)   //check if play should be applyed
  
 $timeout(function () {angular.element(document.getElementById(modelName)).scope().play(); }, 100);
                      }, 500);
};
//////////////////////////////////
Posted by: Guest on October-19-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language