Community Tip - Your Friends List is a way to easily have access to the community members that you interact with the most! X
Goodmorning everyone,
I would like to create an AR experience that reproduces animation sequences without having to link the "Play" button with the corresponding model.
Looking at the bottom panel in Vuforia Studio, the button-template link corresponds to the command: app.view ["Maintenance"]. Wdg ["cart"]. Svc.play.
How can I use it in the javascript file?
Solved! Go to Solution.
I found this solution:
$scope.sequencePlay = function () {
$scope.$root.$broadcast('app.view["Maintenance"].wdg["carrello"].svc.play');
};
In View, in 2D Canvas, in a Button Widget, in Events, in Click, press JS button and call this function:
sequencePlay();
Good morning Leonardosella,
$scope.PlayMaintenanceSequnce = function () {
console.log ("PlayMaintenanceSequnce");
$scope.$root.$broadcast('app.view["Maintenance"].wdg["cart"].svc.play');
}
3. In View, in 2D Canvas, in a Button Widget, in Events, in Click, press JS button and call this function:
PlayMaintenanceSequnce ();
Best regards,
Samuel
Thank you for your reply.
I tried your code but didn't work.
In the inspection tab appear the message into the screen above.
Any suggestions?
Thank you.
Hello Leonardosella,
I have updated code.
I did a bad copy and paste and I have missed to copy A into App instead of pp.
Added also $scope.$root.$broadcast who is needed.
Best regards,
Samuel
for the sake of completness here furhter addtional /alternative way's to play sequence via java code:
angular.element(document.getElementById('model-1')).scope().play();
// or for play all
angular.element(document.getElementById('model-1')).scope().playAll();
The code will be called in the current loaded view and will call the play or playAll service of the Widget Id="model-1"
Here is also another way how to start a Widget service-> using the triggerWidgetService:
$scope.app.loadsequence = function()
{ $scope.setWidgetProp('model-1', 'sequence', "app/resources/Uploaded/l-Creo 3D - TestFigure1.pvi");
$timeout( function() {
twx.app.fn.triggerWidgetService("model-1", 'play');
}, 1000); //delayed the play 1 sec
};
Here we set the sequence property first to a figure and after delay 1 sec will call the play service for the first step
I found this solution:
$scope.sequencePlay = function () {
$scope.$root.$broadcast('app.view["Maintenance"].wdg["carrello"].svc.play');
};
In View, in 2D Canvas, in a Button Widget, in Events, in Click, press JS button and call this function:
sequencePlay();