Reference · The Sun, Moon and planets: pure parts
BodyPaintertype
The seam for drawing the Sun, the planets and their moons. The space view places them, sizes them, lights them and labels them; a painter only makes what is drawn at
each place. The default (plainPainter) is a sphere in the body's colour, and a glow for the Sun. Another package can supply better looking ones:
@johnmorrisdotca/wakusei-planets/painter draws the real Sun, planets, Pluto and moons.
make may return a drawing at once or later (a promise); a drawing may update itself and ask for a redraw when a picture arrives. moons is optional: the moons the painter can
draw for a planet at a moment, which the view shows round the planet when it is near enough to see them. looks names what context.look may be.
Import it
import type { BodyPainter } from "@johnmorrisdotca/chikyu-earth/space";
Definition
interface BodyPainter {
make(three: ThreeParts, name: string, context?: PaintContext): BodyDrawing | Promise<BodyDrawing>;
moons?(planet: PlanetName, ms: number): readonly BodyMoon[];
looks?: readonly string[];
}
Members
| Name | Type | Description |
|---|---|---|
make | (three: ThreeParts, name: string, context?: PaintContext): BodyDrawing | Promise<BodyDrawing> | |
moons (optional) | ((planet: PlanetName, ms: number) => readonly BodyMoon[]) | undefined | |
looks (optional) | readonly string[] | undefined |
Examples
import { plainPainter, type BodyPainter } from "@johnmorrisdotca/chikyu-earth/space";
const painter: BodyPainter = { make: (three, name) => plainPainter.make(three, name) };
console.log(typeof painter.make);