AnimationExtension
new AnimationExtension()
AnimationExtension adds a toolbar with buttons (play/pause/forward/backward/goto start/end) and timeline scrubber to control animation playback. The extension provides api methods that will be reflected by the animation toolbar.
The extension id is: Autodesk.Fusion360.Animation
Examples
viewer.loadExtension('Autodesk.Fusion360.Animation')
Methods
load()
Adds a toolbar button and hooks animation listeners.
unload()
Removes toobar button and unhooks animation listeners.
play()
Plays the animation. Invoke pause() to stop the animation.
pause()
Pauses an active animation. Can resume by invoking play()
isPlaying()
Whether the animation is currently playing. Always returns the opposite of isPaused()
Returns
type | description |
---|---|
Boolean |
isPaused()
Wether the animation is currently paused. Always returns the opposite of isPlaying()
Returns
type | description |
---|---|
Boolean |
rewind()
Rewinds and pauses the animation.
setTimelineValue(scale)
Sets the animation at the very beginning (0), at the end(1) or anywhere in between. For example, use value 0.5 to set the animation half way through it’s completion. Will pause a playing animation.
Parameters
scale* Number | value between 0 and 1 |
prevKeyframe()
Sets animation onto the previous keyframe. Will pause the animation if playing.
nextKeyframe()
Sets animation onto the next keyframe. Will pause the animation if playing.
getDuration()
Returns how many seconds does the animation take to complete.
Returns
type | description |
---|---|
Number |
getDurationLabel()
Returns duration as a formatted String h:mm:ss (hours:minutes:seconds)
Returns
type | description |
---|---|
string |
getCurrentTime()
Returns the elapsed time (in seconds) of the animation.
Returns
type | description |
---|---|
Number |
getCurrentTimeLabel()
Returns the current animation time as a formatted String h:mm:ss (hours:minutes:seconds)
Returns
type | description |
---|---|
string |
setFollowCamera(followCam)
Whether a playing animation updates the camera position.
Parameters
followCam* boolean | true to allow animation to update camera position (default behavior). |
Returns
type | description |
---|---|
boolean | true if the operation was successful. |
isFollowingCamera()
Returns
type | description |
---|---|
boolean | Whether animations will update the camera’s position (true) or not (false) |
activate()
Plays the animation.
deactivate()
Pauses the animation.
isActive()
Returns
type | description |
---|---|
boolean | true when the animation is playing. |