Skip to content

1681-engine / pixel / trunkPivot

Function: trunkPivot() ​

ts
function trunkPivot(widths): number | null;

Defined in: src/pixel/swayRig.ts:61

The first row of a tree's trunk (the canopy is every row above it), from the width of the opaque run on each row of its sprite (0 = empty). The trunk is the longest run of narrow rows in the lower part of the sprite, "narrow" meaning within two pixels of the narrowest row there — so a root flare at the foot does not end it. Null when the sprite has no trunk worth the name (a bush, a heap of reeds).

Parameters ​

ParameterType
widthsreadonly number[]

Returns ​

number | null

Released under the MIT License.