Reference · Facts, line drawings and positions
Portraittype
A portrait scene: the bodies, back to front, and how they are arranged, sized, lit and drawn. Plain data: keep it, change it by making a new one, and encodeScene it for an address.
Import it
import type { Portrait } from "@johnmorrisdotca/wakusei-planets";
Definition
interface Portrait {
items: Item[];
layout: "auto" | "manual";
arrange: Arrange;
scale: ScaleMode;
moons: "auto" | "manual";
look: Look;
bg: Background;
aspect: number;
light: {
az: number;
el: number;
};
labels: boolean;
orbits: boolean;
shadows: boolean;
date: string | undefined;
camera: {
x: number;
y: number;
h: number;
};
}
Members
| Name | Type | Description |
|---|---|---|
items | Item[] | Back to front. |
layout | "auto" | "manual" |
|
arrange | Arrange | |
scale | ScaleMode | |
moons | "auto" | "manual" |
|
look | Look | |
bg | Background | |
aspect | number | Width over height. |
light | { az: number; el: number; } | Where the Sun is: |
labels | boolean | |
orbits | boolean | |
shadows | boolean | |
date | string | undefined | The body as the Earth sees it on this date (ISO), or |
camera | { x: number; y: number; h: number; } | The view in a manual layout: the centre and the half-height, in scene units. An automatic layout always fits. |
Examples
import { addBody, defaultPortrait, type Portrait } from "@johnmorrisdotca/wakusei-planets";
const scene: Portrait = addBody(addBody(defaultPortrait(), "jupiter"), "io");
console.log(scene.items.length, scene.layout, scene.scale);2 auto readableWhat it prints (run when this page was built)