简体   繁体   中英

Forge viewer auto-play Fusion animation

I need some help to set up the AnimationExtension using custom options to play automatically the animation as soon the model is loaded on the viewer.

So far I loaded the Autodesk.Fusion360.Animation extension and set the viewable to the Fusion animation one (through its id, found in the manifest). If I try to play the extension from the console I can get the Autodesk.Fusion360.Animation extension and in the callback using play() or activate(); but if I try to do that from the code it's not working. Here is my code:

 viewer.addEventListener(Autodesk.Viewing.GEOMETRY_LOADED_EVENT, (x) => { viewer.loadExtension('Autodesk.Fusion360.Animation').then((y)=> { y.options.startOnInitialize=true; y.activate(); y.play(); }) });

From the options I see there is the startOnInitialize property, but maybe I can't set the options to the builtin extension: I found this post about the options in the extensions and the tools...but I don't understand how to apply it in the code, in relation to a basic viewer.

Can you please give me info or a snippet to autoplay a Fusion animation in the viewer and set additional options to the extension?

Thanks

  1. Configure the Viewer with the Autodesk.Fusion360.Animation extension enabled from the beginning.
  2. Add a listener to the event Autodesk.Viewing.ANIMATION_READY_EVENT to the viewer.
  3. When event arrives, play the animation.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM