本文へ移動

Wakusei Planets惑星

太陽・惑星・衛星を、線画、陰影つきの絵、表面の地図で描きます。実際の大きさ・傾き・自転つきで、任意の日時の衛星の位置も分かります。

「惑星」(わくせい) は、太陽のまわりを回る大きな星のことです。 名前について(英語)

目次

リファレンス · データ・線画・位置

LineOptions型

リファレンスの説明と例は英語です。見出しと目次は日本語です。

Options for lineSvg: the size, a pose (tilt, pitch, phase, spin, a time or a pose), moons, range, fill, the language and the colours.

インポート

import type { LineOptions } from "@johnmorrisdotca/wakusei-planets";

定義

interface LineOptions extends PortraitOptions {
    size?: number;
    time?: number;
    fill?: number;
    pose?: Pose;
    zoom?: number;
    panX?: number;
    panY?: number;
    moons?: boolean;
    moonsAt?: readonly {
        id: MoonId;
        x: number;
        y: number;
        z: number;
        distance: number;
    }[];
    orbits?: ReadonlyMap<string, Float32Array>;
    range?: number;
    labels?: boolean;
    lang?: "en" | "ja";
    stroke?: string;
    paper?: string;
}

メンバー

名前型説明
size (省略可)number | undefined

The width and height of the square drawing, in pixels. Default 320.

time (省略可)number | undefined

A moment in milliseconds since 1970: the body is drawn as the Earth sees it then (its real pose, phase and rings). Without it the body is a portrait.

fill (省略可)number | undefined

The radius of the body as a fraction of half the drawing's width, to draw bodies to scale side by side. Default: as large as fits, with its rings.

pose (省略可)Pose | undefined

A pose to draw instead of the portrait or the date's (the viewer's frame; see Pose).

zoom (省略可)number | undefined

Zoom, and the pan as a fraction of half the picture, for a view a shared control moves.

panX (省略可)number | undefined
panY (省略可)number | undefined
moons (省略可)boolean | undefined

Draw the planet's moons on their orbits as the Earth sees them at time (now when time is left out).

moonsAt (省略可)readonly { id: MoonId; x: number; y: number; z: number; distance: number; }[] | undefined

Moons already placed (planet radii, the viewer's frame), for a picture that moves them itself; used with pose.

orbits (省略可)ReadonlyMap<string, Float32Array<ArrayBufferLike>> | undefined

Orbit paths already worked out (x, y, z in planet radii, by moon), to draw instead of working them out.

range (省略可)number | undefined

How far the picture reaches from the planet's centre, in planet radii, when moons is on. Default: past the farthest moon.

labels (省略可)boolean | undefined

Write the names of the moons. Default true.

lang (省略可)"en" | "ja" | undefined

The language of the names and the description. Default en.

stroke (省略可)string | undefined

The colour of the lines. Default: a pale tint of the body's colour.

paper (省略可)string | undefined

The colour of the disc. Default: a dark tint of the body's colour.

tilt (省略可)number | undefined

The axial tilt on the page: how far the north pole leans to the right of straight up. Default: the body's own tilt (turned to 120 or less).

pitch (省略可)number | undefined

How far the viewer looks over the north pole: 0 sees the equator edge-on, 90 looks straight down at the pole. Default 12, or 22 for a body with rings.

phase (省略可)number | undefined

The Sun–body–viewer angle: 0 is full, 90 half, 180 new. Default 38.

spin (省略可)number | undefined

The longitude at the middle of the disc, degrees east. Default: the longitude of the body's best-known side.

例

import { lineSvg, type LineOptions } from "@johnmorrisdotca/wakusei-planets";

const options: LineOptions = { size: 200, tilt: 15, lang: "ja" };
console.log(lineSvg("mars", options).includes("火星"));
true

出力(このページを作ったときに実行した結果)

ソースを見るGitHub で編集@johnmorrisdotca/wakusei-planets 0.24.0 のソースから作成しました。

この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。