@johnmorrisdotca/chikyu-earth 0.63.0 → 0.65.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 +15 -0
- package/README.md +2 -2
- package/dist/space/compass.d.ts +82 -3
- package/dist/space/compass.js +72 -3
- package/dist/space/element-base.d.ts +33 -2
- package/dist/space/element-base.js +51 -4
- package/dist/space/index.d.ts +2 -0
- package/dist/space/index.js +2 -0
- package/dist/space/ride-glide.d.ts +78 -0
- package/dist/space/ride-glide.js +112 -0
- package/dist/space/scene.d.ts +5 -1
- package/dist/space/scene.js +14 -5
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,21 @@
|
|
|
2
2
|
|
|
3
3
|
## Unreleased
|
|
4
4
|
|
|
5
|
+
- **The page chooses where a ride's compass goes** (MODULES-1732). The compass was fixed in the top-left corner, 8 pixels in, so a page with a card at the top left had to start it about 85 pixels lower to clear the compass. Two attributes, each with a property, now place it. With neither set the compass is where it always was.
|
|
6
|
+
- **`compass-place`** (property `compassPlace`): `top-left` (the default), `top-right`, `bottom-left` or `bottom-right`. A value that is not one of the four reads as `top-left`.
|
|
7
|
+
- **`compass-offset`** (property `compassOffset`, `{ x, y }`): pixels in from that corner, written `x,y` (`x` from the side, `y` from the top or the bottom, such as `16,96`) or as one number for both; 8,8 by default. A value that is not one or two numbers of 0 or more reads as `8,8`. Each attribute is read by itself.
|
|
8
|
+
- **Live and inside.** Setting either while riding moves the compass at once. It is held inside the picture on every side: an offset larger than the room the picture has leaves it against the far edge, so on a narrow phone it still fits. The compass is now in a grid over the picture (`#compass-place`) whose gaps give way, which keeps `#compass`'s own box the same size as before.
|
|
9
|
+
- **Pure parts** in `/space`: `readCompassPlace`, `readCompassOffset`, `COMPASS_PLACE`, `COMPASS_OFFSET` and the types `CompassPlace` and `CompassOffset`, with unit tests (`test/compass.test.ts`: the four corners in any case, `x,y` in its spellings, bad values reading as the default).
|
|
10
|
+
- **Tests.** `e2e/compass-place.gl.ts` reads the compass's box against the element's at a desktop and a phone size: each corner with the offset, the default unchanged (the same box as on 0.64.0), an offset with no room, a change while riding in the same turn, and the properties. It fails on 0.64.0 everywhere but the default. The ride guide in English and Japanese, `docs/ride-along.md`, `docs/space.md` and the README.
|
|
11
|
+
|
|
12
|
+
## 0.64.0 - 2026-11-20
|
|
13
|
+
|
|
14
|
+
- **From one satellite to another a ride glides round the Earth** (MODULES-1735). A `ride` call that goes from one satellite to another moved the camera in a straight line, which for a satellite behind the Earth ran through the Earth (held 1 km over the ground since 0.63.0), so a page had to climb, cross and come down in steps of its own. The camera now glides along the great circle round the Earth's centre, its height going evenly from the one ride's to the other's and never under 100 km above the ground (`GLIDE_FLOOR_KM`). The look is carried along the circle and goes over from the first look to the second, so a facing (ahead, down and the rest) stays level, nothing rolls over against the local vertical, and the view turns once towards its end. The glide back is the same flight the other way.
|
|
15
|
+
- **One glide for near and far.** For a satellite in sight the circle is all but the straight line (about 10 m off half way along a 25 km hop), so the great circle is the glide between any two satellites; every other change of ride (to or from a body, the same satellite in another view, a facing, the viewpoint) is the straight glide as before.
|
|
16
|
+
- **Its length.** `glide` sets it as for any glide; with `{ minMs, maxMs }` it follows the way along the circle (`satelliteGlideKm`).
|
|
17
|
+
- **Pure parts** in `/space`: `satelliteGlide(from, to, ease, floorKm?)`, `satelliteGlideKm(from, to)`, `GLIDE_FLOOR_KM` and the types `GlidePose` and `Quat`, with unit tests (`test/ride-glide.test.ts`: behind the Earth, in sight and across the far side, facing ahead and down; the floor; the same way back; a short hop against the straight line).
|
|
18
|
+
- **Tests.** `e2e/ride-glide.gl.ts` reads every frame of a glide on a stepped clock, from the ISS to a station in sight and to one behind the Earth, outside and inside, facing ahead and down: the distance to the end only falls, the camera keeps 100 km over the ground and never rises over both ends, the view only turns towards its end, neither its up nor its line of sight rolls over against the vertical, it arrives facing the way it faced, and the glide back is the same way. It fails on 0.63.0. The ride guide in English and Japanese, `docs/ride-along.md` and the README.
|
|
19
|
+
|
|
5
20
|
## 0.63.0 - 2026-11-19
|
|
6
21
|
|
|
7
22
|
- **The view above a satellite has no facings, and a ride's camera never goes under the ground** (MODULES-1685).
|
package/README.md
CHANGED
|
@@ -359,7 +359,7 @@ Passes are only as good as the orbit data are new: each pass says how old its el
|
|
|
359
359
|
<p align="center"><img alt="Riding along with the ISS, tipped towards the horizon: the Earth's curve and atmosphere, and the orbits of the other stations in the sky" src="docs/images/space-ride-horizon.png" width="420"></p>
|
|
360
360
|
|
|
361
361
|
`space.ride({ group: "stations", index: 0 }, { look: "horizon" })` puts the camera on the ISS (or a Starlink satellite, the Moon, a planet) at its real place for the moment shown and looks at the Earth, which goes by beneath
|
|
362
|
-
as the body moves along its orbit; switch to another body and the camera glides there. Straight down or toward the horizon, from the body or following it at a distance, time faster or slower. A ridden satellite is in the picture by default (the camera a little behind and above it, a small drawing of it where the page has no model, not to scale); `ride-viewpoint="inside"` (property `rideViewpoint`, option `viewpoint`) puts the camera at the satellite instead. A drag turns the view where the camera is, like turning your head (the satellite leaves the picture as you look away); `ride-drag="orbit"` (property `rideDrag`, option `drag`) takes the camera round the satellite as before. Seen from above, the model shrinks as the ride rises and hands over to the ordinary mark by 2,000 km; `ride-model-size="fixed"` (property `rideModelSize`, option `modelSize`) keeps one size at every height. `ride-up="north"` (property `rideUp`, option `up`) puts north at the top of the view above a satellite, so it is seen to go the way it really goes; a small compass on a ride shows north and the heading (`compass="off"` hides it), `rideTrack` and `chikyu-ride-track` give the heading, ground point and whether the Sun lights it, and the chosen orbit is amber in sunlight and blue in the Earth's shadow (`path-light="off"` for one colour). `ride-model-share`, `ride-model-seat` and `ride-zoom` frame and zoom the ridden satellite (properties `rideModelShare`, `rideModelSeat`, `rideZoom`). `face("ahead")` (behind, left, right, down, up; the keys W, S, A, D, F, R) turns a ride from the satellite or following it that way; the view above a satellite looks down on it and has no facings, so there `face()` returns `false` and the camera stays as it was. In every view the camera is never under the ground: it is held at least 1 km above it. It animates continuously, so it keeps to the
|
|
362
|
+
as the body moves along its orbit; switch to another body and the camera glides there; from one satellite to another it glides round the Earth along the great circle, never through it and at least 100 km above the ground, with the facing kept level, so a satellite on the far side is reached in one smooth flight and Back is the same flight the other way. Straight down or toward the horizon, from the body or following it at a distance, time faster or slower. A ridden satellite is in the picture by default (the camera a little behind and above it, a small drawing of it where the page has no model, not to scale); `ride-viewpoint="inside"` (property `rideViewpoint`, option `viewpoint`) puts the camera at the satellite instead. A drag turns the view where the camera is, like turning your head (the satellite leaves the picture as you look away); `ride-drag="orbit"` (property `rideDrag`, option `drag`) takes the camera round the satellite as before. Seen from above, the model shrinks as the ride rises and hands over to the ordinary mark by 2,000 km; `ride-model-size="fixed"` (property `rideModelSize`, option `modelSize`) keeps one size at every height. `ride-up="north"` (property `rideUp`, option `up`) puts north at the top of the view above a satellite, so it is seen to go the way it really goes; a small compass on a ride shows north and the heading (`compass="off"` hides it; `compass-place` puts it in another corner, `top-left` by default, and `compass-offset="x,y"` sets the pixels in from that corner, 8,8 by default; properties `compassPlace` and `compassOffset`), `rideTrack` and `chikyu-ride-track` give the heading, ground point and whether the Sun lights it, and the chosen orbit is amber in sunlight and blue in the Earth's shadow (`path-light="off"` for one colour). `ride-model-share`, `ride-model-seat` and `ride-zoom` frame and zoom the ridden satellite (properties `rideModelShare`, `rideModelSeat`, `rideZoom`). `face("ahead")` (behind, left, right, down, up; the keys W, S, A, D, F, R) turns a ride from the satellite or following it that way; the view above a satellite looks down on it and has no facings, so there `face()` returns `false` and the camera stays as it was. In every view the camera is never under the ground: it is held at least 1 km above it. It animates continuously, so it keeps to the
|
|
363
363
|
same budget: at most 30 frames a second (one a second for reduced motion), nothing drawn while paused, out of sight or hidden. [Ride along guide](docs/guides/ride-along.md), [docs/ride-along.md](docs/ride-along.md).
|
|
364
364
|
|
|
365
365
|
## Printable sheets
|
|
@@ -615,7 +615,7 @@ console.log(countryList().filter((country) => country.alpha2 === null).map((coun
|
|
|
615
615
|
|
|
616
616
|
## How to cite
|
|
617
617
|
|
|
618
|
-
> Morris, J. (2026). *Chikyu Earth* (version 0.
|
|
618
|
+
> Morris, J. (2026). *Chikyu Earth* (version 0.65.0) [Computer software]. https://github.com/johnmorrisdotca/chikyu-earth
|
|
619
619
|
|
|
620
620
|
GitHub's "Cite this repository" button reads [CITATION.cff](CITATION.cff) and gives BibTeX and APA. Cite the version you used (`npm ls @johnmorrisdotca/chikyu-earth`), and credit the sources behind the numbers and pictures: [NOTICE.md](NOTICE.md) says who made each one and under what terms.
|
|
621
621
|
|
package/dist/space/compass.d.ts
CHANGED
|
@@ -15,14 +15,93 @@ export declare const COMPASS_WORDS: {
|
|
|
15
15
|
readonly points: Record<CompassPoint, string>;
|
|
16
16
|
};
|
|
17
17
|
};
|
|
18
|
-
/** The styles of the compass (`#compass`) in an element's shadow root. The dial is white lines on a dark disc, the way-it-goes dot yellow, so it reads on the sea, the land, the night and the day alike; `--chikyu-compass-colour` and `--chikyu-compass-travel` change them. */
|
|
19
|
-
export declare const COMPASS_STYLE = "#compass{position:absolute;
|
|
18
|
+
/** The styles of the compass (`#compass`, in `#compass-place`) in an element's shadow root. `#compass-place` is a grid over the whole picture: a gap of the offset's size on the corner's two sides (it gives way when the picture is too small, so the compass never leaves it), and the compass in the cell beside them. The dial is white lines on a dark disc, the way-it-goes dot yellow, so it reads on the sea, the land, the night and the day alike; `--chikyu-compass-colour` and `--chikyu-compass-travel` change them. */
|
|
19
|
+
export declare const COMPASS_STYLE = "#compass-place{position:absolute;inset:0;display:grid;grid-template-columns:minmax(0,var(--compass-x,8px)) max-content;grid-template-rows:minmax(0,var(--compass-y,8px)) max-content;justify-content:start;align-content:start;pointer-events:none}#compass-place[data-right]{grid-template-columns:max-content minmax(0,var(--compass-x,8px));justify-content:end}#compass-place[data-bottom]{grid-template-rows:max-content minmax(0,var(--compass-y,8px));align-content:end}#compass{grid-column:2;grid-row:2;justify-self:start;align-self:start;display:flex;flex-direction:column;align-items:center;gap:2px;pointer-events:none;color:var(--chikyu-compass-colour,#fff);font:11px/1.2 system-ui,-apple-system,sans-serif}#compass-place[data-right] #compass{grid-column:1}#compass-place[data-bottom] #compass{grid-row:1}#compass[hidden]{display:none}#compass svg{width:64px;height:64px;display:block;overflow:visible}#compass .disc{fill:#0b0e14b3;stroke:currentColor;stroke-opacity:.55;stroke-width:1}#compass .north{fill:currentColor}#compass .south{fill:currentColor;fill-opacity:.35}#compass .travel{fill:var(--chikyu-compass-travel,#ffd166);stroke:#0b0e14;stroke-width:1}#compass text{fill:currentColor;font:600 11px system-ui,-apple-system,sans-serif;text-anchor:middle;dominant-baseline:central;paint-order:stroke;stroke:#0b0e14;stroke-width:2.5px}#compass .words{background:#0b0e14b3;padding:1px 6px;border-radius:4px;white-space:nowrap}#compass .words[hidden]{display:none}";
|
|
20
20
|
/** The compass's markup: put it in the shadow root and hand it to `createCompass`. */
|
|
21
|
-
export declare const COMPASS_HTML = "<div id=\"compass\" role=\"img\" hidden><svg viewBox=\"-36 -36 72 72\" aria-hidden=\"true\"><circle class=\"disc\" r=\"25\"></circle><g class=\"arrow\"><path class=\"north\" d=\"M0 -21 L5 -3 L0 -7 L-5 -3 Z\"></path><path class=\"south\" d=\"M0 21 L4 4 L0 7 L-4 4 Z\"></path></g><text class=\"n\" x=\"0\" y=\"-31\">N</text><circle class=\"travel\" r=\"3.4\" cx=\"0\" cy=\"-25\"></circle></svg><span class=\"words\"></span></div>";
|
|
21
|
+
export declare const COMPASS_HTML = "<div id=\"compass-place\"><div id=\"compass\" role=\"img\" hidden><svg viewBox=\"-36 -36 72 72\" aria-hidden=\"true\"><circle class=\"disc\" r=\"25\"></circle><g class=\"arrow\"><path class=\"north\" d=\"M0 -21 L5 -3 L0 -7 L-5 -3 Z\"></path><path class=\"south\" d=\"M0 21 L4 4 L0 7 L-4 4 Z\"></path></g><text class=\"n\" x=\"0\" y=\"-31\">N</text><circle class=\"travel\" r=\"3.4\" cx=\"0\" cy=\"-25\"></circle></svg><span class=\"words\"></span></div></div>";
|
|
22
22
|
export type CompassMode = "full" | "north" | "off";
|
|
23
23
|
/** Read the attribute `compass`: `off` takes the compass away, `north` shows the arrow without the words, anything else (or nothing) shows both. */
|
|
24
24
|
export declare function readCompass(value: string | null): CompassMode;
|
|
25
|
+
/**
|
|
26
|
+
* The corners of the picture the compass of a ride can be put in (the attribute `compass-place`, the property `compassPlace`).
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* ```ts
|
|
30
|
+
* import type { CompassPlace } from "@johnmorrisdotca/chikyu-earth/space";
|
|
31
|
+
*
|
|
32
|
+
* const corner: CompassPlace = "top-right";
|
|
33
|
+
* console.log(corner);
|
|
34
|
+
* ```
|
|
35
|
+
*/
|
|
36
|
+
export type CompassPlace = "top-left" | "top-right" | "bottom-left" | "bottom-right";
|
|
37
|
+
/**
|
|
38
|
+
* How far the compass is from its corner, in pixels: `x` from the side and `y` from the top or the bottom (the attribute `compass-offset`, the property `compassOffset`).
|
|
39
|
+
*
|
|
40
|
+
* @example
|
|
41
|
+
* ```ts
|
|
42
|
+
* import type { CompassOffset } from "@johnmorrisdotca/chikyu-earth/space";
|
|
43
|
+
*
|
|
44
|
+
* const offset: CompassOffset = { x: 16, y: 96 };
|
|
45
|
+
* console.log(`${offset.x},${offset.y}`);
|
|
46
|
+
* ```
|
|
47
|
+
*/
|
|
48
|
+
export interface CompassOffset {
|
|
49
|
+
x: number;
|
|
50
|
+
y: number;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* The compass's corner when nothing is set: the top-left, where it always was.
|
|
54
|
+
*
|
|
55
|
+
* @example
|
|
56
|
+
* ```ts
|
|
57
|
+
* import { COMPASS_PLACE } from "@johnmorrisdotca/chikyu-earth/space";
|
|
58
|
+
*
|
|
59
|
+
* console.log(COMPASS_PLACE);
|
|
60
|
+
* ```
|
|
61
|
+
*/
|
|
62
|
+
export declare const COMPASS_PLACE: CompassPlace;
|
|
63
|
+
/**
|
|
64
|
+
* The compass's offset when nothing is set: 8 pixels in from both sides of its corner, where it always was.
|
|
65
|
+
*
|
|
66
|
+
* @example
|
|
67
|
+
* ```ts
|
|
68
|
+
* import { COMPASS_OFFSET } from "@johnmorrisdotca/chikyu-earth/space";
|
|
69
|
+
*
|
|
70
|
+
* console.log(COMPASS_OFFSET.x, COMPASS_OFFSET.y);
|
|
71
|
+
* ```
|
|
72
|
+
*/
|
|
73
|
+
export declare const COMPASS_OFFSET: Readonly<CompassOffset>;
|
|
74
|
+
/**
|
|
75
|
+
* Read the attribute `compass-place`: one of the four corners, in any case, or the top-left corner for anything else (or nothing).
|
|
76
|
+
*
|
|
77
|
+
* @param value - The attribute's text, or `null` when it is not set.
|
|
78
|
+
* @returns The corner.
|
|
79
|
+
*
|
|
80
|
+
* @example
|
|
81
|
+
* ```ts
|
|
82
|
+
* import { readCompassPlace } from "@johnmorrisdotca/chikyu-earth/space";
|
|
83
|
+
*
|
|
84
|
+
* console.log(readCompassPlace("Bottom-Right"), readCompassPlace("middle"));
|
|
85
|
+
* ```
|
|
86
|
+
*/
|
|
87
|
+
export declare function readCompassPlace(value: string | null): CompassPlace;
|
|
88
|
+
/**
|
|
89
|
+
* Read the attribute `compass-offset`: `x,y` in pixels from the corner (a space may stand for the comma and `px` may follow a number), or one number for both. Each is 0 or more; anything else (or nothing) is 8,8.
|
|
90
|
+
*
|
|
91
|
+
* @param value - The attribute's text, or `null` when it is not set.
|
|
92
|
+
* @returns The offset in pixels.
|
|
93
|
+
*
|
|
94
|
+
* @example
|
|
95
|
+
* ```ts
|
|
96
|
+
* import { readCompassOffset } from "@johnmorrisdotca/chikyu-earth/space";
|
|
97
|
+
*
|
|
98
|
+
* console.log(readCompassOffset("16,96"), readCompassOffset("-3,x"));
|
|
99
|
+
* ```
|
|
100
|
+
*/
|
|
101
|
+
export declare function readCompassOffset(value: string | null): CompassOffset;
|
|
25
102
|
export interface Compass {
|
|
103
|
+
/** Put the compass in a corner, `offset` pixels in from it; the offset is held to what the picture has room for, so the compass is always inside it. */
|
|
104
|
+
place(place: CompassPlace, offset: CompassOffset): void;
|
|
26
105
|
/** Show what the last draw found (or hide the compass for `null`). Changes the page only when something it shows moved by half a degree (the words: a whole degree), the language or the mode changed, so a view at rest does nothing. */
|
|
27
106
|
update(track: RideTrack | null, lang: "en" | "ja", mode: CompassMode): void;
|
|
28
107
|
/** What the compass shows now, for a test: the angle of the arrow, the angle of the dot and the words; `null` when it is hidden. */
|
package/dist/space/compass.js
CHANGED
|
@@ -6,18 +6,81 @@ export const COMPASS_WORDS = {
|
|
|
6
6
|
en: { north: "N", heading: "Heading {point} {deg}°", label: "Compass: north is shown by the arrow. Heading {point}, {deg} degrees.", points: { N: "N", NE: "NE", E: "E", SE: "SE", S: "S", SW: "SW", W: "W", NW: "NW" } },
|
|
7
7
|
ja: { north: "北", heading: "進行方向 {point} {deg}°", label: "方位磁針:矢印が北を指します。進行方向は{point}、{deg}度。", points: { N: "北", NE: "北東", E: "東", SE: "南東", S: "南", SW: "南西", W: "西", NW: "北西" } },
|
|
8
8
|
};
|
|
9
|
-
/** The styles of the compass (`#compass`) in an element's shadow root. The dial is white lines on a dark disc, the way-it-goes dot yellow, so it reads on the sea, the land, the night and the day alike; `--chikyu-compass-colour` and `--chikyu-compass-travel` change them. */
|
|
10
|
-
export const COMPASS_STYLE = "#compass{position:absolute;
|
|
9
|
+
/** The styles of the compass (`#compass`, in `#compass-place`) in an element's shadow root. `#compass-place` is a grid over the whole picture: a gap of the offset's size on the corner's two sides (it gives way when the picture is too small, so the compass never leaves it), and the compass in the cell beside them. The dial is white lines on a dark disc, the way-it-goes dot yellow, so it reads on the sea, the land, the night and the day alike; `--chikyu-compass-colour` and `--chikyu-compass-travel` change them. */
|
|
10
|
+
export const COMPASS_STYLE = "#compass-place{position:absolute;inset:0;display:grid;grid-template-columns:minmax(0,var(--compass-x,8px)) max-content;grid-template-rows:minmax(0,var(--compass-y,8px)) max-content;justify-content:start;align-content:start;pointer-events:none}#compass-place[data-right]{grid-template-columns:max-content minmax(0,var(--compass-x,8px));justify-content:end}#compass-place[data-bottom]{grid-template-rows:max-content minmax(0,var(--compass-y,8px));align-content:end}#compass{grid-column:2;grid-row:2;justify-self:start;align-self:start;display:flex;flex-direction:column;align-items:center;gap:2px;pointer-events:none;color:var(--chikyu-compass-colour,#fff);font:11px/1.2 system-ui,-apple-system,sans-serif}#compass-place[data-right] #compass{grid-column:1}#compass-place[data-bottom] #compass{grid-row:1}#compass[hidden]{display:none}#compass svg{width:64px;height:64px;display:block;overflow:visible}#compass .disc{fill:#0b0e14b3;stroke:currentColor;stroke-opacity:.55;stroke-width:1}#compass .north{fill:currentColor}#compass .south{fill:currentColor;fill-opacity:.35}#compass .travel{fill:var(--chikyu-compass-travel,#ffd166);stroke:#0b0e14;stroke-width:1}#compass text{fill:currentColor;font:600 11px system-ui,-apple-system,sans-serif;text-anchor:middle;dominant-baseline:central;paint-order:stroke;stroke:#0b0e14;stroke-width:2.5px}#compass .words{background:#0b0e14b3;padding:1px 6px;border-radius:4px;white-space:nowrap}#compass .words[hidden]{display:none}";
|
|
11
11
|
/** The compass's markup: put it in the shadow root and hand it to `createCompass`. */
|
|
12
|
-
export const COMPASS_HTML = '<div id="compass" role="img" hidden><svg viewBox="-36 -36 72 72" aria-hidden="true"><circle class="disc" r="25"></circle><g class="arrow"><path class="north" d="M0 -21 L5 -3 L0 -7 L-5 -3 Z"></path><path class="south" d="M0 21 L4 4 L0 7 L-4 4 Z"></path></g><text class="n" x="0" y="-31">N</text><circle class="travel" r="3.4" cx="0" cy="-25"></circle></svg><span class="words"></span></div>';
|
|
12
|
+
export const COMPASS_HTML = '<div id="compass-place"><div id="compass" role="img" hidden><svg viewBox="-36 -36 72 72" aria-hidden="true"><circle class="disc" r="25"></circle><g class="arrow"><path class="north" d="M0 -21 L5 -3 L0 -7 L-5 -3 Z"></path><path class="south" d="M0 21 L4 4 L0 7 L-4 4 Z"></path></g><text class="n" x="0" y="-31">N</text><circle class="travel" r="3.4" cx="0" cy="-25"></circle></svg><span class="words"></span></div></div>';
|
|
13
13
|
/** Read the attribute `compass`: `off` takes the compass away, `north` shows the arrow without the words, anything else (or nothing) shows both. */
|
|
14
14
|
export function readCompass(value) {
|
|
15
15
|
const text = (value ?? "").trim().toLowerCase();
|
|
16
16
|
return text === "off" || text === "false" || text === "no" || text === "none" ? "off" : text === "north" ? "north" : "full";
|
|
17
17
|
}
|
|
18
|
+
/**
|
|
19
|
+
* The compass's corner when nothing is set: the top-left, where it always was.
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* ```ts
|
|
23
|
+
* import { COMPASS_PLACE } from "@johnmorrisdotca/chikyu-earth/space";
|
|
24
|
+
*
|
|
25
|
+
* console.log(COMPASS_PLACE);
|
|
26
|
+
* ```
|
|
27
|
+
*/
|
|
28
|
+
export const COMPASS_PLACE = "top-left";
|
|
29
|
+
/**
|
|
30
|
+
* The compass's offset when nothing is set: 8 pixels in from both sides of its corner, where it always was.
|
|
31
|
+
*
|
|
32
|
+
* @example
|
|
33
|
+
* ```ts
|
|
34
|
+
* import { COMPASS_OFFSET } from "@johnmorrisdotca/chikyu-earth/space";
|
|
35
|
+
*
|
|
36
|
+
* console.log(COMPASS_OFFSET.x, COMPASS_OFFSET.y);
|
|
37
|
+
* ```
|
|
38
|
+
*/
|
|
39
|
+
export const COMPASS_OFFSET = { x: 8, y: 8 };
|
|
40
|
+
const COMPASS_PLACES = ["top-left", "top-right", "bottom-left", "bottom-right"];
|
|
41
|
+
/**
|
|
42
|
+
* Read the attribute `compass-place`: one of the four corners, in any case, or the top-left corner for anything else (or nothing).
|
|
43
|
+
*
|
|
44
|
+
* @param value - The attribute's text, or `null` when it is not set.
|
|
45
|
+
* @returns The corner.
|
|
46
|
+
*
|
|
47
|
+
* @example
|
|
48
|
+
* ```ts
|
|
49
|
+
* import { readCompassPlace } from "@johnmorrisdotca/chikyu-earth/space";
|
|
50
|
+
*
|
|
51
|
+
* console.log(readCompassPlace("Bottom-Right"), readCompassPlace("middle"));
|
|
52
|
+
* ```
|
|
53
|
+
*/
|
|
54
|
+
export function readCompassPlace(value) {
|
|
55
|
+
const text = (value ?? "").trim().toLowerCase();
|
|
56
|
+
return COMPASS_PLACES.find((place) => place === text) ?? COMPASS_PLACE;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Read the attribute `compass-offset`: `x,y` in pixels from the corner (a space may stand for the comma and `px` may follow a number), or one number for both. Each is 0 or more; anything else (or nothing) is 8,8.
|
|
60
|
+
*
|
|
61
|
+
* @param value - The attribute's text, or `null` when it is not set.
|
|
62
|
+
* @returns The offset in pixels.
|
|
63
|
+
*
|
|
64
|
+
* @example
|
|
65
|
+
* ```ts
|
|
66
|
+
* import { readCompassOffset } from "@johnmorrisdotca/chikyu-earth/space";
|
|
67
|
+
*
|
|
68
|
+
* console.log(readCompassOffset("16,96"), readCompassOffset("-3,x"));
|
|
69
|
+
* ```
|
|
70
|
+
*/
|
|
71
|
+
export function readCompassOffset(value) {
|
|
72
|
+
const parts = (value ?? "").trim().toLowerCase().split(/\s*,\s*|\s+/);
|
|
73
|
+
if (parts.length > 2)
|
|
74
|
+
return { ...COMPASS_OFFSET };
|
|
75
|
+
const numbers = parts.map((part) => (/^\d+(\.\d+)?(px)?$/.test(part) ? parseFloat(part) : NaN));
|
|
76
|
+
if (numbers.some((n) => !Number.isFinite(n)))
|
|
77
|
+
return { ...COMPASS_OFFSET };
|
|
78
|
+
return { x: numbers[0], y: numbers[1] ?? numbers[0] };
|
|
79
|
+
}
|
|
18
80
|
/** Take the markup the element put in its shadow root and make the compass of it. */
|
|
19
81
|
export function createCompass(root) {
|
|
20
82
|
const box = root.getElementById("compass");
|
|
83
|
+
const slot = root.getElementById("compass-place");
|
|
21
84
|
const arrow = box.querySelector(".arrow");
|
|
22
85
|
const letter = box.querySelector("text.n");
|
|
23
86
|
const dot = box.querySelector(".travel");
|
|
@@ -25,6 +88,12 @@ export function createCompass(root) {
|
|
|
25
88
|
let key = "";
|
|
26
89
|
let shown = null;
|
|
27
90
|
return {
|
|
91
|
+
place(place, offset) {
|
|
92
|
+
slot.toggleAttribute("data-right", place.endsWith("right"));
|
|
93
|
+
slot.toggleAttribute("data-bottom", place.startsWith("bottom"));
|
|
94
|
+
slot.style.setProperty("--compass-x", `${offset.x}px`);
|
|
95
|
+
slot.style.setProperty("--compass-y", `${offset.y}px`);
|
|
96
|
+
},
|
|
28
97
|
update(track, lang, mode) {
|
|
29
98
|
if (!track || mode === "off" || track.northDeg === null) {
|
|
30
99
|
if (!box.hidden)
|
|
@@ -23,6 +23,7 @@ import { type SatelliteScreen, type SatelliteStyle } from "./satellite-layer.ts"
|
|
|
23
23
|
import { type SatelliteOthers } from "./satellite-focus.ts";
|
|
24
24
|
import { type PathStats } from "./path-controls.ts";
|
|
25
25
|
import { type PathHit, type PathRequest, type PathStyle } from "./paths.ts";
|
|
26
|
+
import { type CompassOffset, type CompassPlace } from "./compass.ts";
|
|
26
27
|
import type { RideUp } from "./north-up.ts";
|
|
27
28
|
import { type RideDrag, type RideFace, type RideLook, type RideModelSize, type RideViewpoint } from "./ride.ts";
|
|
28
29
|
import { type ScaleMode } from "./scale.ts";
|
|
@@ -134,7 +135,7 @@ export interface RideOptions {
|
|
|
134
135
|
up?: RideUp;
|
|
135
136
|
/** How far back the camera is kept from the satellite in an outside ride, in kilometres (`view: "from"`; the element's `ride-outside-km` when not given, else 25). It is never more than half the satellite's height. */
|
|
136
137
|
outsideKm?: number;
|
|
137
|
-
/** How long the glide to this ride lasts: a number of milliseconds (1200 by default), or `{ minMs, maxMs }` for a length that follows how far the camera has to move (`rideGlideMs`: 800 to 4000 ms by default, about 1.2 s for a 25 km hop and 3 s for 3,000 km). */
|
|
138
|
+
/** How long the glide to this ride lasts: a number of milliseconds (1200 by default), or `{ minMs, maxMs }` for a length that follows how far the camera has to move (`rideGlideMs`: 800 to 4000 ms by default, about 1.2 s for a 25 km hop and 3 s for 3,000 km; from one satellite to another, the way along the great circle, `satelliteGlideKm`). */
|
|
138
139
|
glide?: number | {
|
|
139
140
|
minMs?: number;
|
|
140
141
|
maxMs?: number;
|
|
@@ -675,7 +676,7 @@ export declare class ChikyuSpace extends HTMLElement {
|
|
|
675
676
|
/**
|
|
676
677
|
* Ride along with a body or a satellite. By default the camera sits at it and looks at the Earth, with the way it is going at the top of the picture, at its real place for the moment shown, so the
|
|
677
678
|
* Earth turns and slides beneath as it moves along its orbit (an ISS view goes round about every 90 minutes). A drag looks about from there (a drag right turns the camera to its left and a drag up tips it towards the bottom of its picture, so the ground follows the pointer), the shared controls' zoom narrows the view.
|
|
678
|
-
* A satellite is `{ group, index }` of a group set with `setSatellites`; it is placed exactly, one SGP4 call a frame, at any speed. Another call switches smoothly; `null` stops. The draw rate follows how
|
|
679
|
+
* A satellite is `{ group, index }` of a group set with `setSatellites`; it is placed exactly, one SGP4 call a frame, at any speed. Another call switches smoothly; `null` stops. From one satellite to another the glide goes round the Earth along the great circle, never through it and at least 100 km above the ground, with the look carried along so a facing stays level (`satelliteGlide`); the glide back is the same flight the other way. The draw rate follows how
|
|
679
680
|
* fast the picture moves, never more than 30 a second (one a second for a reader who asked for reduced motion), and nothing is drawn out of sight.
|
|
680
681
|
* Whatever the view, facing, drag or glide, the camera is never under the ground: one that would be lower than 1 km above it is held there. A camera that looks at a satellite comes in towards it along its line of sight, so the satellite stays where it is in the picture; any other moves out along its line from the Earth's centre.
|
|
681
682
|
*
|
|
@@ -797,6 +798,36 @@ export declare class ChikyuSpace extends HTMLElement {
|
|
|
797
798
|
* ```
|
|
798
799
|
*/
|
|
799
800
|
get rideTrack(): RideTrack | null;
|
|
801
|
+
/**
|
|
802
|
+
* The corner of the picture the compass of a ride is in (the attribute `compass-place`): `top-left` (the default, and where it always was), `top-right`, `bottom-left` or `bottom-right`. Anything else reads as `top-left`.
|
|
803
|
+
* Set while riding, it moves the compass at once. The compass is held inside the picture on every side, so on a narrow picture it is still all there. See `compassOffset`.
|
|
804
|
+
*
|
|
805
|
+
* @example
|
|
806
|
+
* ```ts
|
|
807
|
+
* import type { ChikyuSpace } from "@johnmorrisdotca/chikyu-earth/space/element";
|
|
808
|
+
*
|
|
809
|
+
* const space = document.createElement("chikyu-space") as ChikyuSpace;
|
|
810
|
+
* space.compassPlace = "top-right";
|
|
811
|
+
* console.log(space.compassPlace);
|
|
812
|
+
* ```
|
|
813
|
+
*/
|
|
814
|
+
get compassPlace(): CompassPlace;
|
|
815
|
+
set compassPlace(value: CompassPlace);
|
|
816
|
+
/**
|
|
817
|
+
* How far in from its corner the compass of a ride is, in pixels (the attribute `compass-offset`, written `x,y`, such as `16,96`, or one number for both): `x` from the side, `y` from the top or the bottom. It is `{ x: 8, y: 8 }` by default, where the compass always was.
|
|
818
|
+
* A value that is not two numbers of 0 or more reads as the default. The offset is held to the room the picture has, so a large one leaves the compass against the far edge, not outside it. Set while riding, it moves the compass at once. See `compassPlace`.
|
|
819
|
+
*
|
|
820
|
+
* @example
|
|
821
|
+
* ```ts
|
|
822
|
+
* import type { ChikyuSpace } from "@johnmorrisdotca/chikyu-earth/space/element";
|
|
823
|
+
*
|
|
824
|
+
* const space = document.createElement("chikyu-space") as ChikyuSpace;
|
|
825
|
+
* space.compassOffset = { x: 16, y: 96 };
|
|
826
|
+
* console.log(space.compassOffset);
|
|
827
|
+
* ```
|
|
828
|
+
*/
|
|
829
|
+
get compassOffset(): CompassOffset;
|
|
830
|
+
set compassOffset(value: CompassOffset);
|
|
800
831
|
/**
|
|
801
832
|
* The radius of the ridden satellite's model as a share of the picture's height, 0.02 to 1.2 (the attribute `ride-model-share`), or `null` for the ride's own: 0.22 along the way it goes, 0.17 above the satellite (its size at the lowest height; `ride-model-size="distance"` still shrinks it as the ride rises).
|
|
802
833
|
* Set while riding it glides in 0.4 s (at once for a reader who asked for less motion). `stats.followModel.share` is the share in use.
|
|
@@ -41,7 +41,7 @@ import { bindPaths, emptyPathStats, pointerOf, readPathPriority } from "./path-c
|
|
|
41
41
|
import { styleTable } from "./paths.js";
|
|
42
42
|
import { bindSatelliteHover, hoverPathOn, hoverStyleOf, namesOnHover as namesHoverOn } from "./satellite-hover.js";
|
|
43
43
|
import { clampFollow, retargetFollow } from "./follow.js";
|
|
44
|
-
import { COMPASS_HTML, COMPASS_STYLE, createCompass, readCompass } from "./compass.js";
|
|
44
|
+
import { COMPASS_HTML, COMPASS_STYLE, createCompass, readCompass, readCompassOffset, readCompassPlace } from "./compass.js";
|
|
45
45
|
import { OUTSIDE_KM, RIDE_FACES, rideTiltLimits, rideTurnDegrees } from "./ride.js";
|
|
46
46
|
import { placeAround, placeMoon, placeSun, RADIUS } from "./scale.js";
|
|
47
47
|
import { BODY_NAMES, createSpaceItem, DEFAULT_EARTH_SIZE, newSpaceModel } from "./scene.js";
|
|
@@ -200,7 +200,7 @@ const STYLE = `:host{display:block;aspect-ratio:1/1;position:relative;overflow:h
|
|
|
200
200
|
* ```
|
|
201
201
|
*/
|
|
202
202
|
export class ChikyuSpace extends HTMLElement {
|
|
203
|
-
static observedAttributes = ["cloud-drift", "cloud-fade", "camera", "earth-size", "earth-x", "earth-y", "center", "time", "speed", "scale", "labels", "orbits", "bodies", "light", "meteors", "meteors-label", "meteors-strength", ...BODY_LABEL_ATTRIBUTES, ...SKY_ATTRIBUTES, ...CITY_NAMES_ATTRIBUTES, ...BORDER_ATTRIBUTES, ...GRID_ATTRIBUTES, ...BEAM_ATTRIBUTES, ...COUNTRY_NAMES_ATTRIBUTES, ...SEA_NAMES_ATTRIBUTES, "air-thickness", "air-label", "lang", "places", "places-look", "place-groups", "place-layers", "here-city", "route", "bodies-credit", "satellite-tint", "satellite-streak-max", "tiles", "tiles-finer", "tiles-finer-layer", "tiles-finer-date", "tiles-finer-timeout", "ride-viewpoint", "ride-outside-km", "ride-model-size", "ride-drag", "hover-path", "names-on-hover", "selected-path", "path-light", "path-hit", "path-priority", "estimate-far", "follow", "follow-ease", "dim-occluded", "ride-model-share", "ride-model-seat", "ride-zoom", "ride-up", "compass", "smooth-fps"];
|
|
203
|
+
static observedAttributes = ["cloud-drift", "cloud-fade", "camera", "earth-size", "earth-x", "earth-y", "center", "time", "speed", "scale", "labels", "orbits", "bodies", "light", "meteors", "meteors-label", "meteors-strength", ...BODY_LABEL_ATTRIBUTES, ...SKY_ATTRIBUTES, ...CITY_NAMES_ATTRIBUTES, ...BORDER_ATTRIBUTES, ...GRID_ATTRIBUTES, ...BEAM_ATTRIBUTES, ...COUNTRY_NAMES_ATTRIBUTES, ...SEA_NAMES_ATTRIBUTES, "air-thickness", "air-label", "lang", "places", "places-look", "place-groups", "place-layers", "here-city", "route", "bodies-credit", "satellite-tint", "satellite-streak-max", "tiles", "tiles-finer", "tiles-finer-layer", "tiles-finer-date", "tiles-finer-timeout", "ride-viewpoint", "ride-outside-km", "ride-model-size", "ride-drag", "hover-path", "names-on-hover", "selected-path", "path-light", "path-hit", "path-priority", "estimate-far", "follow", "follow-ease", "dim-occluded", "ride-model-share", "ride-model-seat", "ride-zoom", "ride-up", "compass", "compass-place", "compass-offset", "smooth-fps"];
|
|
204
204
|
#model = newSpaceModel();
|
|
205
205
|
/** The finer imagery (NASA's tile service), one source while the attributes stay the same. Off unless `tiles-finer="gibs"`. */
|
|
206
206
|
#finerHold = createFinerHolder(() => new Date(this.#model.time), () => this.#gate?.request());
|
|
@@ -317,6 +317,7 @@ export class ChikyuSpace extends HTMLElement {
|
|
|
317
317
|
root.innerHTML = `<div id="stage"></div><div id="places"></div><div id="labels" aria-hidden="true"></div>${COMPASS_HTML}<div id="notes"><p id="air-note" hidden></p><p id="meteor-note" hidden></p><p id="bodies-note" hidden></p><p id="finer-credit" hidden></p></div>`;
|
|
318
318
|
adoptStyles(root, STYLE, this.nonce);
|
|
319
319
|
this.#compass = createCompass(root);
|
|
320
|
+
this.#placeCompass();
|
|
320
321
|
this.#stage = root.getElementById("stage");
|
|
321
322
|
this.#labelBox = root.getElementById("labels");
|
|
322
323
|
this.#note = root.getElementById("meteor-note");
|
|
@@ -537,6 +538,8 @@ export class ChikyuSpace extends HTMLElement {
|
|
|
537
538
|
this.#applyUp();
|
|
538
539
|
else if (name === "compass")
|
|
539
540
|
this.#showCompass();
|
|
541
|
+
else if (name === "compass-place" || name === "compass-offset")
|
|
542
|
+
this.#placeCompass();
|
|
540
543
|
else if (name === "ride-model-share" || name === "ride-model-seat")
|
|
541
544
|
this.#applyFrame();
|
|
542
545
|
else if (name === "ride-zoom")
|
|
@@ -1764,7 +1767,7 @@ export class ChikyuSpace extends HTMLElement {
|
|
|
1764
1767
|
/**
|
|
1765
1768
|
* Ride along with a body or a satellite. By default the camera sits at it and looks at the Earth, with the way it is going at the top of the picture, at its real place for the moment shown, so the
|
|
1766
1769
|
* Earth turns and slides beneath as it moves along its orbit (an ISS view goes round about every 90 minutes). A drag looks about from there (a drag right turns the camera to its left and a drag up tips it towards the bottom of its picture, so the ground follows the pointer), the shared controls' zoom narrows the view.
|
|
1767
|
-
* A satellite is `{ group, index }` of a group set with `setSatellites`; it is placed exactly, one SGP4 call a frame, at any speed. Another call switches smoothly; `null` stops. The draw rate follows how
|
|
1770
|
+
* A satellite is `{ group, index }` of a group set with `setSatellites`; it is placed exactly, one SGP4 call a frame, at any speed. Another call switches smoothly; `null` stops. From one satellite to another the glide goes round the Earth along the great circle, never through it and at least 100 km above the ground, with the look carried along so a facing stays level (`satelliteGlide`); the glide back is the same flight the other way. The draw rate follows how
|
|
1768
1771
|
* fast the picture moves, never more than 30 a second (one a second for a reader who asked for reduced motion), and nothing is drawn out of sight.
|
|
1769
1772
|
* Whatever the view, facing, drag or glide, the camera is never under the ground: one that would be lower than 1 km above it is held there. A camera that looks at a satellite comes in towards it along its line of sight, so the satellite stays where it is in the picture; any other moves out along its line from the Earth's centre.
|
|
1770
1773
|
*
|
|
@@ -1775,6 +1778,9 @@ export class ChikyuSpace extends HTMLElement {
|
|
|
1775
1778
|
const model = this.#model;
|
|
1776
1779
|
const reduced = typeof matchMedia === "function" && matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
1777
1780
|
const wasRiding = model.ride !== null;
|
|
1781
|
+
const was = model.ride?.target;
|
|
1782
|
+
// from one satellite to another the glide goes round the Earth along the great circle (`satelliteGlide`), never through it; any other change of ride glides in a straight line
|
|
1783
|
+
const round = !!was && typeof was !== "string" && !!target && typeof target !== "string" && (was.group !== target.group || was.index !== target.index);
|
|
1778
1784
|
model.rideFrame.share = clampFrame(options.modelShare, 0.02, 1.2) ?? this.rideModelShare;
|
|
1779
1785
|
model.rideFrame.seat = clampFrame(options.modelSeat, 0.5, 1.4) ?? this.rideModelSeat;
|
|
1780
1786
|
model.rideFrame.ms = reduced ? 0 : 400;
|
|
@@ -1814,7 +1820,7 @@ export class ChikyuSpace extends HTMLElement {
|
|
|
1814
1820
|
this.#lostTold = false;
|
|
1815
1821
|
const pose = model.pose;
|
|
1816
1822
|
const glide = readGlide(options.glide);
|
|
1817
|
-
model.transition = (options.smooth ?? true) && !reduced && pose.valid ? { start: performance.now(), duration: glide.duration, ...(glide.scaled ? { scaled: glide.scaled } : {}), from: { p: [pose.p[0], pose.p[1], pose.p[2]], q: [pose.q[0], pose.q[1], pose.q[2], pose.q[3]], fov: pose.fov } } : null;
|
|
1823
|
+
model.transition = (options.smooth ?? true) && !reduced && pose.valid ? { start: performance.now(), duration: glide.duration, ...(glide.scaled ? { scaled: glide.scaled } : {}), ...(round ? { round } : {}), from: { p: [pose.p[0], pose.p[1], pose.p[2]], q: [pose.q[0], pose.q[1], pose.q[2], pose.q[3]], fov: pose.fov } } : null;
|
|
1818
1824
|
this.#last = performance.now();
|
|
1819
1825
|
this.#schedule();
|
|
1820
1826
|
this.#gate?.request();
|
|
@@ -2091,6 +2097,47 @@ export class ChikyuSpace extends HTMLElement {
|
|
|
2091
2097
|
get rideTrack() {
|
|
2092
2098
|
return this.#model.rideTrack ? { ...this.#model.rideTrack } : null;
|
|
2093
2099
|
}
|
|
2100
|
+
/**
|
|
2101
|
+
* The corner of the picture the compass of a ride is in (the attribute `compass-place`): `top-left` (the default, and where it always was), `top-right`, `bottom-left` or `bottom-right`. Anything else reads as `top-left`.
|
|
2102
|
+
* Set while riding, it moves the compass at once. The compass is held inside the picture on every side, so on a narrow picture it is still all there. See `compassOffset`.
|
|
2103
|
+
*
|
|
2104
|
+
* @example
|
|
2105
|
+
* ```ts
|
|
2106
|
+
* import type { ChikyuSpace } from "@johnmorrisdotca/chikyu-earth/space/element";
|
|
2107
|
+
*
|
|
2108
|
+
* const space = document.createElement("chikyu-space") as ChikyuSpace;
|
|
2109
|
+
* space.compassPlace = "top-right";
|
|
2110
|
+
* console.log(space.compassPlace);
|
|
2111
|
+
* ```
|
|
2112
|
+
*/
|
|
2113
|
+
get compassPlace() {
|
|
2114
|
+
return readCompassPlace(this.getAttribute("compass-place"));
|
|
2115
|
+
}
|
|
2116
|
+
set compassPlace(value) {
|
|
2117
|
+
this.setAttribute("compass-place", value);
|
|
2118
|
+
}
|
|
2119
|
+
/**
|
|
2120
|
+
* How far in from its corner the compass of a ride is, in pixels (the attribute `compass-offset`, written `x,y`, such as `16,96`, or one number for both): `x` from the side, `y` from the top or the bottom. It is `{ x: 8, y: 8 }` by default, where the compass always was.
|
|
2121
|
+
* A value that is not two numbers of 0 or more reads as the default. The offset is held to the room the picture has, so a large one leaves the compass against the far edge, not outside it. Set while riding, it moves the compass at once. See `compassPlace`.
|
|
2122
|
+
*
|
|
2123
|
+
* @example
|
|
2124
|
+
* ```ts
|
|
2125
|
+
* import type { ChikyuSpace } from "@johnmorrisdotca/chikyu-earth/space/element";
|
|
2126
|
+
*
|
|
2127
|
+
* const space = document.createElement("chikyu-space") as ChikyuSpace;
|
|
2128
|
+
* space.compassOffset = { x: 16, y: 96 };
|
|
2129
|
+
* console.log(space.compassOffset);
|
|
2130
|
+
* ```
|
|
2131
|
+
*/
|
|
2132
|
+
get compassOffset() {
|
|
2133
|
+
return readCompassOffset(this.getAttribute("compass-offset"));
|
|
2134
|
+
}
|
|
2135
|
+
set compassOffset(value) {
|
|
2136
|
+
this.setAttribute("compass-offset", `${value.x},${value.y}`);
|
|
2137
|
+
}
|
|
2138
|
+
#placeCompass() {
|
|
2139
|
+
this.#compass?.place(this.compassPlace, this.compassOffset);
|
|
2140
|
+
}
|
|
2094
2141
|
/** Shows the compass for the last draw (the language, the mode of the attribute `compass`), and tells the page when the heading changed by a whole degree, or the satellite went into or out of the Earth's shadow. Called with the draw. */
|
|
2095
2142
|
#showCompass() {
|
|
2096
2143
|
const track = this.#model.rideTrack;
|
package/dist/space/index.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ export { AU_IN_EARTH_RADII, blend, createTrack, EARTH_RADIUS_KM, frameAt, orbitP
|
|
|
2
2
|
export { compress, MOON_COMPRESSED, placeAround, placeMoon, placeSun, RADIUS, SUN_COMPRESSED, truePosition, type ScaleMode } from "./scale.ts";
|
|
3
3
|
export { fitDistance, plainPainter, type BodyDrawing, type RideTrack, type BodyMoon, type BodyPainter, type BodyView, type PaintContext, type SatellitePainter } from "./scene.ts";
|
|
4
4
|
export { faceOffset, OUTSIDE_KM, outsidePose, RIDE_FACES, RIDE_FOV, rideFov, rideGlideMs, ridePose, rideTiltLimits, rideTurnDegrees, type RideDrag, type RideFace, type RideInput, type RideLook, type RidePose, type RideModelSize, type RideViewpoint } from "./ride.ts";
|
|
5
|
+
export { GLIDE_FLOOR_KM, satelliteGlide, satelliteGlideKm, type GlidePose, type Quat } from "./ride-glide.ts";
|
|
5
6
|
export { earthHides, type SatelliteScreen } from "./satellite-layer.ts";
|
|
6
7
|
export { ABOVE_MODEL_KM, ABOVE_MODEL_SHARE, aboveAxes, aboveModelShare, MODEL_FADE_FROM_KM, MODEL_FADE_TO_KM, MODEL_HANDOVER_PX, MODEL_RADIUS_SHARE, modelMatrix, modelRadius, satelliteAxes } from "./satellite-model.ts";
|
|
7
8
|
export { localNorth, NORTH_UP_BLEND_DEG, NORTH_UP_POLE_DEG, northUpYaw, screenAngle, type RideUp } from "./north-up.ts";
|
|
@@ -11,3 +12,4 @@ export type { BeamStats } from "../beam/layer.ts";
|
|
|
11
12
|
export { RIDE_PATH_FADE_KM } from "./path-ribbons.ts";
|
|
12
13
|
export { createTrailBuilder, TRAIL_DEFAULT_ORBITS, TRAIL_MAX_ORBITS, TRAIL_MAX_POINTS, TRAIL_POINTS_PER_ORBIT, trailOrbits, type PlaceAt, type TrailBuilder } from "./trail.ts";
|
|
13
14
|
export { descentFloorKm, FLY_FLOOR_KM, FLY_HEIGHT_KM, FLY_MIN_KM, flyAcrossMs, flyAim, flyAt, flyDistance, flyDownMs, flyLonLat, flyStateAt, flyStill, planFly, type FlyPhase, type FlyPlan, type FlyPoint, type FlyState } from "./fly.ts";
|
|
15
|
+
export { COMPASS_OFFSET, COMPASS_PLACE, readCompassOffset, readCompassPlace, type CompassOffset, type CompassPlace } from "./compass.ts";
|
package/dist/space/index.js
CHANGED
|
@@ -4,6 +4,7 @@ export { AU_IN_EARTH_RADII, blend, createTrack, EARTH_RADIUS_KM, frameAt, orbitP
|
|
|
4
4
|
export { compress, MOON_COMPRESSED, placeAround, placeMoon, placeSun, RADIUS, SUN_COMPRESSED, truePosition } from "./scale.js";
|
|
5
5
|
export { fitDistance, plainPainter } from "./scene.js";
|
|
6
6
|
export { faceOffset, OUTSIDE_KM, outsidePose, RIDE_FACES, RIDE_FOV, rideFov, rideGlideMs, ridePose, rideTiltLimits, rideTurnDegrees } from "./ride.js";
|
|
7
|
+
export { GLIDE_FLOOR_KM, satelliteGlide, satelliteGlideKm } from "./ride-glide.js";
|
|
7
8
|
export { earthHides } from "./satellite-layer.js";
|
|
8
9
|
export { ABOVE_MODEL_KM, ABOVE_MODEL_SHARE, aboveAxes, aboveModelShare, MODEL_FADE_FROM_KM, MODEL_FADE_TO_KM, MODEL_HANDOVER_PX, MODEL_RADIUS_SHARE, modelMatrix, modelRadius, satelliteAxes } from "./satellite-model.js";
|
|
9
10
|
export { localNorth, NORTH_UP_BLEND_DEG, NORTH_UP_POLE_DEG, northUpYaw, screenAngle } from "./north-up.js";
|
|
@@ -12,3 +13,4 @@ export { BEAM_ATTRIBUTES, BEAM_COLOUR, BEAM_ELEVATION, beamCells, footprintAngle
|
|
|
12
13
|
export { RIDE_PATH_FADE_KM } from "./path-ribbons.js";
|
|
13
14
|
export { createTrailBuilder, TRAIL_DEFAULT_ORBITS, TRAIL_MAX_ORBITS, TRAIL_MAX_POINTS, TRAIL_POINTS_PER_ORBIT, trailOrbits } from "./trail.js";
|
|
14
15
|
export { descentFloorKm, FLY_FLOOR_KM, FLY_HEIGHT_KM, FLY_MIN_KM, flyAcrossMs, flyAim, flyAt, flyDistance, flyDownMs, flyLonLat, flyStateAt, flyStill, planFly } from "./fly.js";
|
|
16
|
+
export { COMPASS_OFFSET, COMPASS_PLACE, readCompassOffset, readCompassPlace } from "./compass.js";
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import type { Vec3 } from "./ephemeris.ts";
|
|
2
|
+
/**
|
|
3
|
+
* A rotation as a quaternion, `[x, y, z, w]` (three.js's order).
|
|
4
|
+
*
|
|
5
|
+
* @example
|
|
6
|
+
* ```ts
|
|
7
|
+
* import type { Quat } from "@johnmorrisdotca/chikyu-earth/space";
|
|
8
|
+
*
|
|
9
|
+
* const still: Quat = [0, 0, 0, 1];
|
|
10
|
+
* console.log(still[3]);
|
|
11
|
+
* ```
|
|
12
|
+
*/
|
|
13
|
+
export type Quat = [number, number, number, number];
|
|
14
|
+
/**
|
|
15
|
+
* A camera's place and orientation: `p` in Earth radii from the Earth's centre, `q` the rotation from the camera's own axes (it looks down its -z, its up is +y) to the scene's.
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```ts
|
|
19
|
+
* import type { GlidePose } from "@johnmorrisdotca/chikyu-earth/space";
|
|
20
|
+
*
|
|
21
|
+
* const pose: GlidePose = { p: [1.07, 0, 0], q: [0, 0, 0, 1] };
|
|
22
|
+
* console.log(pose.p[0]);
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
25
|
+
export interface GlidePose {
|
|
26
|
+
p: Vec3;
|
|
27
|
+
q: Quat;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* The least height above the ground, in km, that the glide from one satellite's ride to another's keeps between its two ends (`satelliteGlide`). Ends lower than this (a satellite coming down) are left
|
|
31
|
+
* where they are and the glide rises over the floor between them.
|
|
32
|
+
*
|
|
33
|
+
* @example
|
|
34
|
+
* ```ts
|
|
35
|
+
* import { GLIDE_FLOOR_KM } from "@johnmorrisdotca/chikyu-earth/space";
|
|
36
|
+
*
|
|
37
|
+
* console.log(`${GLIDE_FLOOR_KM} km`);
|
|
38
|
+
* ```
|
|
39
|
+
*/
|
|
40
|
+
export declare const GLIDE_FLOOR_KM = 100;
|
|
41
|
+
/**
|
|
42
|
+
* Where the camera is, a share `ease` (0 to 1) along the glide from one satellite's ride to another's. It goes along the great circle round the Earth's centre from the first place to the second, its distance from
|
|
43
|
+
* the centre going evenly from the one to the other, so it never passes through the Earth or dips under the two heights; between ends lower than `floorKm` above the ground it rises over that floor in the middle.
|
|
44
|
+
* The look is carried along the circle (turned with it, as the local vertical turns) and goes over the way from the first look to the second in the same frame, so a facing along the ground stays level, a facing
|
|
45
|
+
* down stays down, nothing rolls over, and the view turns once towards its end. The glide back is the same glide the other way: `satelliteGlide(to, from, 1 - ease)` is the same pose. A short hop is all but the
|
|
46
|
+
* straight glide: the circle is about 10 m from the straight line half way along a hop of 25 km.
|
|
47
|
+
*
|
|
48
|
+
* @param from - The camera where the glide began.
|
|
49
|
+
* @param to - The camera of the ride it goes to (its pose this frame: the satellite may move).
|
|
50
|
+
* @param ease - How far along, 0 at the start and 1 at the end (eased by the caller).
|
|
51
|
+
* @param floorKm - The least height above the ground between the ends, km (`GLIDE_FLOOR_KM`).
|
|
52
|
+
* @returns The camera's place and orientation there.
|
|
53
|
+
*
|
|
54
|
+
* @example
|
|
55
|
+
* ```ts
|
|
56
|
+
* import { satelliteGlide } from "@johnmorrisdotca/chikyu-earth/space";
|
|
57
|
+
*
|
|
58
|
+
* // from over one side of the Earth to over the other: half way, the camera is over the Earth's edge, not inside it
|
|
59
|
+
* const mid = satelliteGlide({ p: [1.07, 0, 0], q: [0, 0, 0, 1] }, { p: [-1.07, 0, 0.01], q: [0, 0, 0, 1] }, 0.5);
|
|
60
|
+
* console.log(Math.hypot(...mid.p).toFixed(2));
|
|
61
|
+
* ```
|
|
62
|
+
*/
|
|
63
|
+
export declare function satelliteGlide(from: GlidePose, to: GlidePose, ease: number, floorKm?: number): GlidePose;
|
|
64
|
+
/**
|
|
65
|
+
* How far, in km, the camera goes in the glide from one satellite's ride to another's (`satelliteGlide`): along the great circle, with the change of height. For a glide whose length follows the distance (`rideGlideMs`).
|
|
66
|
+
*
|
|
67
|
+
* @param from - Where the glide begins, Earth radii from the Earth's centre.
|
|
68
|
+
* @param to - Where it ends.
|
|
69
|
+
* @returns The length, km.
|
|
70
|
+
*
|
|
71
|
+
* @example
|
|
72
|
+
* ```ts
|
|
73
|
+
* import { satelliteGlideKm } from "@johnmorrisdotca/chikyu-earth/space";
|
|
74
|
+
*
|
|
75
|
+
* console.log(Math.round(satelliteGlideKm([1.07, 0, 0], [0, 1.07, 0])));
|
|
76
|
+
* ```
|
|
77
|
+
*/
|
|
78
|
+
export declare function satelliteGlideKm(from: Vec3, to: Vec3): number;
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The least height above the ground, in km, that the glide from one satellite's ride to another's keeps between its two ends (`satelliteGlide`). Ends lower than this (a satellite coming down) are left
|
|
3
|
+
* where they are and the glide rises over the floor between them.
|
|
4
|
+
*
|
|
5
|
+
* @example
|
|
6
|
+
* ```ts
|
|
7
|
+
* import { GLIDE_FLOOR_KM } from "@johnmorrisdotca/chikyu-earth/space";
|
|
8
|
+
*
|
|
9
|
+
* console.log(`${GLIDE_FLOOR_KM} km`);
|
|
10
|
+
* ```
|
|
11
|
+
*/
|
|
12
|
+
export const GLIDE_FLOOR_KM = 100;
|
|
13
|
+
const EARTH_KM = 6371;
|
|
14
|
+
const dot = (a, b) => a[0] * b[0] + a[1] * b[1] + a[2] * b[2];
|
|
15
|
+
const cross = (a, b) => [a[1] * b[2] - a[2] * b[1], a[2] * b[0] - a[0] * b[2], a[0] * b[1] - a[1] * b[0]];
|
|
16
|
+
const norm = (a) => Math.hypot(a[0], a[1], a[2]);
|
|
17
|
+
/** `a` then `b`: the rotation `b` followed by `a` (`a * b`). */
|
|
18
|
+
function mul(a, b) {
|
|
19
|
+
return [
|
|
20
|
+
a[3] * b[0] + a[0] * b[3] + a[1] * b[2] - a[2] * b[1],
|
|
21
|
+
a[3] * b[1] - a[0] * b[2] + a[1] * b[3] + a[2] * b[0],
|
|
22
|
+
a[3] * b[2] + a[0] * b[1] - a[1] * b[0] + a[2] * b[3],
|
|
23
|
+
a[3] * b[3] - a[0] * b[0] - a[1] * b[1] - a[2] * b[2],
|
|
24
|
+
];
|
|
25
|
+
}
|
|
26
|
+
/** The rotation by `angle` radians about the unit `axis`. */
|
|
27
|
+
const about = (axis, angle) => { const s = Math.sin(angle / 2); return [axis[0] * s, axis[1] * s, axis[2] * s, Math.cos(angle / 2)]; };
|
|
28
|
+
/** The shorter way from `a` to `b`, a share `t` along it, normalised. */
|
|
29
|
+
function slerp(a, b, t) {
|
|
30
|
+
let c = a[0] * b[0] + a[1] * b[1] + a[2] * b[2] + a[3] * b[3];
|
|
31
|
+
const s = c < 0 ? -1 : 1;
|
|
32
|
+
c *= s;
|
|
33
|
+
let ka = 1 - t, kb = t * s;
|
|
34
|
+
if (c < 0.9995) {
|
|
35
|
+
const half = Math.acos(Math.min(1, c)), sin = Math.sin(half);
|
|
36
|
+
ka = Math.sin((1 - t) * half) / sin;
|
|
37
|
+
kb = (Math.sin(t * half) / sin) * s;
|
|
38
|
+
}
|
|
39
|
+
const out = [a[0] * ka + b[0] * kb, a[1] * ka + b[1] * kb, a[2] * ka + b[2] * kb, a[3] * ka + b[3] * kb];
|
|
40
|
+
const n = Math.hypot(...out) || 1;
|
|
41
|
+
return [out[0] / n, out[1] / n, out[2] / n, out[3] / n];
|
|
42
|
+
}
|
|
43
|
+
/** The great circle from the direction of `a` to that of `b` (both from the Earth's centre): the axis it turns about and the angle, radians. Opposite directions turn about a line square to `a`. */
|
|
44
|
+
function greatCircle(a, b) {
|
|
45
|
+
const c = cross(a, b), sin = norm(c), cos = dot(a, b);
|
|
46
|
+
const angle = Math.atan2(sin, cos);
|
|
47
|
+
if (sin > 1e-9 * norm(a) * norm(b))
|
|
48
|
+
return { axis: [c[0] / sin, c[1] / sin, c[2] / sin], angle };
|
|
49
|
+
if (cos >= 0)
|
|
50
|
+
return { axis: [0, 0, 1], angle: 0 };
|
|
51
|
+
const side = Math.abs(a[1]) < 0.9 * norm(a) ? cross(a, [0, 1, 0]) : cross(a, [1, 0, 0]);
|
|
52
|
+
const n = norm(side);
|
|
53
|
+
return { axis: [side[0] / n, side[1] / n, side[2] / n], angle };
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Where the camera is, a share `ease` (0 to 1) along the glide from one satellite's ride to another's. It goes along the great circle round the Earth's centre from the first place to the second, its distance from
|
|
57
|
+
* the centre going evenly from the one to the other, so it never passes through the Earth or dips under the two heights; between ends lower than `floorKm` above the ground it rises over that floor in the middle.
|
|
58
|
+
* The look is carried along the circle (turned with it, as the local vertical turns) and goes over the way from the first look to the second in the same frame, so a facing along the ground stays level, a facing
|
|
59
|
+
* down stays down, nothing rolls over, and the view turns once towards its end. The glide back is the same glide the other way: `satelliteGlide(to, from, 1 - ease)` is the same pose. A short hop is all but the
|
|
60
|
+
* straight glide: the circle is about 10 m from the straight line half way along a hop of 25 km.
|
|
61
|
+
*
|
|
62
|
+
* @param from - The camera where the glide began.
|
|
63
|
+
* @param to - The camera of the ride it goes to (its pose this frame: the satellite may move).
|
|
64
|
+
* @param ease - How far along, 0 at the start and 1 at the end (eased by the caller).
|
|
65
|
+
* @param floorKm - The least height above the ground between the ends, km (`GLIDE_FLOOR_KM`).
|
|
66
|
+
* @returns The camera's place and orientation there.
|
|
67
|
+
*
|
|
68
|
+
* @example
|
|
69
|
+
* ```ts
|
|
70
|
+
* import { satelliteGlide } from "@johnmorrisdotca/chikyu-earth/space";
|
|
71
|
+
*
|
|
72
|
+
* // from over one side of the Earth to over the other: half way, the camera is over the Earth's edge, not inside it
|
|
73
|
+
* const mid = satelliteGlide({ p: [1.07, 0, 0], q: [0, 0, 0, 1] }, { p: [-1.07, 0, 0.01], q: [0, 0, 0, 1] }, 0.5);
|
|
74
|
+
* console.log(Math.hypot(...mid.p).toFixed(2));
|
|
75
|
+
* ```
|
|
76
|
+
*/
|
|
77
|
+
export function satelliteGlide(from, to, ease, floorKm = GLIDE_FLOOR_KM) {
|
|
78
|
+
const r0 = norm(from.p), r1 = norm(to.p);
|
|
79
|
+
if (r0 < 1e-9 || r1 < 1e-9)
|
|
80
|
+
return { p: [...to.p], q: [...to.q] };
|
|
81
|
+
const { axis, angle } = greatCircle(from.p, to.p);
|
|
82
|
+
const turn = about(axis, angle * ease);
|
|
83
|
+
const along = [from.p[0] / r0, from.p[1] / r0, from.p[2] / r0];
|
|
84
|
+
const c = Math.cos(angle * ease), s = Math.sin(angle * ease), k = dot(axis, along) * (1 - c), side = cross(axis, along);
|
|
85
|
+
const u = [along[0] * c + side[0] * s + axis[0] * k, along[1] * c + side[1] * s + axis[1] * k, along[2] * c + side[2] * s + axis[2] * k];
|
|
86
|
+
const floor = 1 + Math.max(0, floorKm) / EARTH_KM;
|
|
87
|
+
const lift = Math.max(0, floor - Math.min(r0, r1)) * Math.sin(Math.PI * Math.min(1, Math.max(0, ease)));
|
|
88
|
+
const r = r0 + (r1 - r0) * ease + lift;
|
|
89
|
+
// the second look, as it would be at the first place (turned back along the circle), then the way between the two looks, turned on to where the camera is
|
|
90
|
+
const back = [-axis[0] * Math.sin(angle / 2), -axis[1] * Math.sin(angle / 2), -axis[2] * Math.sin(angle / 2), Math.cos(angle / 2)];
|
|
91
|
+
const q = mul(turn, slerp(from.q, mul(back, to.q), ease));
|
|
92
|
+
return { p: [u[0] * r, u[1] * r, u[2] * r], q };
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* How far, in km, the camera goes in the glide from one satellite's ride to another's (`satelliteGlide`): along the great circle, with the change of height. For a glide whose length follows the distance (`rideGlideMs`).
|
|
96
|
+
*
|
|
97
|
+
* @param from - Where the glide begins, Earth radii from the Earth's centre.
|
|
98
|
+
* @param to - Where it ends.
|
|
99
|
+
* @returns The length, km.
|
|
100
|
+
*
|
|
101
|
+
* @example
|
|
102
|
+
* ```ts
|
|
103
|
+
* import { satelliteGlideKm } from "@johnmorrisdotca/chikyu-earth/space";
|
|
104
|
+
*
|
|
105
|
+
* console.log(Math.round(satelliteGlideKm([1.07, 0, 0], [0, 1.07, 0])));
|
|
106
|
+
* ```
|
|
107
|
+
*/
|
|
108
|
+
export function satelliteGlideKm(from, to) {
|
|
109
|
+
const r0 = norm(from), r1 = norm(to);
|
|
110
|
+
const { angle } = greatCircle(from, to);
|
|
111
|
+
return Math.hypot(angle * (r0 + r1) / 2, r1 - r0) * EARTH_KM;
|
|
112
|
+
}
|
package/dist/space/scene.d.ts
CHANGED
|
@@ -243,7 +243,10 @@ export interface SpaceModel {
|
|
|
243
243
|
ride: RideState | null;
|
|
244
244
|
/** Set at each draw: the target of the ride could not be placed (a satellite whose elements are too old, or that is gone), so the ordinary camera was used. */
|
|
245
245
|
rideLost: boolean;
|
|
246
|
-
/**
|
|
246
|
+
/**
|
|
247
|
+
* A camera move in progress from where the last draw left it: when it began (ms of the page's clock), how long it takes. `round`: a ride that went from one satellite to another, which glides along the great circle
|
|
248
|
+
* round the Earth's centre (`satelliteGlide`); every other move is a straight line.
|
|
249
|
+
*/
|
|
247
250
|
transition: {
|
|
248
251
|
start: number;
|
|
249
252
|
duration: number;
|
|
@@ -251,6 +254,7 @@ export interface SpaceModel {
|
|
|
251
254
|
minMs: number;
|
|
252
255
|
maxMs: number;
|
|
253
256
|
};
|
|
257
|
+
round?: boolean;
|
|
254
258
|
from: {
|
|
255
259
|
p: Vec3;
|
|
256
260
|
q: [number, number, number, number];
|
package/dist/space/scene.js
CHANGED
|
@@ -7,6 +7,7 @@ import { createTileSet } from "../realistic/tile-set.js";
|
|
|
7
7
|
import { createTrack, orbitPath, PLANETS } from "./ephemeris.js";
|
|
8
8
|
import { placeAround, placeMoon, placeSun, RADIUS } from "./scale.js";
|
|
9
9
|
import { faceOffset, outsidePose, rideGlideMs, ridePose } from "./ride.js";
|
|
10
|
+
import { satelliteGlide, satelliteGlideKm } from "./ride-glide.js";
|
|
10
11
|
import { stripLights } from "./model-lights.js";
|
|
11
12
|
import { cloudFade, CLOUD_FADE_DEFAULT, CLOUD_WIDTH } from "../realistic/cloud-fade.js";
|
|
12
13
|
import { newLightFade, stepLightFade } from "../realistic/light-fade.js";
|
|
@@ -774,16 +775,24 @@ export function createSpaceItem(model, deps) {
|
|
|
774
775
|
if (glide) {
|
|
775
776
|
// a glide that follows the distance takes its length from how far the camera has to go, at its first frame
|
|
776
777
|
if (glide.scaled) {
|
|
777
|
-
const km = Math.hypot(camera.position.x - glide.from.p[0], camera.position.y - glide.from.p[1], camera.position.z - glide.from.p[2]) * 6371;
|
|
778
|
+
const km = glide.round ? satelliteGlideKm(glide.from.p, [camera.position.x, camera.position.y, camera.position.z]) : Math.hypot(camera.position.x - glide.from.p[0], camera.position.y - glide.from.p[1], camera.position.z - glide.from.p[2]) * 6371;
|
|
778
779
|
glide.duration = rideGlideMs(km, glide.scaled.minMs, glide.scaled.maxMs);
|
|
779
780
|
delete glide.scaled;
|
|
780
781
|
}
|
|
781
782
|
const k = Math.min(1, (performance.now() - glide.start) / glide.duration);
|
|
782
783
|
const ease = k * k * (3 - 2 * k);
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
784
|
+
if (glide.round) {
|
|
785
|
+
// from one satellite to another: round the Earth along the great circle, the look carried with it, so it never goes through the Earth and a facing stays level
|
|
786
|
+
const at = satelliteGlide(glide.from, { p: [camera.position.x, camera.position.y, camera.position.z], q: [camera.quaternion.x, camera.quaternion.y, camera.quaternion.z, camera.quaternion.w] }, ease);
|
|
787
|
+
camera.position.set(at.p[0], at.p[1], at.p[2]);
|
|
788
|
+
camera.quaternion.set(at.q[0], at.q[1], at.q[2], at.q[3]);
|
|
789
|
+
}
|
|
790
|
+
else {
|
|
791
|
+
desiredQ.copy(camera.quaternion);
|
|
792
|
+
camera.position.set(glide.from.p[0] + (camera.position.x - glide.from.p[0]) * ease, glide.from.p[1] + (camera.position.y - glide.from.p[1]) * ease, glide.from.p[2] + (camera.position.z - glide.from.p[2]) * ease);
|
|
793
|
+
fromQ.set(glide.from.q[0], glide.from.q[1], glide.from.q[2], glide.from.q[3]);
|
|
794
|
+
camera.quaternion.copy(fromQ.slerp(desiredQ, ease));
|
|
795
|
+
}
|
|
787
796
|
fovNow = glide.from.fov + (fovNow - glide.from.fov) * ease;
|
|
788
797
|
if (k >= 1)
|
|
789
798
|
model.transition = null;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@johnmorrisdotca/chikyu-earth",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.65.0",
|
|
4
4
|
"description": "Chikyu Earth 地球 — A line-drawn globe for the web: country outlines that turn at the Earth's own rate, centred on the place you give it, with an optional realistic Earth from space (three.js), the Sun, Moon and planets, satellites on their orbits, and markers for any place. A web component and an SVG string.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"earth",
|