Skip to main content

Class: GLTFAnimationPlugin

Plugins.GLTFAnimationPlugin

Hierarchy​

  • AViewerPlugin<"checkpointEnd" | "checkpointBegin" | "animationStep">

    ↳ GLTFAnimationPlugin

Properties​

PluginType​

▪ Static Readonly PluginType: "GLTFAnimation"


AnimationMarkersExtension​

▪ Static Readonly AnimationMarkersExtension: "WEBGI_animation_markers"


enabled​

• enabled: boolean = true

Overrides​

AViewerPlugin.enabled


autoIncrementTime​

• autoIncrementTime: boolean = true

If true, the animation time will be automatically incremented by the time delta, otherwise it has to be set manually between 0 and the animationDuration using setTime. (default: true)


animations​

• Readonly animations: { mixer: AnimationMixer ; clips: AnimationClip[] ; actions: AnimationAction[] ; duration: number }[] = []


loopAnimations​

• loopAnimations: boolean = true


loopRepetitions​

• loopRepetitions: number = Infinity


timeScale​

• timeScale: number = 1

Timescale for the animation. (not individual actions) If set to 0, it will be ignored.


animationSpeed​

• animationSpeed: number = 1


animateOnScroll​

• animateOnScroll: boolean = false


scrollAnimationDamping​

• scrollAnimationDamping: number = 0.1


animateOnDrag​

• animateOnDrag: boolean = false


dragAxis​

• dragAxis: "x" | "y" = 'y'


autoplayOnLoad​

• autoplayOnLoad: boolean = false

If true, the animation will be played automatically when the model(any model with animations) is loaded.


syncMaxDuration​

• syncMaxDuration: boolean = false

Sync the duration of all clips based on the max duration, helpful for things like timeline markers


dragAnimationDamping​

• dragAnimationDamping: number = 0.3


dependencies​

• dependencies: typeof AssetManagerPlugin[]


uiConfig​

• Optional uiConfig: UiObjectConfig<any, string> = undefined


timelineMarkers​

• timelineMarkers: any[] = []


_dirty​

• Protected _dirty: boolean = false

Inherited from​

AViewerPlugin._dirty


_viewer​

• Protected Optional _viewer: ViewerApp

Inherited from​

AViewerPlugin._viewer


_animationState​

• Protected _animationState: "playing" | "stopped" | "paused" | "none" = 'none'

Accessors​

dirty​

• get dirty(): boolean

Returns​

boolean

Inherited from​

AViewerPlugin.dirty

• set dirty(value): void

Parameters​

NameType
valueboolean

Returns​

void

Inherited from​

AViewerPlugin.dirty


viewer​

• get viewer(): undefined | ViewerApp

Returns​

undefined | ViewerApp

Inherited from​

AViewerPlugin.viewer


animationState​

• get animationState(): "playing" | "stopped" | "paused" | "none"

Returns​

"playing" | "stopped" | "paused" | "none"


animationTime​

• get animationTime(): number

Returns​

number


animationDuration​

• get animationDuration(): number

Returns​

number

Methods​

onDispose​

▸ onDispose(viewer): Promise<void>

Parameters​

NameType
viewerViewerApp

Returns​

Promise<void>

Inherited from​

AViewerPlugin.onDispose


toJSON​

▸ toJSON(meta?): any

Parameters​

NameType
meta?any

Returns​

any

Inherited from​

AViewerPlugin.toJSON


fromJSON​

▸ fromJSON(data, meta?): null | GLTFAnimationPlugin | Promise<null | GLTFAnimationPlugin>

Parameters​

NameType
dataany
meta?any

Returns​

null | GLTFAnimationPlugin | Promise<null | GLTFAnimationPlugin>

Inherited from​

AViewerPlugin.fromJSON


exportState​

▸ exportState(): any

Returns​

any

Inherited from​

AViewerPlugin.exportState


importState​

▸ importState(state): Promise<void>

Parameters​

NameType
stateany

Returns​

Promise<void>

Inherited from​

AViewerPlugin.importState


storeState​

▸ storeState(prefix?, storage?, data?): void

Parameters​

NameType
prefix?string
storage?Storage
data?any

Returns​

void

Inherited from​

AViewerPlugin.storeState


loadState​

▸ loadState(prefix?, storage?): Promise<void>

Parameters​

NameType
prefix?string
storage?Storage

Returns​

Promise<void>

Inherited from​

AViewerPlugin.loadState


setTime​

▸ setTime(time): void

Parameters​

NameType
timenumber

Returns​

void


onAdded​

▸ onAdded(viewer): Promise<void>

Parameters​

NameType
viewerViewerApp

Returns​

Promise<void>

Overrides​

AViewerPlugin.onAdded


onRemove​

▸ onRemove(viewer): Promise<void>

Parameters​

NameType
viewerViewerApp

Returns​

Promise<void>

Overrides​

AViewerPlugin.onRemove


onStateChange​

▸ onStateChange(): void

Returns​

void


playPauseAnimation​

▸ playPauseAnimation(): void

Returns​

void


playClip​

▸ playClip(name, resetOnEnd?): Promise<void>

This will play a single clip by name It might reset all other animations, this is a bug; https://codepen.io/repalash/pen/mdjgpvx

Parameters​

NameTypeDefault value
namestringundefined
resetOnEndbooleanfalse

Returns​

Promise<void>


playClips​

▸ playClips(names, resetOnEnd?): Promise<void>

Parameters​

NameTypeDefault value
namesstring[]undefined
resetOnEndbooleanfalse

Returns​

Promise<void>


playAnimation​

▸ playAnimation(resetOnEnd?, animations?): Promise<void>

Starts all the animations and returns a promise that resolves when all animations are done.

Parameters​

NameTypeDefault valueDescription
resetOnEndbooleanfalseif true, will reset the animation to the start position when it ends.
animations?AnimationAction[]undefinedplay specific animations, otherwise play all animations. Note: the promise returned (if this is set) from this will resolve before time if the animations was ever paused, or converged mode is on in recorder.

Returns​

Promise<void>


pauseAnimation​

▸ pauseAnimation(): void

Returns​

void


resumeAnimation​

▸ resumeAnimation(): void

Returns​

void


stopAnimation​

▸ stopAnimation(reset?): void

Parameters​

NameTypeDefault value
resetbooleanfalse

Returns​

void


resetAnimation​

▸ resetAnimation(): void

Returns​

void


_storeKey​

▸ Protected _storeKey(prefix?): string

Parameters​

NameType
prefix?string

Returns​

string

Inherited from​

AViewerPlugin._storeKey

Constructors​

constructor​

• new GLTFAnimationPlugin()

Overrides​

AViewerPlugin.constructor