# Function: enclose()

[**lifecycle-kit**](https://jonbogaty.com/lifecycle-kit/api/readme/index.md)

***

[lifecycle-kit](https://jonbogaty.com/lifecycle-kit/api/readme/index.md) / [forms](https://jonbogaty.com/lifecycle-kit/api/forms/readme/index.md) / enclose


# Function: enclose() {#function-enclose}


> **enclose**(`unit`, `params`): [`Path`](https://jonbogaty.com/lifecycle-kit/api/forms/interfaces/path/index.md)

Defined in: [forms/rules/enclose.ts:30](https://github.com/jbcom/lifecycle-kit/blob/074e4e7b8038d3e2de9eb44c4b5b5aee0ef02b48/src/forms/rules/enclose.ts#L30)

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.


## Parameters {#parameters}



### unit {#unit}


[`Path`](https://jonbogaty.com/lifecycle-kit/api/forms/interfaces/path/index.md)


### params {#params}


[`EncloseParams`](https://jonbogaty.com/lifecycle-kit/api/forms/interfaces/encloseparams/index.md)


## Returns {#returns}


[`Path`](https://jonbogaty.com/lifecycle-kit/api/forms/interfaces/path/index.md)
