The drawing half of a chain: one sprite per segment.
import { Texture, TextureSource } from 'pixi.js';import { ArticulatedChain, ChainRig } from '@datamoc/mwg/two-d/render';const skin = new Texture({ source: new TextureSource({ width: 8, height: 8 }) });const spine = new ArticulatedChain({ segments: 3, length: 10 });const rig = new ChainRig(spine, [skin, skin, skin]); // one Texture per segmentrig.update(1); // segments sit on the chain's points Copy
import { Texture, TextureSource } from 'pixi.js';import { ArticulatedChain, ChainRig } from '@datamoc/mwg/two-d/render';const skin = new Texture({ source: new TextureSource({ width: 8, height: 8 }) });const spine = new ArticulatedChain({ segments: 3, length: 10 });const rig = new ChainRig(spine, [skin, skin, skin]); // one Texture per segmentrig.update(1); // segments sit on the chain's points
The drawing half of a chain: one sprite per segment.
Example