Limbs that reach
Give a target; a constraint solves the two angles. The arms take the elbow side that keeps them off the face, and the head turns within its limits.
constraints: [
{ ik: 'armL', bones: ['armL.a1', 'armL.a2'],
lens: [62, 58], root: [-34, -120],
target: 'hand', bend: 1,
avoid: [{ at: [0, -168], r: 40 }] },
{ aim: 'head.rot', root: [0, -168],
target: 'hand', limit: [-0.5, 0.5] },
]
Steps that come from the animation
The walker moves only when a foot lands. Each step is an event keyed in the clip, fired once at any frame rate. Hold the pointer down to run: the stride is handed over, never doubled.
clips: { walk: { dur: 0.8, loop: true, tracks: { … },
events: [[0.2, 'step', { foot: 'L' }],
[0.6, 'step', { foot: 'R' }]] } },
sync: [['walk', 'run']],
for (const e of rig.events)
if (e.name === 'step') moveBy(stride);
A crowd that watches
Click anywhere. Each watcher hears of it when the news reaches it, looks that way, and plays a take it did not just play. Keep clicking: they remember and grow wary.
on: { gasp: { take: ['hop', 'squash',
{ clip: 'wide', when: (d) => d.dist > 120 }] } },
const crowd = Rig.audience({ speed: 420,
memory: { life: 6, full: 4, input: 'wary' } });
crowd.add(rig, x, y);
crowd.react(x, y, 'gasp');
One picture, bent by bones
A single drawing on a mesh of points. Five bones bend it and a bulge runs down the body. Bones are plain channels, so clips, springs or your own code move them. Click to show the mesh.
meshes: { eel: Object.assign(
Rig.mesh.grid(0, 0, 320, 56, 16, 2),
{ bones: [{ name: 'b0', at: [0, 28], to: [64, 28] }, … ] }) },
Rig.mesh.draw(ctx, picture, rig, 'eel');