Skip to main content

Update

Update events are triggered when the value of a property or a state changes.
It's important to note that unlike interaction events, update events do not follow a propagation system.

EventDescriptionParameters
positionchangeTriggered when the object's position changes.
scalechangeTriggered when the object's scale changes.
rotationchangeTriggered when the object's rotation changes.
enabledchangeTriggered when the object's enabled state changes (either its own or the parent's enabled property).PropertyChangeEvent
visiblechangeTriggered when the object's visibility changes (either its own or the parent's visible property).PropertyChangeEvent

Example

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

box.on('positionchange', () => console.log('position changed'));

box.on('scalechange', () => console.log('scale changed'));

box.on('rotationchange', () => console.log('rotation changed'));

box.on('enabledchange', (e) => {
console.log(`enabled state changed. Parent: ${e.target.name}, value: ${e.value}`)
});

box.on('visiblechange', (e) => {
console.log(`visibility state changed. Parent: ${e.target.name}, value: ${e.value}`)
});