Mixer/keyframes for event action

Has anyone tied an event/callback to a completed mixer/keyframe. Instead of using an alternate timer approach I was hoping to use mixers to run various automation. Basically call X after 5 seconds. I know I can tween etc, but hoping to use threejs animation system instead.

Sorry, but it’s not clear what you are asking for. Please try to phrase your issue in a more understandable way.

I use mixers for animating models, I wanted to use a mixer as a timer also, runs from 0-5 seconds, perhaps as a numeric keyframe. I want to use this to drive automations, not change a property every N seconds, but send an event to some associated object. Generate an event to say fire a cannon fire bullet every second, a train puffs smoke every 10 seconds, etc. I know I can use some alternate timer to do this. Staying within threejs and using mixers is preferable to me.

Basically something more targeted than "mixer.addEventListener( ‘finished’, data );

AnimationMixer objects really just manage AnimationAction instances. They are not meant to be used as timers or game state managers. I think the native JavaScript setTimeout or setInterval methods might be what you want, or you could use THREE.Clock and check the state on every frame to avoid doing extra work between frames.

1 Like

Appreciate the thoughts. Had not considered the Clock, will research.