Skip to main content

Miscellaneous

This category encompasses animation and resize events.
It's important to note that unlike interaction events, misc events do not follow a propagation system.

ℹ️ Note
Animation events are exclusively triggered for visible scenes.

EventDescriptionParameters
viewportresizeTriggered on first render and every time an object is rendered with a different viewport size than the previous one.ViewportResizeEvent
beforeanimateTriggered every frame just before animate.
Typically used for preparing object animations.
AnimateEvent
animateTriggered every frame for animating objects.AnimateEvent
afteranimateTriggered every frame immediately after animate.
Often used for post-animation operations.
AnimateEvent

Example

const box = new Mesh(new BoxGeometry(), new MeshLambertMaterial());

box.on('viewportresize', (e) => {
console.log(`New viewport size: ${e.width} - ${e.height} / Camera: ${e.camera}`);
});

box.on('beforeanimate', (e) => {
console.log(`Before animate - Delta: ${e.delta} - Total: ${e.total}`);
});

box.on('animate', (e) => {
console.log(`Animate - Delta: ${e.delta} - Total: ${e.total}`);
});

box.on('afteranimate', (e) => {
console.log(`After animate - Delta: ${e.delta} - Total: ${e.total}`);
});