Request

Response

    Autodesk.Viewing.Extensions

    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

    typedescription
    Boolean

    isPaused()

    Wether the animation is currently paused. Always returns the opposite of isPlaying()

    Returns

    typedescription
    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
    * Required

    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

    typedescription
    Number

    getDurationLabel()

    Returns duration as a formatted String h:mm:ss (hours:minutes:seconds)

    Returns

    typedescription
    string

    getCurrentTime()

    Returns the elapsed time (in seconds) of the animation.

    Returns

    typedescription
    Number

    getCurrentTimeLabel()

    Returns the current animation time as a formatted String h:mm:ss (hours:minutes:seconds)

    Returns

    typedescription
    string

    setFollowCamera(followCam)

    Whether a playing animation updates the camera position.

    Parameters

    followCam*
    boolean
    true to allow animation to update camera position (default behavior).
    * Required

    Returns

    typedescription
    boolean true if the operation was successful.

    isFollowingCamera()

    Returns

    typedescription
    boolean Whether animations will update the camera’s position (true) or not (false)

    activate()

    Plays the animation.

    deactivate()

    Pauses the animation.

    isActive()

    Returns

    typedescription
    boolean true when the animation is playing.