linejig
Draws interactive 3D line illustrations in three.js. One object is built from a few rounded solids and drawn in an isometric view (2:1 axonometric) with one fine line width, in line art (white and black, hierarchy by tone) or in the Brand, Dots, Readout and Pencil styles, so all figures keep a consistent illustration style. It builds in (stack or draw-on), then its one hero part (a needle, a lid, the keys of a keyboard) answers hover and click, and the user can drag to turn and zoom it. No capti
Install
npx skills add https://github.com/37degree-studio/linejig --skill linejigUsing it with what you already have
Two common starts: a product built on a component library, and an illustration or SVG the user already has. Both
end in an ordinary figure on the kernel, so every rule in SKILL.md still holds. This file names only settings the
kernel really has; its header comment (https://linejig.com/kernel/linejig.js) is the authority.
On top of a component library (shadcn/ui and similar)
A figure is a small page. Either embed a gallery figure (https://linejig.com/<id>/index.html) in an iframe, or
build a figure page of your own on the kernel and serve it from the project. Either way the host talks to it through
the address and through messages.
Theme tokens to plate and ink
- Tokens are often OKLCH or HSL (
--primary: oklch(0.205 0 0)). The kernel takes hex, so convert the computed colour (in the browser,getComputedStyle(el).backgroundColoron an element that uses the token givesrgb(...); turn that into hex) for both the light and the dark theme. - Ink stays grey. The tones are measured for contrast against the plate, so do not tint them to the page's
foreground. On a figure page you own, they are the CSS variables
--hi --edge --mid --lofromlinejig.css; override them only if the user asks, per theme, keepinghi > edge > mid > loin contrast against the plate, and measure the rendered pixels. ?plate=is read once at load, in an iframe page. To change the plate later, reload the frame with a new address.
Sizing in cards
- The drawing fits a 5:4 plate inside whatever box it gets; 400 by 320 is the natural shape and any other shape adds
margin. In a card, give the frame
width: 100%; aspect-ratio: 5 / 4; border: 0and let the card's padding frame it. - Keep
embed=1on every embed: the wheel and a vertical swipe then scroll the page instead of zooming the object. - Add
loading="lazy"and atitlethat names the object. Each frame is its own WebGL context, so keep three or four live figures per page at most and show a still for the rest. - The figure never draws words. Headings, body text and the call to action are the card's: put the label of the
hero's action on a Button in the card footer, and also run it when the figure posts
action.
Dark mode
- Without
?theme=a figure follows the visitor's system setting. shadcn/ui (and mostnext-themessetups) switch with adarkclass on<html>instead, so the figure must be told: start it with?theme=lightor?theme=darkfrom the current class, and post{type: 'theme', value}whenever the class changes. - Post only after the figure has sent
ready, and always to the originhttps://linejig.com(or your own origin for a self-hosted figure page). Checke.originande.sourceon everything you receive.
A React component, as a sketch
Use it inside a Card's content, with the words in the card and the action on a Button:
<LinejigFigure id="empty-inbox" title="Letter tray" plate="ffffff,0a0a0a" onAction={openComposer} />. hex()
turns a computed rgb(...) into the six digits the address wants. The plate values here are examples:
read the real ones from the project's tokens.
Starting from the user's own illustration or SVG
The kernel draws only its own primitives: footprints extruded into rounded prisms (K.rrect, K.circ, K.box,
K.turn, then K.solid) and raw lines (K.add). It has no SVG import and no image tracing, so the user's artwork is
a reference you read and rebuild by hand, never a file the kernel loads.
- Check the source. Use the user's own drawing, or one they have the right to use. Never trace a generated
picture (
SKILL.md, "What stays out"). - Name the object and its parts. What is it, what are its 8 to 12 parts, and which outline features make it recognisable at thumbnail size? Drop every word, number, logo, texture, gradient and small detail in the source.
- Rebuild each part as a footprint. A rectangle or rounded rectangle becomes
K.rrect(orK.boxfor a part with a bevel), a circle becomesK.circ, a turned shape getsK.turn. For a free-form outline, sample the path into points and build a ring of{ u, v, nu, nv }(position and outward normal), the footprint format the kernel uses. Give each part a height (w0,w1) and a frame (K.axes), since an SVG is flat and the figure is not. - Place it in the one camera. The view is always the 2:1 axonometric; a front-on SVG is redrawn in it, not
kept front-on. Set
fit.pointsto the most extreme pose. - Choose the hero part. The part the message is about (
references/styles.md, "Which part takes the colour"): it is thehipart. Drop the source's colours; the drawing is white, black and grey. - Give it hover and click. Register its hit area with
K.hit(id, poly)(the silhouetteK.solidreturns works), giveHEROitsonHover,onLeaveandonClickwith the move the real part makes (references/interaction.md), and anactionwithopened(st)if a click should hand off to the host page. - Plan the intro with an
ASSEMBLYtable (references/motion.md, "Planning the stack"), then render and check it like any other figure (references/verify.md), side by side with the source so the user can compare.