2D blend tree — selects between animations based on two parameters. Uses inverse-distance weighting for smooth blending.
Usage:
const tree = new BlendTree2D([ { animKey: 'idle', x: 0, y: 0 }, { animKey: 'walk_n', x: 0, y: -1 }, { animKey: 'walk_e', x: 1, y: 0 }, { animKey: 'walk_s', x: 0, y: 1 }, { animKey: 'walk_w', x: -1, y: 0 },]);tree.evaluate(0.5, -0.5); // → weighted blend between walk_n and walk_e Copy
const tree = new BlendTree2D([ { animKey: 'idle', x: 0, y: 0 }, { animKey: 'walk_n', x: 0, y: -1 }, { animKey: 'walk_e', x: 1, y: 0 }, { animKey: 'walk_s', x: 0, y: 1 }, { animKey: 'walk_w', x: -1, y: 0 },]);tree.evaluate(0.5, -0.5); // → weighted blend between walk_n and walk_e
Evaluate using inverse-distance weighting
Get the dominant animation (highest weight)
Get entries
2D blend tree — selects between animations based on two parameters. Uses inverse-distance weighting for smooth blending.
Usage: