iodizer Posted March 31, 2016 Share Posted March 31, 2016 function pauseFn() { if ( typeof pauseFn.tog == 'undefined' ) { pauseFn.tog = true; } if(pauseFn.tog==true){ meshes = scene.getActiveMeshes(); for(i in meshes.data){ scene.getAnimatableByTarget(meshes.data[i]).pause(); } pauseFn.tog=false; } else{ meshes = scene.getActiveMeshes(); for(i in meshes.data){ scene.getAnimatableByTarget(meshes.data[i]).restart(); } pauseFn.tog=true; } } Quote Link to comment Share on other sites More sharing options...
iodizer Posted March 31, 2016 Author Share Posted March 31, 2016 I tried the code above but it does not work -- is there a standard way to pause all animations? Quote Link to comment Share on other sites More sharing options...
JCPalmer Posted March 31, 2016 Share Posted March 31, 2016 scene does have an Animatables property, which would eliminate the need for mesh for loop. That is flawed. What if a camera is animating? return statement is pointless. Reason for your problem is unclear. Add console logging to check if flow control is what you expect. Quote Link to comment Share on other sites More sharing options...
iodizer Posted March 31, 2016 Author Share Posted March 31, 2016 Thanks for the feedback and help JC, I removed the slop from my example I will look into the Animatibles object which I didn't notice Quote Link to comment Share on other sites More sharing options...
iodizer Posted March 31, 2016 Author Share Posted March 31, 2016 I've tried this now but no success. scene.Animatibles is undefined ... function pauseFn() { if ( typeof pauseFn.tog == 'undefined' ) { pauseFn.tog = true; } if(pauseFn.tog==true){ for(i in scene.Animatables){ scene.Animatables[i].pause(); } pauseFn.tog=false; } else{ for(i in scene.Animatables){ scene.Animatables[i].restart(); } pauseFn.tog=true; } } Quote Link to comment Share on other sites More sharing options...
Vousk-prod. Posted April 1, 2016 Share Posted April 1, 2016 It's not animatible, it's animatAble. Quote Link to comment Share on other sites More sharing options...
iodizer Posted April 1, 2016 Author Share Posted April 1, 2016 oh my yes it is -- works now! thank you! I have fixed the spelling error above. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.