Components

Moon

Moon Phase Drawing, from magick-components

The Moon in a phase, lit in gold on its unlit disc with a soft glow, turned as it looks from either hemisphere: a phase you give, or a date's. It needs no browser, so it renders on the server; today's phase is a date the page knows. Its glow's id comes from useId, so several can share a page.

import Moon from "magick-components/astrology/Moon";

magick-components is on npm, under MIT (how to install it), and its source is in the app's repository.

Props

JSX

<Moon phase={0.15} height={160} />

Props

PropTypeDefaultDescription
dateDateThe day whose phase to draw, worked out by lune. phase, when given, wins. An invalid Date throws a RangeError.
heightstring | numberThe SVG's height; from the width and the drawing's shape when not given.
hemisphere"north" | "south""north"The hemisphere it is seen from, which turns the Moon as it looks from there: north by default.
phasenumberThe phase to draw, from 0 to 1 as lune gives it: 0 and 1 are new, 0.5 full; anything else throws a RangeError. With neither this nor date, only the unlit disc is drawn.
widthstring | numberThe SVG's width; from the height and the drawing's shape when not given.
Magick.ly is open source. You can see the code used to generate this page in Moon.tsx, Moon.examples.tsx and Explorer.tsx.