Reference · SVG faces and looks
layoutFramefunction
THE TILES' DRAWN EXTENT, plus an even margin: the smallest box that holds every tile of a layout as it is drawn, with
its thickness and its layer offsets, in whichever view (mirror) puts them. A page that centres this box centres what
the eye sees, not the grid of slots, so the space from the outermost solid pixel to a frame round it is the same on both
sides. The soft shadow is left out unless shadow is true: it falls one way only, so counting it would push the solid
tiles off centre by its reach; it spills into the margin instead, which is why a frame wants a margin of at least a few
units. Taken tiles do not change the box: it is the layout's, so a game keeps one steady frame. margin defaults to 0.
Null for a size with no layout.
Import it
import { layoutFrame } from "@johnmorrisdotca/jarajara/faces";
Definition
function layoutFrame(size: number, options?: { mirror?: TileMirror | string; margin?: number; shadow?: boolean; }): LayoutFrame | null
Parameters
| Name | Type | Description |
|---|---|---|
size | number | The native layout size identifier, measured in tiles across. |
options (optional) | { mirror?: TileMirror | string; margin?: number; shadow?: boolean; } | Native game, SVG, sound or presentation options. |
Returns
LayoutFrame | null
The drawn tile bounds plus margin, or null for an unsupported layout size.
Examples
import { layoutFrame } from "@johnmorrisdotca/jarajara/faces";
console.log(layoutFrame(4,{margin:10}));{ x: -10, y: -5, width: 145, height: 75 }What it prints (run when this page was built)