Asset Events
Asset events are emitted on the asset entity and bubble up to the world.events.globalId.
3D Model
GLTF_MODEL_LOADED
Emitted when a model has loaded
Properties
| Property | Type | Description |
|---|---|---|
| model | Group | The three.js Group |
Example
- .listen
- .onEvent
- .addEventListener
defineState('initial-state').initial().listen(eid, ecs.events.GLTF_MODEL_LOADED, (event) => {
console.log('Model loaded: ', event.data.model)
})
GLTF_ANIMATION_FINISHED
Emitted when all loops of an animation clip have finished.
Properties
| Property | Type | Description |
|---|---|---|
| name | string | The name of the animation |
Example
- .listen
- .onEvent
- .addEventListener
defineState('initial-state').initial().listen(eid, ecs.events.GLTF_ANIMATION_FINISHED, (event) => {
console.log('Animation finished: ', event.data.name)
})
GLTF_ANIMATION_LOOP
Emitted when a single loop of the animation clip has finished.
Properties
| Property | Type | Description |
|---|---|---|
| name | string | The name of the animation |
Example
- .listen
- .onEvent
- .addEventListener
defineState('initial-state').initial().listen(eid, ecs.events.GLTF_ANIMATION_LOOP, (event) => {
console.log('Animation loop: ', event.data.name)
})
Gaussian Splat
SPLAT_MODEL_LOADED
Emitted when a Splat has loaded
Properties
| Property | Type | Description |
|---|---|---|
| model | Object3D | The three.js Object3D |
Example
- .listen
- .onEvent
- .addEventListener
defineState('initial-state').initial().listen(eid, ecs.events.SPLAT_MODEL_LOADED, (event) => {
console.log('Splat loaded: ', event.data.model)
})
Audio
AUDIO_CAN_PLAY_THROUGH
Emitted when an entity has the capability to play Audio.
Properties
None.
Example
- .listen
- .onEvent
- .addEventListener
defineState('initial-state').initial().listen(eid, ecs.events.AUDIO_CAN_PLAY_THROUGH, () => {
console.log('Ready to play audio')
})
AUDIO_END
Emitted when audio has finished playing on an entity.
Properties
None.
Example
- .listen
- .onEvent
- .addEventListener
defineState('initial-state').initial().listen(eid, ecs.events.AUDIO_END, () => {
console.log('Finished playing audio')
})
Video
VIDEO_CAN_PLAY_THROUGH
Emitted when an entity has the capability to play the video.
Properties
| Property | Type | Description |
|---|---|---|
| src | string | The video source |
Example
- .listen
- .onEvent
- .addEventListener
defineState('initial-state').initial().listen(eid, ecs.events.VIDEO_CAN_PLAY_THROUGH, (event) => {
console.log('Ready to play video: ', event.data.src)
})
VIDEO_END
Emitted when the video has finished playing on an entity.
Properties
| Property | Type | Description |
|---|---|---|
| src | string | The video source |
Example
- .listen
- .onEvent
- .addEventListener
defineState('initial-state').initial().listen(eid, ecs.events.VIDEO_END, (event) => {
console.log('Finished playing video: ', event.data.src)
})