Animation machine configuration
XState machine configured for animation state management
const machine = createAnimationMachine({
id: 'player',
initial: 'idle',
states: {
idle: { animation: 'Idle', loop: true },
walk: { animation: 'Walk', loop: true },
run: { animation: 'Run', loop: true },
jump: { animation: 'Jump', loop: false }
},
transitions: [
{ from: 'idle', to: 'walk', event: 'MOVE' },
{ from: 'walk', to: 'idle', event: 'STOP' },
{ from: 'walk', to: 'run', event: 'SPRINT' },
{ from: '*', to: 'jump', event: 'JUMP' }
],
defaultCrossFadeDuration: 0.25
});
Creates an XState machine for managing animation states.