How to play a sequence without bindings button and model
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
How to play a sequence without bindings button and model
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.
- Tags:
- play button
- sequence
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
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();
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Good morning Leonardosella,
- In View, <View name>.js node (if View is named Home, node is named Home.js)
- Add a custom JavaScript function :
$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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
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
- Tags:
- llo
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
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();