Community Tip - Want the oppurtunity to discuss enhancements to PTC products? Join a working group! X
I have created 3 animations in 3 different figures in Creo which is not working in Hololense. I have used below java script to call the animation.
// $scope, $element, $attrs, $injector, $sce, $timeout, $http, $ionicPopup, and $ionicPopover services are available
$scope.setWidgetProp('model-1', 'currentStep', 'stepnr');
$scope.playStep = function (stepnr) {
switch (stepnr) {
case 1:
{
$scope.view.wdg['3DImage-1'].visible=false;
$scope.view.wdg['3DImage-2'].visible=true;
$scope.view.wdg['3DImage-3'].visible=true;
}
break;
case 2:
{
$scope.view.wdg['3DImage-1'].visible=false;
$scope.view.wdg['3DImage-2'].visible=false;
$scope.view.wdg['3DImage-3'].visible=false;
$scope.view.wdg['3DImage-4'].visible=true;
$scope.view.wdg['3DImage-5'].visible=false;
}
break;
case 3:
{
$scope.view.wdg['3DImage-1'].visible=false;
$scope.view.wdg['3DImage-2'].visible=false;
$scope.view.wdg['3DImage-3'].visible=false;
$scope.view.wdg['3DImage-4'].visible=false;
$scope.view.wdg['3DImage-6'].visible=true;
}
}
$scope.$applyAsync(() => {
$scope.setWidgetProp('model-1', 'currentStep', stepnr); });
$timeout(function () {
angular.element(document.getElementById('model-1')).scope().play();
}, 500);
}
$scope.hide = function(){
$scope.view.wdg['3DImage-4']['visible'] = false;
$scope.view.wdg['3DImage-2']['visible'] = true;
$scope.view.wdg['3DImage-3']['visible'] = true;
$scope.view.wdg['3DImage-6']['visible'] = false;
}
Each image i have placed "click Js" is below,
Image-1 - "playStep(1);"
Image-2- "playStep(2); "
Image-3- "playStep(3);"
Kindly help me to play an animation in Hololense
possibly you can try :
$scope.setWidgetProp('model-1', 'currentStep', stepnr)
$scope.$applyAsync()
let timeoutValue=300 // if required increase the timeout delay
//when model more complex to 600 - 1000 milliseconds
$timeout( ()=>{twx.app.fn.triggerWidgetService("model-1", "play");}, 500);
so looking on your code it should work but possibly you need more delay and async call after changes if you want to access these changes