inkworks
Builds interactive 3D "how it works" explainer pages for any machine or mechanism (engines, pumps, locks, gearboxes, turbines, printers, hearts) in the Inkworks look, a white engineering drawing with ink-outlined three.js parts, numbered balloon labels and a cycle you can slow down, step, scrub and orbit. Two layouts, a full drafting sheet with instruments and a cycle chart, or a clean figure card with the model alone. You write one mechanism file of geometry, kinematics and words, the kit does
Install
npx skills add https://github.com/Moh4696/inkworks-skill --skill inkworksMechanism file API
A mechanism is one ES module in kit/js/mechanisms/ that default-exports a plain object. The page (kit/js/sheet.js) reads its metadata to build the DOM, calls build(kit, api) once, then calls model.pose(theta, dt, state) every frame. starter.js is the shortest complete example; engine.js shows several instances, pump.js shows moving phase bounds, mechanism state and an action button.
Top-level fields
driver
Each frame: state.rate eases toward target(state.input), then theta += degPerSec(rate) / state.slow * dt while playing.
view
The layout centres target in the free area between the panels (or inside the card) with camera.setViewOffset, and picks the distance that fits radius.
build(kit, api)
kit is everything from kit/js/kit.js:
api is { state, phaseOf(phi), phiOf(i), bounds(), cycle }.
state holds: theta, phi[i] (each unit's angle in the cycle, already offset), playing, input, rate, slow, focus, layers, tween, scrubbing, and mech (yours).
The returned model
URL and page switches
?m=pumppicks a mechanism file (?m=examples/engineinside a scaffolded project).?layout=figureor?layout=sheetoverrides the layout.window.__sheet={ state, model, mech, kit, api, setFocus, jumpTo, setPlaying, layout }for scripted shots, the recorder and the console.- Keyboard: Space plays and pauses, the left and right arrows step one phase.