Showing results for 
Search instead for 
Did you mean: 
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Have a PTC product question you need answered fast? Chances are someone has asked it before. Learn about the community search. X

Play / Pause Sequence


Play / Pause Sequence

Hello All,


I know this sounds super simple, but I can't figure out how to create a play / pause function. I want a button that toggles between playing and pausing the animation. This is what I've tried so far and it's not working. I've attached the Chrome Dev tools error. It doesn't like "$;"


// playPause
// Functionality: stop the sequence if already playing - or play the current step if already stopped
$ = function() {
console.log('$ = function()');
console.log('playing was stopped');
console.log('playing was started');


Any Ideas are appreciated!




Hi @Wes_Tomer 


You can use a toggle button and it's 'pressed'/'unpressed' events to do this without code. Add a toggle button to your canvas and bind the 'pressed' event to the 'playAll' service and the 'unpressed' event to the 'stop' service of your model. 



Thank you. This would be a good alternative, but it will not work in our case.
We need the user to be able to turn their attention and hands to the physical product, while wearing the HoloLens.
For this reason we need a button that can be pressed once (HoloLens air-tap) to play
And pressed once to pause (to inspect part-way through)

Ah, gotcha.


Try this:


Create an app param and initialize it to = 0. I called mine 'modelPlaying'. Add the below code to Home.js:


var playStatus = $;

$scope.isPlaying = function(){
	playStatus = 1;

$scope.notPlaying = function(){
	playStatus = 0;

$scope.toggleSequence = function(){
  console.log('in toggle Sequence');
  if(playStatus == 1){
    $'model-1', 'stop');
    console.log('stopping sequence');
    $'model-1', 'playAll');
    console.log('playing sequence');

Call isPlaying() on the model event 'Play Started', notPlaying() on the 'Play Stopped' event, and toggleSequence() on the click event of your button. 




I just realized that this stops after the step completes (PlayAll) but does not stop mid-step.


I want to toggle between play & pause within a single step. I have other buttons which progress to next & previous steps. But what some of my steps are probably 60 seconds or longer with a lot of tool movements and actions -- and it would be great if the step could be paused part-way through. This is what I originally meant.


Is this possible?

To pause the animation of a step partially through it's duration?

Top Tags