Skip to the content

Wakusei Planets惑星

The Sun, the planets and their moons as a clean line drawing, a shaded realistic drawing or a painted surface map, with real sizes, tilt and rotation, and the moons where they are at any date and time.

Wakusei is the Japanese word 惑星 for a planet. About the name

Contents

Reference · Facts, line drawings and positions

embedCodefunction

The text that puts a body in a page, for one way of making the page. Each way is built, parsed or run by the package's tests: the plain HTML one with a script tag from jsDelivr, an ES module, a React component, a Vue single-file component, an Angular standalone component, a Svelte component, and an iframe of the demo's embed.html.

Import it

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

Definition

function embedCode(options: EmbedOptions, kind?: EmbedKind, settings?: EmbedSettings): string

Parameters

NameTypeDescription
optionsEmbedOptions

The body, its look, the date, the moons, the turn and the size.

kind (optional)"html" | "iframe" | "module" | "react" | "vue" | "angular" | "svelte"

The way the page is made; html by default.

settings (optional)EmbedSettings

The CDN and the demo's address, when they are not the package's own.

Returns

string

The text to paste into the page's source.

Examples

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

console.log(embedCode({ body: "jupiter", look: "realistic", time: "now", moons: true }, "react"));
import { useEffect } from "react";

export function Planet() {
  useEffect(() => {
    // The element needs a browser, so it is imported in an effect, never at the top of the file.
    void import("@johnmorrisdotca/wakusei-planets/element");
    void import("@johnmorrisdotca/wakusei-planets/jupiter");
  }, []);
  return <wakusei-body body="jupiter" look="realistic" time="now" moons />;
}

What it prints (run when this page was built)

View sourceEdit on GitHubMade from the source of @johnmorrisdotca/wakusei-planets 0.24.0.