Reference · Collections and piles: pure helpers
fanLayoutfunction
Where the cards of a fan lie: each card turns eleven degrees more than the one before, up to 110 degrees from the first to the last, centred on the pile.
Import it
import { fanLayout } from "@johnmorrisdotca/fuda-cards/collection";
Definition
function fanLayout(count: number, seed?: number, step?: number): FanPlace[]
Parameters
| Name | Type | Description |
|---|---|---|
count | number | How many cards; none gives an empty fan. |
seed (optional) | number | The seed that nudges the squared-up deck the fan closes to. Unless said, 1. |
step (optional) | number | How far apart neighbouring cards lie across, in card widths; the angle does the rest of the spreading. A phone uses a smaller one. Unless said, 0.34. |
Returns
FanPlace[]
The places of the cards, first card first.
Examples
import { fanLayout } from "@johnmorrisdotca/fuda-cards/collection";
console.log(fanLayout(3).map((place) => place.angle)); // [ -11, 0, 11 ][ -11, 0, 11 ]What it prints (run when this page was built)