# Function: branch()

[**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) / branch


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


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

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

Recursively place shrunk, rotated copies of a unit at its own tip.

`repeat` places identical copies along a line; `branch` places
self-similarly SHRINKING copies along a tree, which is the shape a fern
frond, a coral colony and an antler actually have. The recursion is the
whole rule — a fern with more leaflets and a coral with more forks are the
same call with a larger `depth`, never a separate `fernForm`.

The unit is authored pointing along +x with unit length; each generation
attaches at `attachAt` fraction along the previous generation's (already
shrunk) length, fans out by `angle` per split, and shrinks again by
`shrink`. Recursion bottoms out at `depth <= 0` rather than at a size
threshold, so `shrink` staying exactly 1 (no shrink at all) still
terminates — a correctness property a size-based cutoff would not have.


## Parameters {#parameters}



### unit {#unit}


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


### params {#params}


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


## Returns {#returns}


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