Community Tip - You can Bookmark boards, posts or articles that you'd like to access again easily! X
I have 9 buttons to play each animation(i.e step 1 to 9 in sequence) . i dont want the animation to sync out when one touches next button . i dont want that button to operate anything till previous animation is finished. I have gone through the below link
but i need a java script to perform that operation.
are there any ways to do so?
Solved! Go to Solution.
Hi @Nithin,
to be sure that I understand the issue :
1.)you have 9 button for each step in animation/sequence you have one specific button which are implemented as images
2.)when you play an animation it should make all buttons disabled and then when an animation is finished all buttons are available ,right?
If this points are not correct then please, provide more details!, Thansk
I will now try to suggest a solution so far, I understand the issue.
To disable the buttons - you can of course use some techniques as suggested in the post where playing property of a model widget is blinded to a disable property of all 9 buttons.
But this will work only if you have only one model widget and it will not work if you use images as buttons. .But I could suggest also another option. You can use the step events - step started and step completed - example:
//this is variable which track if currently step is played
$scope.ButtonStatus=false
... $scope.$on('stepstarted', function(evt, arg1, arg2, arg3) { $scope.ButtonStatus=true }); ... scope.$on('stepcompleted', function(evt, arg1, arg2, arg3) { $scope.ButtonStatus=false });
this mean we have a variable e.g. $scope.ButtonStatus which has value false when no animation is playing and otherwise it is true (when playing)
In this case when you click the image which is used as button it will call a particular function - let say the name is $scope.clickImageButton1() with sample definition:
.... //this is the function which is used in the click event //of the button e.g.1 // it will play for pvi "app/resources/Uploaded/l-Creo 3D - Figure 1.pvi" // in model widget "model-1" // the step number 1 $scope.clickImageButton1= function() {
if(!$scope.ButtonStatus) { // will play only if $scope.ButtonStatus==false //start here the play step function for Figure 1,widget model-1, step=1 $scope.app.playModelStep("Figure 1","model-1",1,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); }; //////////////////////////////////
The click call back funciton will check the value of the $scope.ButtonStatus variable and will play the step only if it is false - means no active execution of a step
yes it is possible with javascript code and by using toggle button or button widgets like given below:
$scope.view.wdg['toggleButton-1']['visible']=true;
you can put above javascript for all buttons by changing the value true to false
hey,
The issue is different from the solution . I want to use image such a arrow image instead of button. and if person clicks second button it should not play second animation till the first one is still playing.
Hi @Nithin,
to be sure that I understand the issue :
1.)you have 9 button for each step in animation/sequence you have one specific button which are implemented as images
2.)when you play an animation it should make all buttons disabled and then when an animation is finished all buttons are available ,right?
If this points are not correct then please, provide more details!, Thansk
I will now try to suggest a solution so far, I understand the issue.
To disable the buttons - you can of course use some techniques as suggested in the post where playing property of a model widget is blinded to a disable property of all 9 buttons.
But this will work only if you have only one model widget and it will not work if you use images as buttons. .But I could suggest also another option. You can use the step events - step started and step completed - example:
//this is variable which track if currently step is played
$scope.ButtonStatus=false
... $scope.$on('stepstarted', function(evt, arg1, arg2, arg3) { $scope.ButtonStatus=true }); ... scope.$on('stepcompleted', function(evt, arg1, arg2, arg3) { $scope.ButtonStatus=false });
this mean we have a variable e.g. $scope.ButtonStatus which has value false when no animation is playing and otherwise it is true (when playing)
In this case when you click the image which is used as button it will call a particular function - let say the name is $scope.clickImageButton1() with sample definition:
.... //this is the function which is used in the click event //of the button e.g.1 // it will play for pvi "app/resources/Uploaded/l-Creo 3D - Figure 1.pvi" // in model widget "model-1" // the step number 1 $scope.clickImageButton1= function() {
if(!$scope.ButtonStatus) { // will play only if $scope.ButtonStatus==false //start here the play step function for Figure 1,widget model-1, step=1 $scope.app.playModelStep("Figure 1","model-1",1,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); }; //////////////////////////////////
The click call back funciton will check the value of the $scope.ButtonStatus variable and will play the step only if it is false - means no active execution of a step