@johnmorrisdotca/wakusei-planets 0.27.0 → 0.30.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +22 -0
- package/NOTICE.md +20 -0
- package/README.md +21 -8
- package/dist/element.d.ts +5 -0
- package/dist/element.js +46 -3
- package/dist/embed.d.ts +64 -0
- package/dist/embed.js +66 -0
- package/dist/index.d.ts +4 -1
- package/dist/index.js +4 -1
- package/dist/kids/picture.d.ts +4 -4
- package/dist/kids/picture.js +4 -4
- package/dist/lineup/data.d.ts +160 -0
- package/dist/lineup/data.js +303 -0
- package/dist/lineup/element.d.ts +99 -0
- package/dist/lineup/element.js +782 -0
- package/dist/lineup/labels.d.ts +141 -0
- package/dist/lineup/labels.js +155 -0
- package/dist/lineup/layout.d.ts +174 -0
- package/dist/lineup/layout.js +162 -0
- package/dist/lineup/scene3d.d.ts +47 -0
- package/dist/lineup/scene3d.js +155 -0
- package/dist/portrait/element.d.ts +5 -2
- package/dist/portrait/element.js +57 -6
- package/dist/portrait/scene3d.d.ts +13 -0
- package/dist/portrait/scene3d.js +21 -2
- package/dist/scene/body.d.ts +2 -0
- package/dist/scene/body.js +2 -1
- package/dist/scene/detail.d.ts +8 -2
- package/dist/scene/detail.js +56 -28
- package/dist/scene/painter.d.ts +30 -0
- package/dist/scene/painter.js +93 -9
- package/dist/scene/textures.d.ts +4 -2
- package/dist/scene/textures.js +2 -0
- package/dist/scene/tiles.d.ts +46 -0
- package/dist/scene/tiles.js +165 -19
- package/dist/space/clock.d.ts +31 -0
- package/dist/space/clock.js +45 -0
- package/dist/space/element.d.ts +16 -2
- package/dist/space/element.js +54 -32
- package/dist/space/scene.d.ts +9 -0
- package/dist/space/scene.js +16 -2
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +9 -2
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,28 @@
|
|
|
2
2
|
|
|
3
3
|
## [Unreleased]
|
|
4
4
|
|
|
5
|
+
## [0.30.0] - 2026-11-10
|
|
6
|
+
|
|
7
|
+
- **The portrait and the space view zoom to their bodies' detail, with the finer map tiles** (MODULES-773). The painter, which draws every body of `<wakusei-portrait>` and `<wakusei-space>`, now takes the tiles, the window and the zoom table that `<wakusei-body>` got in 0.27.0. `PaintInfo.view` (new, optional: the camera and the size of its view in CSS pixels) lets a body work out which part of its surface the camera sees (`seenRegion`: rays through a grid of the view and round the edge of the near side, met with the body in its own frame, for an orthographic camera and a perspective one alike); a body whose disc is 150 device pixels across its radius or more, once the 2048 pixel map is not sharp enough, reads the tile set and lays the window over its map. `createPainter({ tiles })` says where the tiles are (`off` for none; the demo site's by default unless `textureBase` is given), `PaintContext.onLevels` is told what levels a body has, and `Painting.tiles` says what the window is doing. A caller that gives no `view` (chikyu-earth's space view) draws as it always did. Bodies that are not glowing take the generic detail in the painter's shader too, as in `<wakusei-body>`.
|
|
8
|
+
- **The portrait's zoom range follows its bodies** (MODULES-773). A shaded portrait goes as far as its farthest-reaching body (the table of `scene/reach.ts`, each body measured in the radii its picture reaches from the middle of the short side of the view at Fit, on its finest tile level once the tiles are found): 8x at least, 1000x at most, as before 0.1x at the least. A line portrait stays at 8x, and so does a scene of bodies with no finer maps. `stats.tiles` and `stats.zoomMax` say what it is doing. The `tiles` attribute (new on `<wakusei-portrait>` and `<wakusei-space>`; `off` for none) names the tile folder, the demo's embed page and space page set it.
|
|
9
|
+
- **The space view's ceiling stays at 3x** (MODULES-773). The camera is held 1.05 radii from the surface, and at 3x, 0.13 radii above the ground, a texel of the finest tiles of the Earth, Mars and the Moon is about two pixels wide in a view 420 pixels high, which is where the zoom table says their detail runs out: the table gives the space view no further to go. What changes is the picture at 3x: the level 3 tiles (four to nine of them on a view as wide as the demo's) at their own size, where the 2048 pixel map was enlarged eight times. The tiles are used where a body is drawn from its map: the Earth in both looks, Mars and the Moon in the `painted` look. A far view reads no tile set and no tile. `stats.tiles` of the space view adds up its bodies' windows.
|
|
10
|
+
- **Tests** (MODULES-773). `seenRegion` against the box it replaces and against a pinhole camera; the painter with a camera, in Node, with a faked network; the portrait and the space view in a browser with the made-up tile set (what is fetched and how often, which level is on the body, nothing fetched far away, nothing drawn at rest, what the window took given back) and in the freeze test; the star presets.
|
|
11
|
+
- **The star page's presets are the size line-up's rows** (MODULES-795). Sirius A, Betelgeuse, Rigel and Vega on the star page now read `LINEUP_STARS`, so the two pages agree: Betelgeuse 1,057 Suns (the measured angle at 222 pc, 3,650 K), Sirius A 1.7144 (9,845 K) and Vega 2.726 equatorial (9,660 K, flattening 0.113, turning in 0.71 days). They were 764 (Joyce et al. 2020, a value from stellar models that the line-up names and does not use), 1.711 and 2.362. The README, the star-look guide (English and Japanese) and the examples that named those numbers use the line-up's. The size line-up guide no longer says the star page's preset is the model value.
|
|
12
|
+
|
|
13
|
+
## [0.29.0] - 2026-11-10
|
|
14
|
+
|
|
15
|
+
- **Time keeps up on slow machines** (MODULES-797). `<wakusei-space>`'s clock now lives in `createGameClock` (`src/space/clock.ts`, internal): it advances by the time the page's clock says passed, never by a frame, so 86400x is a day for every real second whether the machine draws 60 frames a second or 5 (a unit test with a 5-frames-a-second clock moves 2 days in 2 s within 1 percent). There is no cap on a long gap: a tab that was hidden or a laptop that slept finds the date where the speed would have taken it. Three faults found on the way: the `time` property and `stats.time` read the moment of the last step, up to a long draw old, and now read the moment now; a picture drawn late showed the moment of the last step and now shows the moment it is drawn at; and starting, switching or stopping a ride dropped the time since the last step (up to a minute at real time on a held date). The speed, Pause, Back and the `wakusei-timechange` events are as they were. The date-play test times the clock against the page's own clock again.
|
|
16
|
+
- **Three browser tests that failed on a Mac are fixed, in the tests** (MODULES-788, MODULES-775). The space view's "paused, nothing is drawn" test began 600 ms after the page was live, and the Earth's finer map (1024 pixels, after the 512 one) arrives later on a busy machine and draws one frame when it does: 39 to 52 draw calls, the same each time, reproduced by holding that file back 1.8 s. It now waits for the map and for the view to be quiet, and the limit (no draw in 4 seconds) is as it was. "The view can be moved sideways and rolled" and the embed panel's "picture fits its box" both waited a fixed time (800 ms, 150 ms) for a frame, and on a busy Mac the next frame can be seconds away: they now wait for the frame that draws the change (the draw counter moves past its value at the change; the panel's layout fits), and the limits (1 pixel, half a pixel) are as they were. The reduced-motion ride test (a ride runs at about one step a second) divided its draws by 4 seconds although a busy machine takes longer between the two reads, and counted the frame of a late Earth map: it now counts over the real time between the reads, taken with the page's clock, and waits for the map; the element's step rate (one a second) does not drift, and the limit (1.6 a second) is as it was. The date-play tests that read the date box (a ride "keeps moving", Play moves the date on, the body page's day) waited a fixed 1.5 to 2.2 s for the box, which is written from the element's events and can be held back a second or two by a long draw: they now wait for the box to reach the later date (15 s at most), the dates asked for as they were. The space view's tests no longer run as a serial group, so one failure no longer hides the 21 after it.
|
|
17
|
+
|
|
18
|
+
## [0.28.0] - 2026-11-09
|
|
19
|
+
|
|
20
|
+
- **The date follows the clock, and Play runs it** (MODULES-759, MODULES-755 wakusei part). John, on the space page: "The date is never reflected by the action in the page" and "Where are the Play controls to see the planets rotate starting from the Date and time selected?" `<wakusei-space>` and `<wakusei-body>` (with a `time` or `moons`) send `wakusei-timechange` with `{ time, running }`: four times a second at most while time runs (once a second at real time; only while the tab is shown), and once with `running: false` when the clock holds. `<wakusei-body>` has a `time` property (the moment shown). A held clock (`rate="0"`) is not "moving" any more, so it draws nothing. In the demo the date box follows the clock (never while the reader is typing in it), a ride along (the Moon, Io) starts the clock, and the loose Speed row is kazoku-ui's `<kazoku-replay-bar>` on the space page and the body page: Play runs the clock from the date shown, Pause holds it, Back returns to the date chosen, and `play=on`, `speed` and the date (`t`, when the clock stops or the reader leaves) stay in the address. Reduced motion leaves Play off. An old address with `speed` alone is paused now (add `play=on`); the speed starts at 3600 (an hour a second). The body page's real sky no longer adds the portrait turn to a dated picture (it turned 12 degrees a second even when held); Play is what moves it. `wakusei-time` is unchanged.
|
|
21
|
+
- **kazoku-ui 0.27 (with 0.26): a plain drag always turns, lighter sheets for children, and the shared renderer draws at most 30 frames a second** (MODULES-743). On the space view and the views that turn, a plain drag (and one finger) now turns at every zoom; the middle or right button, Ctrl or Command and a drag, Space and a drag, and the wheel move; the Move or Turn choice is gone (`initial: { drag: "turn" }` is no longer asked of the shared controls). The colouring sheets draw their outline at kazoku-ui's kid line, 1.2 mm (was 3), and the lines inside at 1 mm (was 2.5), so a sheet is lighter and the names have room.
|
|
22
|
+
- **A size line-up of stars in 3D** (MODULES-722). `<wakusei-lineup>` (entry point `/lineup`) puts the Sun, Sirius A, Vega, Arcturus, Aldebaran, Rigel, Antares, Betelgeuse and the largest stars known (VY Canis Majoris, WOH G64, UY Scuti, Stephenson 2-18) side by side or one above the next at true relative size, each drawn with the star look and labelled with its radius in Suns and kilometres, its error and its source, in English and Japanese. A slider zooms smoothly (a logarithmic scale of radius, the camera resting on each body) from the smallest body up to the largest, from the Earth and Jupiter (`planets`) or the Sun; each star turns slowly and a drag turns the one it takes hold of; ring markers show a body too small to see. All the bodies are in one three.js scene on the shared renderer (one WebGL context, nothing drawn at rest or out of sight, no frame cap of its own, a freeze test in `e2e/lineup-freeze.demo.ts`). Attributes `stars`, `planets`, `layout`, `zoom`, `at`, `turn`, `look`, `labels`, `controls`, `size`, `lang`, `quality`, `live`; methods `zoomTo`, `turnBy`, `resetTurns`, `picture`, `toSvg`, `toPng`; the `wakusei-lineup-zoom` event.
|
|
23
|
+
- **The radii are a typed table with a paper for each row** (MODULES-722). `LINEUP_STARS` holds each star's radius with its error below and above, the method, the angular diameter, the ADS bibcodes and the date read; `basis` says how well a size is known (defined, measured angle and distance, measured angle with a distance that is not a parallax, or from brightness and temperature) and the label says *estimated* for the last two. The tests check each radius against the distance its paper adopted. Betelgeuse is 1,057 (+228, -162) Suns, the measured angle at the distance of Harper et al. 2017; the 764 of Joyce et al. 2020 is from stellar models and is named and not used. UY Scuti is 1,708 (±192) Suns, the measured angle at the paper's old distance, with the revised 909 (photometry and a Gaia distance) named and not used. WOH G64 and Stephenson 2-18 have no measured angular diameter. Nothing is taken from an infographic, Wikipedia's text or the Gaia, Hipparcos and Tycho catalogues; `NOTICE.md` lists every source and each disagreement.
|
|
24
|
+
- **The pure side** (MODULES-722): `lineupBodies`, `placeLineup`, `lineupView`, `lineupZoomOf`, `lineupFocus`, `lineupProject`, `lineupText`, `lineupKm`, `lineupLabels`, `lineupLabelsSvg`, `lineupCode` and `lineupCredit`.
|
|
25
|
+
- **The demo's size line-up page and its embed** (MODULES-722). `lineup.html` has its choices in rows of clicks kept in the address (stars, planets, layout, turning, a button for each body), a card for the body in frame with its radius, method, papers and where they disagree, "Save as an image" (kazoku-ui's `saveImage`, PNG and SVG) and "Print as a poster" (kazoku-ui's print part, A4 and US Letter, landscape, a QR code back to the page), and "Put it in your page" for all seven ways. The embed page takes `?lineup=1`. A guide in both languages, `docs/guides/size-lineup.md`, holds every tested example word for word (`pnpm test:usage` builds and opens each).
|
|
26
|
+
|
|
5
27
|
## [0.27.0] - 2026-11-09
|
|
6
28
|
|
|
7
29
|
- **Close zoom: every shaded body zooms as far as its detail goes, with finer map tiles** (MODULES-646). `<wakusei-body>` stopped at 8x for every body, because the painted maps are 2048 pixels round; in a moons picture that was Saturn a third of the frame wide, with + greyed. The limit is now worked out for each body from the widest map it has, the size of its picture and how soft its surface is (`src/scene/reach.ts`; the table of all 47 bodies is in the new guide, Close zoom and map tiles): Saturn goes to 36x alone and 1000x in its moons picture, Mars, the Moon and the Earth to 44x alone, ten moons to 22x, and no body below 8x. Behind it: **finer map tiles** (`scripts/make-body-tiles.py`, `pnpm tiles`): the big public-domain maps of 15 bodies (Mars, the Moon, the Earth, Mercury, Io, Callisto, Rhea, Enceladus, Tethys, Dione, Iapetus, Triton, Pluto, Charon, Mimas) cut into 512 pixel tiles up to 16384 pixels round, built by the Pages workflow and served beside the demo (not in git, not in the npm package: 3552 tiles, 76.5 MB); the part in view is laid over the 2048 map as one window of at most 16 tiles (about 22 MB of graphics memory), fetched when the zoom needs it and the view has settled, and let go with every decoded tile 4 seconds after it does not. The new `tiles` attribute says where they are (`off` for none; by default the demo site's, unless `texture-base` names your own pictures), `stats.tiles` and `stats.zoomMax` say what the element is doing. **Generic detail**: where a map is enlarged more than a quarter, the shader adds octaves of noise (grain for a rock, faint streaks along the latitudes for a gas giant, none for the Sun or a star) so a body never goes smooth; it is noise, not a feature of the body, and the guide says so. **Saturn's rings** get generic ringlets where the strip is enlarged; the strip, the gaps and the shadows are as they were. The sphere has 192 by 96 segments (was 128 by 64), so its edge stays round at a deep zoom. `<wakusei-portrait>` (8x) and `<wakusei-space>` (3x) are unchanged. The freeze test's limits are unchanged and it passes.
|
package/NOTICE.md
CHANGED
|
@@ -39,6 +39,26 @@ Voyager 1 and 2, New Horizons, Pioneer 10 and 11, Cassini, Galileo, Juno, Parker
|
|
|
39
39
|
- **Facts and events**: NASA mission pages, read 2026-11-08: Voyager 1 (https://science.nasa.gov/mission/voyager/voyager-1/), Voyager 2 (https://science.nasa.gov/mission/voyager/voyager-2/), New Horizons (https://science.nasa.gov/mission/new-horizons/), Pioneer 10 (https://science.nasa.gov/mission/pioneer-10/), Pioneer 11 (https://science.nasa.gov/mission/pioneer-11/), Cassini (https://science.nasa.gov/mission/cassini/ and its timeline, https://science.nasa.gov/mission/cassini/the-journey/timeline/), Galileo (https://science.nasa.gov/mission/galileo/), Juno (https://science.nasa.gov/mission/juno/ and the NSSDCA record 2011-040A, https://nssdc.gsfc.nasa.gov/nmc/spacecraft/display.action?id=2011-040A), Parker Solar Probe (https://science.nasa.gov/mission/parker-solar-probe/ and the NSSDCA record 2018-065A, https://nssdc.gsfc.nasa.gov/nmc/spacecraft/display.action?id=2018-065A) and the James Webb Space Telescope (https://science.nasa.gov/mission/webb/ and https://science.nasa.gov/mission/webb/launch/). A time is given only where a page gives one. Where a page's date for a flyby disagrees with the closest approach of Horizons' path, the package keeps the date of the path (listed in the guide).
|
|
40
40
|
- **Japanese names** are the usual Japanese spellings of the missions' names.
|
|
41
41
|
|
|
42
|
+
## The size line-up's radii
|
|
43
|
+
|
|
44
|
+
The twelve stars of `<wakusei-lineup>` (`src/lineup/data.ts`, `LINEUP_STARS`). Every radius and temperature was typed from a refereed paper (the abstract and the tables, on arXiv and in the journal's own record, read on 2026-11-09); the papers are credited and none of their text, figures or tables is copied. Facts are not copyrightable. A radius is an angular diameter that was measured (interferometry where it exists) times a distance, or, where the row says so, a radius worked out from brightness. Nothing is taken from an infographic, from Wikipedia's text, or from the catalogues of Hipparcos, Gaia or Tycho (ESA, CC BY-NC 3.0 IGO): where a paper's distance is a catalogue parallax (Vega, Arcturus, Aldebaran, Rigel, Antares), only the paper's published radius and angle are typed here, never the parallax. Each ADS bibcode below opens the paper at https://ui.adsabs.harvard.edu/abs/<bibcode>/abstract.
|
|
45
|
+
|
|
46
|
+
- **The Sun**: the IAU's nominal radius, 695,700 km, and effective temperature, 5,772 K: I. Prša et al. (2016), "Nominal values for selected solar and planetary quantities: IAU 2015 Resolution B3", AJ 152, 41 (2016AJ....152...41P).
|
|
47
|
+
- **Sirius A**: radius 1.7144 ± 0.0090 Suns and 9,845 K, H. E. Bond et al. (2017), "The Sirius System and its Astrophysical Puzzles", ApJ 840, 70 (2017ApJ...840...70B), from the angular diameter 6.048 ± 0.040 mas of J. Davis et al. (2011), "The Angular Diameter and Fundamental Parameters of Sirius A", PASA 28, 58 (2011PASA...28...58D).
|
|
48
|
+
- **Vega**: equatorial radius 2.726 ± 0.006 Suns, polar radius 2.418, apparent temperature 9,660 K and rotation period 0.71 days, J. D. Monnier et al. (2012), "Resolving Vega and the inclination controversy with CHARA/MIRC", ApJ 761, L3 (2012ApJ...761L...3M).
|
|
49
|
+
- **Arcturus**: 25.4 ± 0.2 Suns and 4,286 K, I. Ramírez and C. Allende Prieto (2011), "Fundamental Parameters and Chemical Composition of Arcturus", ApJ 743, 135 (2011ApJ...743..135R), from the weighted mean of the interferometric angular diameters, 21.06 ± 0.17 mas.
|
|
50
|
+
- **Aldebaran**: 44.2 ± 0.9 Suns, a limb-darkened diameter of 20.58 ± 0.03 mas, and 3,934 K, A. Richichi and V. Roccatagliata (2005), "Aldebaran's angular diameter: how well do we know it?", A&A 433, 305 (2005A&A...433..305R).
|
|
51
|
+
- **Rigel**: 78.9 ± 7.4 Suns from the limb-darkened diameter 2.75 ± 0.01 mas (Aufdenberg et al. 2008) and 12,100 K (Przybilla et al. 2010), as listed by E. Moravveji et al. (2012), "Asteroseismology of the Nearby SN-II Progenitor: Rigel Part I", ApJ 747, 108 (2012ApJ...747..108M).
|
|
52
|
+
- **Antares**: 680 Suns from the limb-darkened diameter 37.38 ± 0.06 mas, and 3,660 K, K. Ohnaka et al. (2013), "High spectral resolution imaging of the dynamical atmosphere of the red supergiant Antares in the CO first overtone lines with VLTI/AMBER", A&A 555, A24 (2013A&A...555A..24O). The error (-99, +139) is worked out here from the 17 percent error of the parallax the paper uses.
|
|
53
|
+
- **Betelgeuse**: the limb-darkened diameter 44.28 ± 0.15 mas, X. Haubois et al. (2009), "Imaging the spotty surface of Betelgeuse in the H band", A&A 508, 923 (2009A&A...508..923H), and the distance 222 (+48, -34) pc, G. M. Harper et al. (2017), "An Updated 2017 Astrometric Solution for Betelgeuse", AJ 154, 11 (2017AJ....154...11H); the radius, 1,057 (+228, -162) Suns, is half the angle times the distance, worked out here. 3,650 K: E. M. Levesque et al. (2005), "The Effective Temperature Scale of Galactic Red Supergiants: Cool, But Not As Cool As We Thought", ApJ 628, 973 (2005ApJ...628..973L). Not used: the 764 Suns of M. Joyce et al. (2020), ApJ 902, 63 (2020ApJ...902...63J), which come from stellar models.
|
|
54
|
+
- **VY Canis Majoris**: 1,420 ± 120 Suns from the Rosseland angular diameter 11.3 ± 0.3 mas at 1.17 ± 0.08 kpc, and 3,490 K, M. Wittkowski et al. (2012), "Fundamental properties and atmospheric structure of the red supergiant VY CMa based on VLTI/AMBER spectro-interferometry", A&A 540, L12 (2012A&A...540L..12W); the distance is the mean of the radio parallaxes of Choi et al. (2008) and B. Zhang et al. (2012), ApJ 744, 23 (2012ApJ...744...23Z).
|
|
55
|
+
- **WOH G64**: 1,540 Suns (an error of 5 percent) and 3,400 ± 25 K, from the spectrum and the brightness at the Large Magellanic Cloud's 50 kpc, E. M. Levesque et al. (2009), "The Physical Properties of the Red Supergiant WOH G64: The Largest Star Known?", AJ 137, 4744 (2009AJ....137.4744L). No angular diameter of the star itself has been measured. Named and not used: 1,730 Suns from a dust model, K. Ohnaka et al. (2008), A&A 484, 371 (2008A&A...484..371O); the star changed between 2009 and 2016, K. Ohnaka et al. (2024), A&A 691, L15 (2024A&A...691L..15O).
|
|
56
|
+
- **UY Scuti**: 1,708 ± 192 Suns from the Rosseland angular diameter 5.48 ± 0.10 mas and 3,365 K, B. Arroyo-Torres et al. (2013), "The atmospheric structure and fundamental parameters of the red supergiants AH Sco, UY Sct and KW Sgr", A&A 554, A76 (2013A&A...554A..76A). The distance of about 2.9 kpc is an old estimate and not a parallax, so the size is marked estimated. Named and not used: 909 Suns, from photometry and a Gaia distance, S. Healy et al. (2024), "Red Supergiant Candidates for Multimessenger Monitoring of the Next Galactic Supernova", MNRAS 529, 3630 (Gaia's value is not copied).
|
|
57
|
+
- **Stephenson 2-18**: 3,200 K and log L = 5.64 (at 5.5 kpc) from a dust-shell fit, T. K. T. Fok et al. (2012), "Maser Observations of Westerlund 1 and Comprehensive Considerations on Maser Properties of Red Supergiants Associated with Massive Clusters", ApJ 760, 65 (2012ApJ...760...65F); the distance is the cluster's kinematic one, S. Deguchi et al. (2010), PASJ 62, 391 (2010PASJ...62..391D), with the range 5.83 (+1.91, -0.78) kpc of B. Davies et al. (2007), ApJ 671, 781 (2007ApJ...671..781D). The radius, 2,150 (+710, -290) Suns, is worked out here by the Stefan-Boltzmann law (the error is the distance's alone). No angular diameter has been measured.
|
|
58
|
+
- **The Earth and Jupiter** beside them are the package's own facts: equatorial radii 6,378.137 km and 71,492 km, IAU and NASA (above).
|
|
59
|
+
|
|
60
|
+
The star's look (the cells, the spots, the glow) is invented to look right and says so; only the temperature, the radius and the class are the papers'.
|
|
61
|
+
|
|
42
62
|
## The Earth
|
|
43
63
|
|
|
44
64
|
The Earth's line drawing is chikyu-earth's own globe (MIT, by John Morris; https://github.com/johnmorrisdotca/chikyu-earth), an optional peer dependency: its own NOTICE.md has the terms of its outlines. The Earth's realistic and painted looks are drawn here, like every other body, from NASA's Blue Marble picture (below).
|
package/README.md
CHANGED
|
@@ -15,9 +15,9 @@ A clean line drawing, a shaded realistic drawing, or a painted surface map, with
|
|
|
15
15
|
|
|
16
16
|
<p align="center"><a href="https://johnmorrisdotca.github.io/wakusei-planets/"><strong>Open the demo →</strong></a> · <a href="https://johnmorrisdotca.github.io/wakusei-planets/embed.html">Embed page</a> · <a href="https://johnmorrisdotca.github.io/wakusei-planets/docs/">Docs</a></p>
|
|
17
17
|
|
|
18
|
-
<p align="center"><img alt="Jupiter and Saturn drawn in the realistic look, and Saturn as a line drawing" src="https://raw.githubusercontent.com/johnmorrisdotca/wakusei-planets/v0.
|
|
18
|
+
<p align="center"><img alt="Jupiter and Saturn drawn in the realistic look, and Saturn as a line drawing" src="https://raw.githubusercontent.com/johnmorrisdotca/wakusei-planets/v0.30.0/docs/images/hero-desk.png" width="640"></p>
|
|
19
19
|
|
|
20
|
-
<p align="center"><img alt="Every body at one scale, the Earth among them: each small body has a magnified picture joined by a line, and the Sun shows only its edge" src="https://raw.githubusercontent.com/johnmorrisdotca/wakusei-planets/v0.
|
|
20
|
+
<p align="center"><img alt="Every body at one scale, the Earth among them: each small body has a magnified picture joined by a line, and the Sun shows only its edge" src="https://raw.githubusercontent.com/johnmorrisdotca/wakusei-planets/v0.30.0/docs/images/lineup-desk.png" width="640"></p>
|
|
21
21
|
|
|
22
22
|
## One minute
|
|
23
23
|
|
|
@@ -107,21 +107,33 @@ Import the element once in client code, and the entry point of each body you dra
|
|
|
107
107
|
|---|---|---|
|
|
108
108
|
| `line` | A clean outline drawing with the body's key features: bands, craters, rings and their gaps, caps, the dark side dashed off. An SVG. | nothing |
|
|
109
109
|
| `realistic` | A shaded sphere drawn from the body's real colours and features, lit from the Sun's side, with the rings casting shadows. No pictures: the surface is worked out in a shader. | `three`, the body's entry point |
|
|
110
|
-
| `painted` | A real surface map from public-domain NASA, USGS and JPL imagery. Small pictures first (1.31 MB for all of them in the package), a sharper one fetched when you zoom in, and finer map tiles for the part in view when you zoom right up (Mars, the Moon, the Earth and ten moons: [close zoom](docs/guides/close-zoom.md)). | `three`, the body's entry point |
|
|
110
|
+
| `painted` | A real surface map from public-domain NASA, USGS and JPL imagery. Small pictures first (1.31 MB for all of them in the package), a sharper one fetched when you zoom in, and finer map tiles for the part in view when you zoom right up, in a body, a portrait or the space view (Mars, the Moon, the Earth and ten moons: [close zoom](docs/guides/close-zoom.md)). | `three`, the body's entry point |
|
|
111
111
|
|
|
112
112
|
Every body has its real size relative to the others (`scale-to="jupiter"`), its axial tilt and its rotation. The Sun, Mercury, Venus, Mars, Jupiter, Saturn, Uranus, Neptune and Pluto are drawn, and so are the eight other dwarf planets (Ceres, Orcus, Haumea, Quaoar, Makemake, Gonggong, Eris and Sedna; Haumea and Quaoar as the long shapes they are, and Ceres with a painted map from Dawn) and 29 moons (the Moon, Phobos and Deimos, the four Galilean moons, Saturn's seven larger moons, Uranus's five, Proteus, Triton and Nereid, Charon, Nix and Hydra, and Vanth, Hiʻiaka, Namaka and Dysnomia, the moons of the dwarf planets whose orbits are published with a date). The Earth is drawn like the rest in the realistic and painted looks (NASA's Blue Marble), and its line look is [chikyu-earth](https://github.com/johnmorrisdotca/chikyu-earth)'s own globe: `import "@johnmorrisdotca/wakusei-planets/earth"` (it needs `@johnmorrisdotca/chikyu-earth` 0.10.0 or later installed). The painted looks cover the Sun, the planets from Mercury to Earth and Pluto, Ceres, the Moon, the four Galilean moons, Saturn's Mimas, Enceladus, Tethys, Dione, Rhea, Titan and Iapetus, Triton and Charon, and Saturn's rings are Cassini's own picture of them.
|
|
113
113
|
|
|
114
114
|
## A star from its numbers
|
|
115
115
|
|
|
116
|
-
`<wakusei-body star="Betelgeuse" temperature-k="
|
|
116
|
+
`<wakusei-body star="Betelgeuse" temperature-k="3650" radius-sun="1057" luminosity-class="Iab">` draws any star in 3D or as a line drawing, from a few numbers and with no catalogue: the temperature gives the colour, the radius the size beside the Sun, the luminosity class the grain of the surface, the rotation how it turns, and a flattened star such as Vega or Altair is squashed with hotter poles. Granulation boils, an active star has spots, prominences and flares, and a soft corona glows round it, all through the same shared renderer, with a cheaper `quality="low"` for weak devices. Every star says which parts are measured and which are drawn for looks: *drawn from its numbers, not a photo*. The Sun keeps its own look. See [A star from its numbers](docs/guides/star-look.md) and the [star page](https://johnmorrisdotca.github.io/wakusei-planets/star.html).
|
|
117
117
|
|
|
118
118
|
```ts
|
|
119
119
|
import { starLook } from "@johnmorrisdotca/wakusei-planets";
|
|
120
120
|
|
|
121
|
-
const vega = starLook({ name: "Vega", temperatureK:
|
|
121
|
+
const vega = starLook({ name: "Vega", temperatureK: 9660, radiusSun: 2.726, oblateness: 0.113, rotationDays: 0.71 });
|
|
122
122
|
console.log(vega.colour, vega.parts.map((part) => part.status).join(", "));
|
|
123
123
|
```
|
|
124
124
|
|
|
125
|
+
## The size line-up
|
|
126
|
+
|
|
127
|
+
`<wakusei-lineup stars="bright" planets at="betelgeuse">` shows the Sun, Sirius A, Vega, Arcturus, Aldebaran, Rigel, Antares, Betelgeuse and the largest stars known (VY Canis Majoris, WOH G64, UY Scuti, Stephenson 2-18) side by side or one above the next at **true relative size**, each drawn with the star look and labelled with its radius in Suns and kilometres, its error and its paper. A slider zooms smoothly from the Sun (or the Earth, with `planets`) up to the largest star; each star turns slowly and a drag turns the one it takes hold of. Every radius is from a refereed paper that measured the star's angular diameter, or says it did not (WOH G64 and Stephenson 2-18 are estimated from brightness, UY Scuti's distance is not a parallax); where the papers disagree, the label and [the guide](docs/guides/size-lineup.md) say so. The demo's [size line-up page](https://johnmorrisdotca.github.io/wakusei-planets/lineup.html) saves the picture as a PNG or SVG, prints it as a poster on A4 or US Letter, and writes the code for every way of putting it in a page. The table needs no browser:
|
|
128
|
+
|
|
129
|
+
```ts
|
|
130
|
+
import { lineupBodies, lineupText } from "@johnmorrisdotca/wakusei-planets";
|
|
131
|
+
|
|
132
|
+
const largest = lineupBodies({ set: "largest" }).at(-1)!;
|
|
133
|
+
const text = lineupText(largest, "en");
|
|
134
|
+
console.log(`${text.name}: ${text.radius}, ${text.km}, ${text.source}`);
|
|
135
|
+
```
|
|
136
|
+
|
|
125
137
|
## Two packages: this one and chikyu-earth
|
|
126
138
|
|
|
127
139
|
This package is the Sun, the planets, the dwarf planets and the moons, and where they are. [chikyu-earth](https://github.com/johnmorrisdotca/chikyu-earth) is the Earth in detail: its countries, day and night, places and satellites. Each works alone; install both and the Earth's line look becomes chikyu-earth's globe with the countries. The dependency runs one way: this package may use chikyu-earth, never the reverse. [Why two packages](docs/guides/two-packages.md) has the rule, a table of what lives where and how to use them together.
|
|
@@ -180,7 +192,7 @@ A page full of bodies stays light: one WebGL context for the page through kazoku
|
|
|
180
192
|
| `size` | The width in pixels. | `320` |
|
|
181
193
|
| `time` | `now` or an ISO date: the body as the Earth sees it then. Left out, a portrait. | portrait |
|
|
182
194
|
| `moons` | A planet with its moons on their orbits (with a date). | off |
|
|
183
|
-
| `rate` | Simulated seconds for each real second. | `1` |
|
|
195
|
+
| `rate` | Simulated seconds for each real second; `0` holds the clock and draws nothing. A dated picture sends `wakusei-timechange` (`{ time, running }`) while the clock runs and once when it holds. | `1` |
|
|
184
196
|
| `turn` | A portrait turns this many degrees a second. | `0` |
|
|
185
197
|
| `tilt`, `pitch`, `phase`, `meridian` | A portrait's pose in degrees. | the body's own |
|
|
186
198
|
| `scale-to` | Draw to scale with another body. | fills its box |
|
|
@@ -290,7 +302,7 @@ A body that turns by itself and a moving sky, in HTML:
|
|
|
290
302
|
|
|
291
303
|
## The portrait builder
|
|
292
304
|
|
|
293
|
-
<p align="center"><img alt="The Sun and the planets in an arc, painted, with their names, in the portrait builder" src="https://raw.githubusercontent.com/johnmorrisdotca/wakusei-planets/v0.
|
|
305
|
+
<p align="center"><img alt="The Sun and the planets in an arc, painted, with their names, in the portrait builder" src="https://raw.githubusercontent.com/johnmorrisdotca/wakusei-planets/v0.30.0/docs/images/portrait-family.png" width="640"></p>
|
|
294
306
|
|
|
295
307
|
[The portrait builder](https://johnmorrisdotca.github.io/wakusei-planets/portrait.html) puts any bodies in one picture: drag them, size them, turn them, order them front to back, arrange them in a row, an arc, a grid or at true orbit distance (true or readable sizes, a planet's moons round it in orbit order), light them from one direction, and take the code, a PNG or an SVG. The scene is kept in the address, and every body is drawn in one WebGL scene, so the page holds one WebGL context. [The portrait builder](docs/guides/portrait-builder.md) is its guide.
|
|
296
308
|
|
|
@@ -341,7 +353,7 @@ The reference is a site, made from the source's own doc comments: every export h
|
|
|
341
353
|
|
|
342
354
|
| Entry point | What it gives |
|
|
343
355
|
| --- | --- |
|
|
344
|
-
| `@johnmorrisdotca/wakusei-planets` | The pure side: `BODIES`, `apparent`, `system`, `orbitPath`, `portrait`, `lineSvg`, `embedCode`, `starLook`, `starLineSvg`. No browser. |
|
|
356
|
+
| `@johnmorrisdotca/wakusei-planets` | The pure side: `BODIES`, `apparent`, `system`, `orbitPath`, `portrait`, `lineSvg`, `embedCode`, `lineupCode`, `lineupBodies`, `starLook`, `starLineSvg`. No browser. |
|
|
345
357
|
| `.../element` | `<wakusei-body>`; three.js is loaded only for a shaded look. |
|
|
346
358
|
| `.../portrait` | `<wakusei-portrait>`: many bodies in one scene. The scene model (`addBody`, `layoutPortrait`, `encodeScene`, `decodeScene`) is in the main entry. |
|
|
347
359
|
| `.../space` | Where the Sun, the Moon and the planets are for a date, in two scales, and where a camera riding along looks: `frameAt`, `createTrack`, `placeSun`, `placeAround`, `ridePose`. No browser. |
|
|
@@ -377,6 +389,7 @@ Each guide has a Japanese twin in [docs/guides/ja](docs/guides/ja/getting-starte
|
|
|
377
389
|
| [Moons and time](docs/guides/moons-and-time.md) | The sky on a date, time that runs fast |
|
|
378
390
|
| [The space view](docs/guides/space-view.md) | The Earth, Moon, Sun and planets in their places; two scales; time both ways |
|
|
379
391
|
| [A star from its numbers](docs/guides/star-look.md) | Any star in 3D or as lines, what is measured and what is drawn, every way to put it in a page |
|
|
392
|
+
| [The size line-up](docs/guides/size-lineup.md) | The Sun and the largest stars at true relative size, with each radius, its error and its paper, where the papers disagree, every way to put it in a page |
|
|
380
393
|
| [Zoom and pan](docs/guides/zoom-and-pan.md) | Every view zooms and moves by itself: the range of each and why it ends there, the bar, the embed page |
|
|
381
394
|
| [Close zoom and map tiles](docs/guides/close-zoom.md) | How far each body zooms and why, the finer map tiles for a close zoom (made from public-domain maps, served beside the demo, never in the package), the generic detail, what it costs |
|
|
382
395
|
| [Riding along](docs/guides/ride-along.md) | The camera on a moon, a planet or any moving point, looking at what it goes round |
|
package/dist/element.d.ts
CHANGED
|
@@ -31,6 +31,9 @@ export type WakuseiState = "line" | "loading" | "still" | "live" | "lost" | "una
|
|
|
31
31
|
* `controls="none"` turns them off, and `live="off"` (a still, a thumbnail) starts without them (`controls` with no value brings them back). `zoom-min` and `zoom-max` set the range (0.1 to 50 for the line drawing; for the shaded looks 0.1 up to where the body's detail runs out, 8 at least and 1000 at most: see the close zoom guide); a `<kazoku-view-controls for="...">` takes over and reads it.
|
|
32
32
|
* Close up, `tiles` is where the finer map tiles are (a folder address; `off` for none; by default the demo site's, unless `texture-base` names your own pictures): a window of them is laid over the painted map for the part in view and let go when it is not, and the zoom range of a body with tiles grows with them.
|
|
33
33
|
* Whatever moves the view, `setView` sends a `wakusei-view` event with its `yaw`, `tilt`, `roll`, `zoom`, `panX` and `panY`.
|
|
34
|
+
* A dated picture (a `time`, or `moons`) has a clock: `rate` is the simulated seconds for each real second, and `rate="0"` holds it, drawing nothing. While it runs (`rate` not 0), `wakusei-timechange` carries
|
|
35
|
+
* `detail: { time, running: true }` (`time` is the moment shown in milliseconds since 1970; four times a second, once a second at real time; only while the tab is shown, whether or not the picture is on screen), and once with
|
|
36
|
+
* `running: false` when the clock is held: a page writes the date into its date box from it. The `time` property reads the moment shown, and `undefined` for a portrait with no date.
|
|
34
37
|
*
|
|
35
38
|
* @example
|
|
36
39
|
* ```ts no-run
|
|
@@ -46,6 +49,8 @@ export type WakuseiState = "line" | "loading" | "still" | "live" | "lost" | "una
|
|
|
46
49
|
export declare class WakuseiBody extends HTMLElement {
|
|
47
50
|
#private;
|
|
48
51
|
static observedAttributes: string[];
|
|
52
|
+
/** The moment the dated picture shows, in milliseconds since 1970, or `undefined` for a portrait with no date. */
|
|
53
|
+
get time(): number | undefined;
|
|
49
54
|
/** The radius of the body's disc on the screen in CSS pixels, at the picture's own size: what `grab-radius` on the shared view controls wants for a drag that keeps the touched point under the pointer. */
|
|
50
55
|
get discRadius(): number;
|
|
51
56
|
get body(): BodyId;
|
package/dist/element.js
CHANGED
|
@@ -76,6 +76,9 @@ const TEMPLATE = `<style>
|
|
|
76
76
|
* `controls="none"` turns them off, and `live="off"` (a still, a thumbnail) starts without them (`controls` with no value brings them back). `zoom-min` and `zoom-max` set the range (0.1 to 50 for the line drawing; for the shaded looks 0.1 up to where the body's detail runs out, 8 at least and 1000 at most: see the close zoom guide); a `<kazoku-view-controls for="...">` takes over and reads it.
|
|
77
77
|
* Close up, `tiles` is where the finer map tiles are (a folder address; `off` for none; by default the demo site's, unless `texture-base` names your own pictures): a window of them is laid over the painted map for the part in view and let go when it is not, and the zoom range of a body with tiles grows with them.
|
|
78
78
|
* Whatever moves the view, `setView` sends a `wakusei-view` event with its `yaw`, `tilt`, `roll`, `zoom`, `panX` and `panY`.
|
|
79
|
+
* A dated picture (a `time`, or `moons`) has a clock: `rate` is the simulated seconds for each real second, and `rate="0"` holds it, drawing nothing. While it runs (`rate` not 0), `wakusei-timechange` carries
|
|
80
|
+
* `detail: { time, running: true }` (`time` is the moment shown in milliseconds since 1970; four times a second, once a second at real time; only while the tab is shown, whether or not the picture is on screen), and once with
|
|
81
|
+
* `running: false` when the clock is held: a page writes the date into its date box from it. The `time` property reads the moment shown, and `undefined` for a portrait with no date.
|
|
79
82
|
*
|
|
80
83
|
* @example
|
|
81
84
|
* ```ts no-run
|
|
@@ -104,6 +107,8 @@ export class WakuseiBody extends HTMLElement {
|
|
|
104
107
|
#visible = typeof IntersectionObserver !== "function";
|
|
105
108
|
#io;
|
|
106
109
|
#tick;
|
|
110
|
+
#clockTimer;
|
|
111
|
+
#clockRan = false;
|
|
107
112
|
#refreshQueued = false;
|
|
108
113
|
#gate;
|
|
109
114
|
#live = createLive();
|
|
@@ -142,7 +147,13 @@ export class WakuseiBody extends HTMLElement {
|
|
|
142
147
|
this.#stopTick();
|
|
143
148
|
else
|
|
144
149
|
this.#resume();
|
|
150
|
+
this.#syncClock();
|
|
145
151
|
};
|
|
152
|
+
/** The moment the dated picture shows, in milliseconds since 1970, or `undefined` for a portrait with no date. */
|
|
153
|
+
get time() {
|
|
154
|
+
const r = this.#request();
|
|
155
|
+
return r.start === undefined ? undefined : r.start + (performance.now() - r.startedAt) * r.rate;
|
|
156
|
+
}
|
|
146
157
|
/** The radius of the body's disc on the screen in CSS pixels, at the picture's own size: what `grab-radius` on the shared view controls wants for a drag that keeps the touched point under the pointer. */
|
|
147
158
|
get discRadius() {
|
|
148
159
|
const { width, height } = this.getBoundingClientRect();
|
|
@@ -209,6 +220,7 @@ export class WakuseiBody extends HTMLElement {
|
|
|
209
220
|
this.#io.observe(this);
|
|
210
221
|
}
|
|
211
222
|
document.addEventListener("visibilitychange", this.#onHidden);
|
|
223
|
+
this.#syncClock();
|
|
212
224
|
this.#unsub = onRegister(() => {
|
|
213
225
|
this.#carry();
|
|
214
226
|
this.#queue();
|
|
@@ -220,6 +232,8 @@ export class WakuseiBody extends HTMLElement {
|
|
|
220
232
|
this.#queue();
|
|
221
233
|
}
|
|
222
234
|
disconnectedCallback() {
|
|
235
|
+
clearTimeout(this.#clockTimer);
|
|
236
|
+
this.#clockTimer = undefined;
|
|
223
237
|
this.#stopTick();
|
|
224
238
|
this.#gate?.cancel();
|
|
225
239
|
this.#io?.disconnect();
|
|
@@ -236,8 +250,10 @@ export class WakuseiBody extends HTMLElement {
|
|
|
236
250
|
attributeChangedCallback(name) {
|
|
237
251
|
if (!this.isConnected)
|
|
238
252
|
return;
|
|
239
|
-
if (name === "time" || name === "rate")
|
|
253
|
+
if (name === "time" || name === "rate") {
|
|
240
254
|
this.#clockFromAttributes();
|
|
255
|
+
this.#syncClock(true);
|
|
256
|
+
}
|
|
241
257
|
if (name === "live")
|
|
242
258
|
this.#applyHover();
|
|
243
259
|
if (name === "live" || name === "look" || name === "body")
|
|
@@ -368,6 +384,33 @@ export class WakuseiBody extends HTMLElement {
|
|
|
368
384
|
this.#startedAt = performance.now();
|
|
369
385
|
this.#start = t === "now" ? Date.now() : t;
|
|
370
386
|
}
|
|
387
|
+
/**
|
|
388
|
+
* Tell the page the moment shown while a dated clock runs (`rate` not 0): `wakusei-timechange` with `{ time, running: true }` four times a second (once a second at real time), only while the
|
|
389
|
+
* tab is shown (the date box is often below the picture), and once with `running: false` when the clock holds. `loud` says the clock was just set (a new `time` or `rate`), so a hold is announced.
|
|
390
|
+
*/
|
|
391
|
+
#syncClock(loud = false) {
|
|
392
|
+
clearTimeout(this.#clockTimer);
|
|
393
|
+
this.#clockTimer = undefined;
|
|
394
|
+
const r = this.#request();
|
|
395
|
+
const dated = r.start !== undefined;
|
|
396
|
+
const running = dated && r.rate !== 0;
|
|
397
|
+
if (!this.isConnected)
|
|
398
|
+
return;
|
|
399
|
+
if (!running) {
|
|
400
|
+
if (loud && dated && this.#clockRan)
|
|
401
|
+
this.dispatchEvent(new CustomEvent("wakusei-timechange", { detail: { time: this.time, running: false } }));
|
|
402
|
+
this.#clockRan = false;
|
|
403
|
+
return;
|
|
404
|
+
}
|
|
405
|
+
this.#clockRan = true;
|
|
406
|
+
if (document.visibilityState === "hidden")
|
|
407
|
+
return;
|
|
408
|
+
const step = () => {
|
|
409
|
+
this.dispatchEvent(new CustomEvent("wakusei-timechange", { detail: { time: this.time, running: true } }));
|
|
410
|
+
this.#clockTimer = setTimeout(step, Math.abs(this.#request().rate) === 1 ? 1000 : 250);
|
|
411
|
+
};
|
|
412
|
+
step();
|
|
413
|
+
}
|
|
371
414
|
#request() {
|
|
372
415
|
const star = this.#star();
|
|
373
416
|
const moons = this.hasAttribute("moons") && !this.hasAttribute("star");
|
|
@@ -386,10 +429,10 @@ export class WakuseiBody extends HTMLElement {
|
|
|
386
429
|
turn: (this.hasAttribute("turn") ? num(this.getAttribute("turn"), 0) : this.getAttribute("live") === "off" ? 0 : star !== undefined ? star.turn.degreesPerSecond : defaultTurn(this.body)) * (this.#reduce ? REDUCED_TURN : 1),
|
|
387
430
|
};
|
|
388
431
|
}
|
|
389
|
-
/** The picture moves on its own: a turn, or time running faster than the clock. */
|
|
432
|
+
/** The picture moves on its own: a turn, or time running faster (or backwards) than the clock. A held clock (`rate="0"`) moves nothing. */
|
|
390
433
|
get #moving() {
|
|
391
434
|
const r = this.#request();
|
|
392
|
-
const turning = r.turn !== 0 || (r.start !== undefined && r.rate !== 1);
|
|
435
|
+
const turning = r.turn !== 0 || (r.start !== undefined && r.rate !== 1 && r.rate !== 0);
|
|
393
436
|
return this.#reduce ? r.turn !== 0 : turning;
|
|
394
437
|
}
|
|
395
438
|
// --- the state of the scene --------------------------------------------------------------------------------------------------------------------
|
package/dist/embed.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { type BodyId, type Look } from "./facts.ts";
|
|
2
|
+
import type { LineupSet } from "./lineup/data.ts";
|
|
3
|
+
import type { LineupLayout } from "./lineup/layout.ts";
|
|
2
4
|
import type { StarNumbers } from "./star.ts";
|
|
3
5
|
/**
|
|
4
6
|
* The ways `embedCode` writes a body into a page.
|
|
@@ -119,6 +121,68 @@ export interface PortraitEmbed {
|
|
|
119
121
|
* ```
|
|
120
122
|
*/
|
|
121
123
|
export declare function portraitCode(options: PortraitEmbed, kind?: EmbedKind, settings?: EmbedSettings): string;
|
|
124
|
+
/**
|
|
125
|
+
* The size line-up to put in a page: which stars, the planets, how they stand, where the camera starts, and how wide it is.
|
|
126
|
+
*
|
|
127
|
+
* @example
|
|
128
|
+
* ```ts
|
|
129
|
+
* import { lineupCode, type LineupEmbed } from "@johnmorrisdotca/wakusei-planets";
|
|
130
|
+
*
|
|
131
|
+
* const options: LineupEmbed = { stars: "bright", planets: true, at: "betelgeuse", width: 720 };
|
|
132
|
+
* console.log(lineupCode(options, "html"));
|
|
133
|
+
* ```
|
|
134
|
+
*/
|
|
135
|
+
export interface LineupEmbed {
|
|
136
|
+
/** `all` (the default), `bright` or `largest`, or a list of ids from `LINEUP_STARS`. */
|
|
137
|
+
stars?: LineupSet | readonly string[];
|
|
138
|
+
/** Add the Earth and Jupiter. */
|
|
139
|
+
planets?: boolean;
|
|
140
|
+
/** `row` (the default) or `stack`. */
|
|
141
|
+
layout?: LineupLayout;
|
|
142
|
+
/** The id of the body the camera starts on; the Sun when left out. */
|
|
143
|
+
at?: string;
|
|
144
|
+
/** Where the camera starts, 0 to 1 (over `at`). */
|
|
145
|
+
zoom?: number;
|
|
146
|
+
/** False stops the bodies turning by themselves. */
|
|
147
|
+
turn?: boolean;
|
|
148
|
+
/** The planets' look: `realistic` (the default) or `painted`. */
|
|
149
|
+
look?: "realistic" | "painted";
|
|
150
|
+
/** The words: `en` (the default) or `ja`. */
|
|
151
|
+
lang?: "en" | "ja";
|
|
152
|
+
/** Pixels across; default 720. */
|
|
153
|
+
width?: number;
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* The text that puts the size line-up in a page, for each way a page is made, as `embedCode` does for a single body: a script tag, an ES module, React, Vue, Angular, Svelte or an iframe of the demo's `embed.html`.
|
|
157
|
+
* Every way is built, parsed or run by the package's tests.
|
|
158
|
+
*
|
|
159
|
+
* @param options - The stars, the planets, the layout, where the camera starts and the width.
|
|
160
|
+
* @param kind - The way the page is made; `html` by default.
|
|
161
|
+
* @param settings - The CDN and the demo's address, when they are not the package's own.
|
|
162
|
+
* @returns The text to paste into the page's source.
|
|
163
|
+
*
|
|
164
|
+
* @example
|
|
165
|
+
* ```ts
|
|
166
|
+
* import { lineupCode } from "@johnmorrisdotca/wakusei-planets";
|
|
167
|
+
*
|
|
168
|
+
* console.log(lineupCode({ stars: "largest", at: "vy-canis-majoris" }, "react"));
|
|
169
|
+
* ```
|
|
170
|
+
*/
|
|
171
|
+
export declare function lineupCode(options: LineupEmbed, kind?: EmbedKind, settings?: EmbedSettings): string;
|
|
172
|
+
/**
|
|
173
|
+
* The credits that travel with a picture of the size line-up: the radii are from refereed papers, the stars are drawn from numbers and not photographs, and the planets' sizes are the IAU's and NASA's.
|
|
174
|
+
*
|
|
175
|
+
* @param options - The choices, so the planets and their pictures are named only when they are used.
|
|
176
|
+
* @returns A short line of credit to put near the picture.
|
|
177
|
+
*
|
|
178
|
+
* @example
|
|
179
|
+
* ```ts
|
|
180
|
+
* import { lineupCredit } from "@johnmorrisdotca/wakusei-planets";
|
|
181
|
+
*
|
|
182
|
+
* console.log(lineupCredit({ planets: true }));
|
|
183
|
+
* ```
|
|
184
|
+
*/
|
|
185
|
+
export declare function lineupCredit(options: LineupEmbed): string;
|
|
122
186
|
/**
|
|
123
187
|
* The credits that travel with a picture of a body: the line and illustrated looks are drawn from numbers, and `realistic` and `painted` use the surface maps.
|
|
124
188
|
*
|
package/dist/embed.js
CHANGED
|
@@ -127,6 +127,72 @@ export function portraitCode(options, kind = "html", settings = {}) {
|
|
|
127
127
|
attrs.push(["size", String(width)]);
|
|
128
128
|
return snippet(kind, { tag: "wakusei-portrait", element: "portrait", entries, attrs, name: "portrait", iframe: { src: `${site}embed.html?${new URLSearchParams({ scene: options.scene }).toString()}`, title: "Wakusei Planets portrait", width, height: Math.round(width / scene.aspect) } }, cdn);
|
|
129
129
|
}
|
|
130
|
+
/** The element's attributes for a line-up, in the order they are written. */
|
|
131
|
+
function lineupAttributes(o) {
|
|
132
|
+
const out = [];
|
|
133
|
+
const stars = o.stars === undefined || o.stars === "all" ? undefined : typeof o.stars === "string" ? o.stars : o.stars.join(",");
|
|
134
|
+
if (stars !== undefined)
|
|
135
|
+
out.push(["stars", stars]);
|
|
136
|
+
if (o.planets === true)
|
|
137
|
+
out.push(["planets", ""]);
|
|
138
|
+
if (o.layout === "stack")
|
|
139
|
+
out.push(["layout", "stack"]);
|
|
140
|
+
if (o.zoom !== undefined && Number.isFinite(o.zoom))
|
|
141
|
+
out.push(["zoom", String(Math.round(o.zoom * 1000) / 1000)]);
|
|
142
|
+
else if (o.at !== undefined && o.at !== "sun")
|
|
143
|
+
out.push(["at", o.at]);
|
|
144
|
+
if (o.turn === false)
|
|
145
|
+
out.push(["turn", "off"]);
|
|
146
|
+
if (o.look === "painted")
|
|
147
|
+
out.push(["look", "painted"]);
|
|
148
|
+
if (o.lang === "ja")
|
|
149
|
+
out.push(["lang", "ja"]);
|
|
150
|
+
if (o.width !== undefined && o.width !== 720)
|
|
151
|
+
out.push(["size", String(o.width)]);
|
|
152
|
+
return out;
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* The text that puts the size line-up in a page, for each way a page is made, as `embedCode` does for a single body: a script tag, an ES module, React, Vue, Angular, Svelte or an iframe of the demo's `embed.html`.
|
|
156
|
+
* Every way is built, parsed or run by the package's tests.
|
|
157
|
+
*
|
|
158
|
+
* @param options - The stars, the planets, the layout, where the camera starts and the width.
|
|
159
|
+
* @param kind - The way the page is made; `html` by default.
|
|
160
|
+
* @param settings - The CDN and the demo's address, when they are not the package's own.
|
|
161
|
+
* @returns The text to paste into the page's source.
|
|
162
|
+
*
|
|
163
|
+
* @example
|
|
164
|
+
* ```ts
|
|
165
|
+
* import { lineupCode } from "@johnmorrisdotca/wakusei-planets";
|
|
166
|
+
*
|
|
167
|
+
* console.log(lineupCode({ stars: "largest", at: "vy-canis-majoris" }, "react"));
|
|
168
|
+
* ```
|
|
169
|
+
*/
|
|
170
|
+
export function lineupCode(options, kind = "html", settings = {}) {
|
|
171
|
+
const cdn = settings.cdn ?? CDN;
|
|
172
|
+
const site = settings.site ?? SITE;
|
|
173
|
+
const width = options.width ?? 720;
|
|
174
|
+
const attrs = lineupAttributes(options);
|
|
175
|
+
const query = new URLSearchParams([["lineup", "1"], ...attrs.map(([name, value]) => [name, name === "planets" ? "1" : value])]);
|
|
176
|
+
return snippet(kind, { tag: "wakusei-lineup", element: "lineup", entries: [], attrs, name: "lineup", iframe: { src: `${site}embed.html?${query.toString()}`, title: "Wakusei Planets size line-up", width, height: Math.round((width * 9) / 16) } }, cdn);
|
|
177
|
+
}
|
|
178
|
+
/**
|
|
179
|
+
* The credits that travel with a picture of the size line-up: the radii are from refereed papers, the stars are drawn from numbers and not photographs, and the planets' sizes are the IAU's and NASA's.
|
|
180
|
+
*
|
|
181
|
+
* @param options - The choices, so the planets and their pictures are named only when they are used.
|
|
182
|
+
* @returns A short line of credit to put near the picture.
|
|
183
|
+
*
|
|
184
|
+
* @example
|
|
185
|
+
* ```ts
|
|
186
|
+
* import { lineupCredit } from "@johnmorrisdotca/wakusei-planets";
|
|
187
|
+
*
|
|
188
|
+
* console.log(lineupCredit({ planets: true }));
|
|
189
|
+
* ```
|
|
190
|
+
*/
|
|
191
|
+
export function lineupCredit(options) {
|
|
192
|
+
const base = "Wakusei Planets by John Morris (MIT). Sizes at true relative scale; each star's radius is from a refereed paper that measured its angular diameter (sources and disagreements in the package's NOTICE.md). The stars are drawn from their numbers, not photographs: the cells, spots and glow are illustrative.";
|
|
193
|
+
const planets = options.planets === true ? " Earth and Jupiter: IAU and NASA sizes." + (options.look === "painted" ? " Surface pictures: NASA and Nestaeric (CC BY 4.0), see NOTICE.md." : "") : "";
|
|
194
|
+
return `${base}${planets}`;
|
|
195
|
+
}
|
|
130
196
|
/**
|
|
131
197
|
* The credits that travel with a picture of a body: the line and illustrated looks are drawn from numbers, and `realistic` and `painted` use the surface maps.
|
|
132
198
|
*
|
package/dist/index.d.ts
CHANGED
|
@@ -4,7 +4,10 @@ export { JOURNEY_STOPS, journeyStop, stopPlaceAu, type JourneyStop } from "./sto
|
|
|
4
4
|
export { drawnTilt, portrait, type PortraitOptions } from "./pose.ts";
|
|
5
5
|
export { lineSvg, mix, type LineOptions } from "./line.ts";
|
|
6
6
|
export { ringStrip, type RingStrip } from "./scene/rings.ts";
|
|
7
|
-
export { embedCode, embedCredit, EMBED_KINDS, portraitCode, type EmbedKind, type EmbedOptions, type EmbedSettings, type PortraitEmbed } from "./embed.ts";
|
|
7
|
+
export { embedCode, embedCredit, EMBED_KINDS, lineupCode, lineupCredit, portraitCode, type EmbedKind, type EmbedOptions, type EmbedSettings, type LineupEmbed, type PortraitEmbed } from "./embed.ts";
|
|
8
8
|
export { addBody, decodeScene, defaultPortrait, encodeScene, PRESETS as PORTRAIT_PRESETS, resolve as layoutPortrait, type Item as PortraitItem, type Placed as PlacedItem, type Portrait, type Preset as PortraitPreset, type Resolved as PortraitLayout } from "./portrait/model.ts";
|
|
9
9
|
export { LUMINOSITY_CLASSES, STAR_SUN, starLook, type LuminosityClass, type StarLook, type StarNumberName, type StarNumbers, type StarPart, type StarStatus } from "./star.ts";
|
|
10
10
|
export { starLineSvg } from "./star-line.ts";
|
|
11
|
+
export { LINEUP_SETS, LINEUP_STARS, lineupBodies, type LineupBody, type LineupSet, type RadiusBasis, type RadiusRow } from "./lineup/data.ts";
|
|
12
|
+
export { LINEUP_LAYOUTS, lineupFocus, lineupProject, lineupView, lineupZoomFor, lineupZoomOf, placeLineup, type LineupDot, type LineupLayout, type LineupPlace, type LineupView } from "./lineup/layout.ts";
|
|
13
|
+
export { lineupKm, lineupLabels, lineupLabelsSvg, lineupText, type LineupLabel, type LineupLang, type LineupText } from "./lineup/labels.ts";
|
package/dist/index.js
CHANGED
|
@@ -4,7 +4,10 @@ export { JOURNEY_STOPS, journeyStop, stopPlaceAu } from "./stops.js";
|
|
|
4
4
|
export { drawnTilt, portrait } from "./pose.js";
|
|
5
5
|
export { lineSvg, mix } from "./line.js";
|
|
6
6
|
export { ringStrip } from "./scene/rings.js";
|
|
7
|
-
export { embedCode, embedCredit, EMBED_KINDS, portraitCode } from "./embed.js";
|
|
7
|
+
export { embedCode, embedCredit, EMBED_KINDS, lineupCode, lineupCredit, portraitCode } from "./embed.js";
|
|
8
8
|
export { addBody, decodeScene, defaultPortrait, encodeScene, PRESETS as PORTRAIT_PRESETS, resolve as layoutPortrait } from "./portrait/model.js";
|
|
9
9
|
export { LUMINOSITY_CLASSES, STAR_SUN, starLook } from "./star.js";
|
|
10
10
|
export { starLineSvg } from "./star-line.js";
|
|
11
|
+
export { LINEUP_SETS, LINEUP_STARS, lineupBodies } from "./lineup/data.js";
|
|
12
|
+
export { LINEUP_LAYOUTS, lineupFocus, lineupProject, lineupView, lineupZoomFor, lineupZoomOf, placeLineup } from "./lineup/layout.js";
|
|
13
|
+
export { lineupKm, lineupLabels, lineupLabelsSvg, lineupText } from "./lineup/labels.js";
|
package/dist/kids/picture.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { type BodyId } from "../facts.ts";
|
|
2
2
|
import type { Pose } from "../ephemeris.ts";
|
|
3
3
|
/** The thickness of the outline of a body and of every line inside it, in millimetres. */
|
|
4
|
-
export declare const OUTLINE_MM =
|
|
5
|
-
export declare const LINE_MM =
|
|
4
|
+
export declare const OUTLINE_MM = 1.2;
|
|
5
|
+
export declare const LINE_MM = 1;
|
|
6
6
|
export interface Art {
|
|
7
7
|
/** The SVG markup, to put inside an `<svg>` measured in millimetres. */
|
|
8
8
|
markup: string;
|
|
@@ -18,8 +18,8 @@ export declare function reach(id: BodyId, pose?: Pose): {
|
|
|
18
18
|
y: number;
|
|
19
19
|
};
|
|
20
20
|
/**
|
|
21
|
-
* A body as a colouring picture: thick black outlines on white (the outline
|
|
22
|
-
* millimetres for the body's radius. `outline` is the outline's thickness; the lines inside are
|
|
21
|
+
* A body as a colouring picture: thick black outlines on white (the outline 1.2 mm, every line inside 1 mm), its big features, its rings, and the Sun's rays. The picture is drawn at its centre `(cx, cy)` with `r`
|
|
22
|
+
* millimetres for the body's radius. `outline` is the outline's thickness; the lines inside are 1 mm or, for a thinner outline, a little less.
|
|
23
23
|
* @param id - The body's name.
|
|
24
24
|
* @param cx - The centre's place, in millimetres.
|
|
25
25
|
* @param cy - The centre's place, in millimetres.
|
package/dist/kids/picture.js
CHANGED
|
@@ -5,8 +5,8 @@ import { cross, RAD, DEG } from "../vec.js";
|
|
|
5
5
|
import { facing, portrait, silhouette, surfacePoint } from "../pose.js";
|
|
6
6
|
import { OWN_FEATURES } from "./land.js";
|
|
7
7
|
/** The thickness of the outline of a body and of every line inside it, in millimetres. */
|
|
8
|
-
export const OUTLINE_MM =
|
|
9
|
-
export const LINE_MM =
|
|
8
|
+
export const OUTLINE_MM = 1.2;
|
|
9
|
+
export const LINE_MM = 1;
|
|
10
10
|
/** The smallest radius of a shape to colour, in millimetres, and the least between two lines. */
|
|
11
11
|
const MIN_SHAPE_MM = 8;
|
|
12
12
|
const MIN_GAP_MM = 12;
|
|
@@ -209,8 +209,8 @@ function rays(frame, line) {
|
|
|
209
209
|
return stroke(parts.join(""), line);
|
|
210
210
|
}
|
|
211
211
|
/**
|
|
212
|
-
* A body as a colouring picture: thick black outlines on white (the outline
|
|
213
|
-
* millimetres for the body's radius. `outline` is the outline's thickness; the lines inside are
|
|
212
|
+
* A body as a colouring picture: thick black outlines on white (the outline 1.2 mm, every line inside 1 mm), its big features, its rings, and the Sun's rays. The picture is drawn at its centre `(cx, cy)` with `r`
|
|
213
|
+
* millimetres for the body's radius. `outline` is the outline's thickness; the lines inside are 1 mm or, for a thinner outline, a little less.
|
|
214
214
|
* @param id - The body's name.
|
|
215
215
|
* @param cx - The centre's place, in millimetres.
|
|
216
216
|
* @param cy - The centre's place, in millimetres.
|