Reference · Facts, line drawings and positions
layoutPortraitfunction
Where every body is and how big, and the camera that holds them. A manual scene gives what it stores. An automatic one works it out (a row, an arc or a grid, a planet's moons round it in orbit order) and fits the camera, so its units are the camera's half-height.
Import it
import { layoutPortrait } from "@johnmorrisdotca/wakusei-planets";
Definition
function layoutPortrait(scene: Portrait): Resolved
Parameters
| Name | Type | Description |
|---|---|---|
scene | Portrait | The scene. |
Returns
Resolved
Every body placed, back to front, and the camera.
Examples
import { addBody, defaultPortrait, layoutPortrait } from "@johnmorrisdotca/wakusei-planets";
const { placed } = layoutPortrait(addBody(addBody(defaultPortrait(), "earth"), "moon"));
console.log(placed.map((item) => `${item.body} ${item.x.toFixed(2)}`).join(", "));earth -0.65, moon 0.92What it prints (run when this page was built)