@galacean/asset-tools / Exports / GlTFPreview
- destroy
- getSnapshot
- loadAsset
- pauseAnimation
- playAnimation
- selectAnimation
- setFrameTime
- startPreview
- stopPreview
- getInstance
• Readonly
canvas: HTMLCanvasElement
Get the current canvas element.
• get
animationNames(): string
[]
Get the current animation names.
string
[]
• get
duration(): number
Get the current duration.
number
• get
frameTime(): number
Get the current frame time.
number
• get
isPlaying(): boolean
Get the current playing state.
boolean
▸ destroy(): void
Destroy glTF preview
void
▸ getSnapshot(width?
, height?
): Promise
<unknown
>
Get snapshot of the glTF
Name | Type | Default value | Description |
---|---|---|---|
width |
number |
500 |
snapshot width |
height |
number |
500 |
snapshot height |
Promise
<unknown
>
- promise of snapshot base64 url
▸ loadAsset(glTFAsset
): Promise
<void
>
Load glTF asset
Name | Type | Description |
---|---|---|
glTFAsset |
string | Blob |
glTF asset url or blob |
Promise
<void
>
async promise
▸ pauseAnimation(): void
Pause animation
void
▸ playAnimation(): void
Play animation
void
▸ selectAnimation(index
): void
Select animation
Name | Type | Description |
---|---|---|
index |
number |
animation index |
void
▸ setFrameTime(frameTime
): void
Set frame time
Name | Type | Description |
---|---|---|
frameTime |
number |
frame time |
void
▸ startPreview(): void
Start preview glTF asset
void
▸ stopPreview(): void
Stop preview glTF asset
void
▸ Static
getInstance(): GlTFPreview