Function: enclose()
lifecycle-kit / forms / enclose
Function: enclose()
enclose(
unit,params):Path
Defined in: forms/rules/enclose.ts:30
Add a shell around a unit's own bounds.
The rule that turns a beetle-shaped repeat+pair body into an actual
beetle: an elytra is not a different body plan, it is the same insect body
with a shell rule applied over the top. enclose reads the enclosed unit's
bounds and emits an ellipse sized to just cover them plus thickness, so
the shell is a continuous function of what it encloses — a body built
slightly bigger gets a slightly bigger shell, with no separate size table.
Draw order matters here more than in the other rules: the shell is emitted AFTER the enclosed geometry, so it draws on top the way a beetle's elytra actually occludes the body beneath it. A consumer that wants the body fully hidden strokes and fills the shell opaque; one that wants a visible body under a translucent shell (a cicada's wing case) controls that with fill alpha, which is the assemblage stage's job, not this rule's.
An empty unit encloses nothing and is returned unchanged — there is no "shell with no bounds" to draw.
