@johnmorrisdotca/chikyu-earth 0.29.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 CHANGED
@@ -2,6 +2,10 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ ## 0.30.0 - 2026-11-11
6
+
7
+ - **A strength setting for the meteors** (MODULES-906). `meteors-strength` (the property `meteorsStrength`) on `<chikyu-earth-realistic>` and `<chikyu-space>` is a number from 0 to 1 that scales how bright each streak is and how many are drawn, so a page can show them subtly. It is 1, the look they have always had, when the page says nothing; a number outside the range is brought to its nearest end and one that is not a number is 1. At 0 no streak is drawn, and the line under the picture, the survey of the sky and `chikyu-meteors` are as they were. Nothing that is real changes at any strength: the hourly rates and the showers' `zhr` are the same, and the line still says the streaks are an illustration. `stats.meteors` gains `strength` (and its `perSecond` is the streaks a second drawn, so it follows the strength). New in `@johnmorrisdotca/chikyu-earth/meteors`: `readMeteorStrength`, `METEOR_STRENGTH_DEFAULT`, and `streaksPerSecond(rate, strength)`. The demo has a Subtle, Medium and Full choice beside the Meteors button (`meteors-strength` in the address). The guide, in English and Japanese, has a section on it.
8
+
5
9
  ## 0.29.0 - 2026-11-11
6
10
 
7
11
  - **The air is drawn 3 times its real thickness unless a page says otherwise, so the ring can be seen** (MODULES-904). At whole-Earth zoom the true 100 km shell is a line a pixel or two wide, and on a phone thinner than the old painted glow. `air-thickness` (and the property `airThickness`) on `<chikyu-earth-realistic>` and `<chikyu-space>` takes a number from 1 (the true thickness) to 5, and 3 when left out; the shell and the heights over which the air thins grow by it and the air is the same amount, so the physics and the colours do not change. While it is above 1 the element says so in a line under the picture, "The air is drawn 3 times its real thickness so it can be seen." (and in Japanese), which `air-label="off"` takes away. New exports `AIR_THICKNESS_DEFAULT`, `AIR_THICKNESS_MAX`, `readAirThickness`, `airTop` and `AIR_NOTE`. The demo has a True air thickness button on the realistic and space looks and on the full-screen page (`air-thickness=1` in the address). The cost is the same: a draw is the same program with one more uniform. Tests: `test/air.test.ts`, `e2e/air-visible.gl.ts`.
package/README.md CHANGED
@@ -189,7 +189,7 @@ computed in the browser by astronomy-engine (MIT), nothing is fetched. [docs/spa
189
189
 
190
190
  ## Meteors
191
191
 
192
- `<chikyu-earth-realistic meteors>` and `<chikyu-space meteors>` draw meteors as they look from space: short streaks 80 to 120 km up, only on the dark side and in twilight, more of them under an active shower's radiant, and only while the clock runs. Each streak's place and moment are drawn at random, and the element says so under the picture; how many there are, where they fall, their height and the showers' dates are real. The showers are the International Meteor Organization's working list for 2026 (37 of them), in an entry point of its own with the rate functions, which needs no browser: [guide](docs/guides/meteors.md).
192
+ `<chikyu-earth-realistic meteors>` and `<chikyu-space meteors>` draw meteors as they look from space: short streaks 80 to 120 km up, only on the dark side and in twilight, more of them under an active shower's radiant, and only while the clock runs. Each streak's place and moment are drawn at random, and the element says so under the picture; how many there are, where they fall, their height and the showers' dates are real. `meteors-strength` (0 to 1, the property `meteorsStrength`; 1 when you say nothing) makes them subtler: fewer streaks and fainter ones, none at 0, with every real figure unchanged. The showers are the International Meteor Organization's working list for 2026 (37 of them), in an entry point of its own with the rate functions, which needs no browser: [guide](docs/guides/meteors.md).
193
193
 
194
194
  ```js
195
195
  import { activeShowers } from "@johnmorrisdotca/chikyu-earth/meteors";
@@ -489,7 +489,7 @@ console.log(countryList().filter((country) => country.alpha2 === null).map((coun
489
489
 
490
490
  ## How to cite
491
491
 
492
- > Morris, J. (2026). *Chikyu Earth* (version 0.29.0) [Computer software]. https://github.com/johnmorrisdotca/chikyu-earth
492
+ > Morris, J. (2026). *Chikyu Earth* (version 0.30.0) [Computer software]. https://github.com/johnmorrisdotca/chikyu-earth
493
493
 
494
494
  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.
495
495
 
@@ -1,3 +1,4 @@
1
1
  export { METEOR_SHOWERS, type MeteorShower } from "../data/meteor-showers.ts";
2
2
  export { METEOR_HEIGHT_KM, SPORADIC_HOURLY_RATE, activeShowers, apexPoint, darkness, hourlyRateAt, meteorSky, placeVector, pointBeneath, showerRate, solarLongitude, type MeteorSky } from "./rate.ts";
3
3
  export { METEORS_PER_SECOND_MAX, METEOR_SLOTS, streakPath, streaksPerSecond } from "./layer.ts";
4
+ export { METEOR_STRENGTH_DEFAULT, readMeteorStrength } from "./strength.ts";
@@ -4,3 +4,4 @@
4
4
  export { METEOR_SHOWERS } from "../data/meteor-showers.js";
5
5
  export { METEOR_HEIGHT_KM, SPORADIC_HOURLY_RATE, activeShowers, apexPoint, darkness, hourlyRateAt, meteorSky, placeVector, pointBeneath, showerRate, solarLongitude } from "./rate.js";
6
6
  export { METEORS_PER_SECOND_MAX, METEOR_SLOTS, streakPath, streaksPerSecond } from "./layer.js";
7
+ export { METEOR_STRENGTH_DEFAULT, readMeteorStrength } from "./strength.js";
@@ -32,6 +32,8 @@ export interface MeteorState {
32
32
  running: () => boolean;
33
33
  /** Told when the strongest active shower changes, with `null` when none is active. */
34
34
  onShower?: (shower: MeteorShower | null, zhr: number) => void;
35
+ /** How strongly the streaks are drawn, 0 to 1 (`meteors-strength`): it scales how many start and how bright they are, and nothing that is real. 0 draws none. */
36
+ strength: number;
35
37
  random: () => number;
36
38
  drawn: {
37
39
  alive: number;
@@ -66,18 +68,20 @@ export interface MeteorLayer {
66
68
  * How many streaks a second are drawn for a mean hourly rate over the dark part of the view: 2.5 a second where the whole view is dark on a
67
69
  * night with no shower, more with a shower but squeezed (the 0.6th power) and never over nine, none where nothing in view is dark.
68
70
  * A streak stands for a great many meteors: the count follows the real rate, it does not equal it.
71
+ * `strength` (0 to 1, the page's `meteors-strength`) then scales the count: half the streaks at 0.5, none at 0.
69
72
  *
70
73
  * @param meanHourlyRate - The mean over the view of each place's hourly rate times how dark it is there (`hourlyRateAt`, `darkness`).
74
+ * @param strength - How strongly the streaks are drawn, from 0 to 1 (1 when left out); a number outside the range is brought to its nearest end.
71
75
  * @returns Streaks a second.
72
76
  *
73
77
  * @example
74
78
  * ```ts
75
79
  * import { streaksPerSecond } from "@johnmorrisdotca/chikyu-earth/meteors";
76
80
  *
77
- * console.log(streaksPerSecond(8), streaksPerSecond(0), streaksPerSecond(100000)); // 2.5 0 9
81
+ * console.log(streaksPerSecond(8), streaksPerSecond(0), streaksPerSecond(100000), streaksPerSecond(8, 0.5)); // 2.5 0 9 1.25
78
82
  * ```
79
83
  */
80
- export declare function streaksPerSecond(meanHourlyRate: number): number;
84
+ export declare function streaksPerSecond(meanHourlyRate: number, strength?: number): number;
81
85
  /**
82
86
  * Where one streak runs: from `start` to `end`, in Earth radii from the centre, in the Earth's own axes.
83
87
  * It ends `METEOR_HEIGHT_KM.bottom + 5` km up and comes down the line from the radiant; its true length is the drop in height
@@ -1,4 +1,5 @@
1
1
  import { METEOR_HEIGHT_KM, SPORADIC_HOURLY_RATE, darkness, hourlyRateAt, meteorSky } from "./rate.js";
2
+ import { METEOR_STRENGTH_DEFAULT } from "./strength.js";
2
3
  const EARTH_KM = 6371;
3
4
  /**
4
5
  * The most streaks alive at once: the size of the one mesh they are drawn as.
@@ -37,32 +38,35 @@ const SAMPLES = 160;
37
38
  /** The Earth's radius on the screen, in CSS pixels, below which no streak is drawn. */
38
39
  const MIN_EARTH_PX = 40;
39
40
  const FRAME_MS = 33;
40
- export const newMeteorState = () => ({ on: false, running: () => false, random: Math.random, drawn: { alive: 0, spawned: 0, perSecond: 0, shower: null, zhr: 0 } });
41
+ export const newMeteorState = () => ({ on: false, running: () => false, strength: METEOR_STRENGTH_DEFAULT, random: Math.random, drawn: { alive: 0, spawned: 0, perSecond: 0, shower: null, zhr: 0 } });
41
42
  /**
42
43
  * How many streaks a second are drawn for a mean hourly rate over the dark part of the view: 2.5 a second where the whole view is dark on a
43
44
  * night with no shower, more with a shower but squeezed (the 0.6th power) and never over nine, none where nothing in view is dark.
44
45
  * A streak stands for a great many meteors: the count follows the real rate, it does not equal it.
46
+ * `strength` (0 to 1, the page's `meteors-strength`) then scales the count: half the streaks at 0.5, none at 0.
45
47
  *
46
48
  * @param meanHourlyRate - The mean over the view of each place's hourly rate times how dark it is there (`hourlyRateAt`, `darkness`).
49
+ * @param strength - How strongly the streaks are drawn, from 0 to 1 (1 when left out); a number outside the range is brought to its nearest end.
47
50
  * @returns Streaks a second.
48
51
  *
49
52
  * @example
50
53
  * ```ts
51
54
  * import { streaksPerSecond } from "@johnmorrisdotca/chikyu-earth/meteors";
52
55
  *
53
- * console.log(streaksPerSecond(8), streaksPerSecond(0), streaksPerSecond(100000)); // 2.5 0 9
56
+ * console.log(streaksPerSecond(8), streaksPerSecond(0), streaksPerSecond(100000), streaksPerSecond(8, 0.5)); // 2.5 0 9 1.25
54
57
  * ```
55
58
  */
56
- export function streaksPerSecond(meanHourlyRate) {
57
- if (!(meanHourlyRate > 0))
59
+ export function streaksPerSecond(meanHourlyRate, strength = METEOR_STRENGTH_DEFAULT) {
60
+ if (!(meanHourlyRate > 0) || !(strength > 0))
58
61
  return 0;
59
- return Math.min(METEORS_PER_SECOND_MAX, BASE_PER_SECOND * Math.pow(meanHourlyRate / SPORADIC_HOURLY_RATE, 0.6));
62
+ return Math.min(METEORS_PER_SECOND_MAX, BASE_PER_SECOND * Math.pow(meanHourlyRate / SPORADIC_HOURLY_RATE, 0.6)) * Math.min(1, strength);
60
63
  }
61
64
  const VERT = /* glsl */ `
62
65
  uniform float now;
63
66
  uniform float vw;
64
67
  uniform float vh;
65
68
  uniform float thick;
69
+ uniform float strength;
66
70
  attribute vec3 aStart;
67
71
  attribute vec3 aEnd;
68
72
  attribute vec2 aTime;
@@ -88,7 +92,7 @@ void main() {
88
92
  at.xy += push / halfSize * at.w;
89
93
  // a streak is there from its start to a short afterglow, and nowhere before or after
90
94
  float alive = step(0.0, age) * (1.0 - smoothstep(1.0, 1.35, age));
91
- vFade = alive * aGlow * smoothstep(0.0, 0.12, age);
95
+ vFade = alive * aGlow * strength * smoothstep(0.0, 0.12, age);
92
96
  vAlong = aCorner.x;
93
97
  vSide = aCorner.y;
94
98
  gl_Position = alive > 0.0 ? at : vec4(2.0, 2.0, 2.0, 1.0);
@@ -173,7 +177,7 @@ export function createMeteorLayer(three, parent, state) {
173
177
  geometry.setAttribute("aCorner", new three.BufferAttribute(cornerOf, 2));
174
178
  geometry.setAttribute("aGlow", glowAttr);
175
179
  geometry.setIndex(index);
176
- const uniforms = { now: { value: 0 }, vw: { value: 1 }, vh: { value: 1 }, thick: { value: 1.8 }, tint: { value: new three.Vector3(1, 0.96, 0.86) } };
180
+ const uniforms = { now: { value: 0 }, vw: { value: 1 }, vh: { value: 1 }, thick: { value: 1.8 }, strength: { value: 1 }, tint: { value: new three.Vector3(1, 0.96, 0.86) } };
177
181
  const material = new three.ShaderMaterial({ vertexShader: VERT, fragmentShader: FRAG, uniforms, transparent: true, depthWrite: false, side: three.DoubleSide });
178
182
  const mesh = new three.Mesh(geometry, material);
179
183
  mesh.frustumCulled = false;
@@ -185,6 +189,8 @@ export function createMeteorLayer(three, parent, state) {
185
189
  const over = new Float64Array(METEOR_SLOTS);
186
190
  let sky = null;
187
191
  let skyAt = -Infinity;
192
+ /** The strength the sky was last surveyed at: a new one makes the survey again, so the count follows it at once. */
193
+ let surveyedAt = METEOR_STRENGTH_DEFAULT;
188
194
  let peak = 0;
189
195
  let perSecond = 0;
190
196
  let nextAt = 0;
@@ -210,7 +216,8 @@ export function createMeteorLayer(three, parent, state) {
210
216
  if (weight > peak)
211
217
  peak = weight;
212
218
  }
213
- perSecond = streaksPerSecond(sum / SAMPLES);
219
+ surveyedAt = state.strength;
220
+ perSecond = streaksPerSecond(sum / SAMPLES, surveyedAt);
214
221
  const top = sky.showers[0];
215
222
  state.drawn.perSecond = perSecond;
216
223
  state.drawn.shower = top?.shower.code ?? null;
@@ -296,8 +303,18 @@ export function createMeteorLayer(three, parent, state) {
296
303
  mesh.visible = false;
297
304
  return Infinity;
298
305
  }
299
- if (!sky || Math.abs(input.time - sky.ms) > SKY_GAME_MS || input.now - skyAt > SKY_WALL_MS)
306
+ if (!sky || Math.abs(input.time - sky.ms) > SKY_GAME_MS || input.now - skyAt > SKY_WALL_MS || state.strength !== surveyedAt)
300
307
  survey(input);
308
+ uniforms.strength.value = Math.min(1, Math.max(0, state.strength));
309
+ if (!(state.strength > 0)) {
310
+ // strength 0: the sky is still surveyed (the shower is still told) but no streak starts, and nothing more is asked for
311
+ over.fill(0);
312
+ nextAt = 0;
313
+ last = input.now;
314
+ state.drawn.alive = 0;
315
+ mesh.visible = false;
316
+ return Infinity;
317
+ }
301
318
  if (perSecond > 0) {
302
319
  // after a rest the clock starts again from now, so a pause is not made up for with a burst
303
320
  if (input.now - last > 1000 || nextAt === 0)
@@ -0,0 +1,26 @@
1
+ /**
2
+ * How strongly the meteors are drawn when a page says nothing: 1, the look they have always had. The page's `meteors-strength` attribute chooses.
3
+ *
4
+ * @example
5
+ * ```ts
6
+ * import { METEOR_STRENGTH_DEFAULT } from "@johnmorrisdotca/chikyu-earth/meteors";
7
+ *
8
+ * console.log(METEOR_STRENGTH_DEFAULT); // 1
9
+ * ```
10
+ */
11
+ export declare const METEOR_STRENGTH_DEFAULT = 1;
12
+ /**
13
+ * What a page's `meteors-strength` attribute means: a number from 0 (no streaks are drawn) to 1 (the full look), given as it is written; with none, or something that
14
+ * is not a number, `METEOR_STRENGTH_DEFAULT`. A number outside the range is brought to its nearest end.
15
+ *
16
+ * @param given - The attribute's value, or `null` when the page has none.
17
+ * @returns How strongly the streaks are drawn, between 0 and 1.
18
+ *
19
+ * @example
20
+ * ```ts
21
+ * import { readMeteorStrength } from "@johnmorrisdotca/chikyu-earth/meteors";
22
+ *
23
+ * console.log(readMeteorStrength(null), readMeteorStrength("0.3"), readMeteorStrength("7"), readMeteorStrength("-1"), readMeteorStrength("soft")); // 1 0.3 1 0 1
24
+ * ```
25
+ */
26
+ export declare function readMeteorStrength(given: string | null): number;
@@ -0,0 +1,35 @@
1
+ // How strongly the meteors are drawn: one number from 0 to 1 that a page sets with `meteors-strength`. It scales how bright a streak is and how many are drawn.
2
+ // It changes nothing that is real: the hourly rates, the showers and the `chikyu-meteors` event are the same at every strength.
3
+ /**
4
+ * How strongly the meteors are drawn when a page says nothing: 1, the look they have always had. The page's `meteors-strength` attribute chooses.
5
+ *
6
+ * @example
7
+ * ```ts
8
+ * import { METEOR_STRENGTH_DEFAULT } from "@johnmorrisdotca/chikyu-earth/meteors";
9
+ *
10
+ * console.log(METEOR_STRENGTH_DEFAULT); // 1
11
+ * ```
12
+ */
13
+ export const METEOR_STRENGTH_DEFAULT = 1;
14
+ /**
15
+ * What a page's `meteors-strength` attribute means: a number from 0 (no streaks are drawn) to 1 (the full look), given as it is written; with none, or something that
16
+ * is not a number, `METEOR_STRENGTH_DEFAULT`. A number outside the range is brought to its nearest end.
17
+ *
18
+ * @param given - The attribute's value, or `null` when the page has none.
19
+ * @returns How strongly the streaks are drawn, between 0 and 1.
20
+ *
21
+ * @example
22
+ * ```ts
23
+ * import { readMeteorStrength } from "@johnmorrisdotca/chikyu-earth/meteors";
24
+ *
25
+ * console.log(readMeteorStrength(null), readMeteorStrength("0.3"), readMeteorStrength("7"), readMeteorStrength("-1"), readMeteorStrength("soft")); // 1 0.3 1 0 1
26
+ * ```
27
+ */
28
+ export function readMeteorStrength(given) {
29
+ if (given === null || given.trim() === "")
30
+ return METEOR_STRENGTH_DEFAULT;
31
+ const value = Number(given);
32
+ if (!Number.isFinite(value))
33
+ return METEOR_STRENGTH_DEFAULT;
34
+ return Math.min(1, Math.max(0, value));
35
+ }
@@ -79,6 +79,7 @@ export declare const readTime: (value: string | null) => number | "now";
79
79
  * where they fall, their height and the showers' dates are real (`@johnmorrisdotca/chikyu-earth/meteors`). They run while the clock runs, at any speed, and not
80
80
  * at all while it is held, out of sight, in a hidden tab, or for a reader who prefers reduced motion until the page sets a `speed` (a Play). `chikyu-meteors`
81
81
  * is sent when the strongest active shower changes, with `detail: { shower, zhr }` (`shower` is `null` when none is active).
82
+ * `meteors-strength` (0 to 1, the property `meteorsStrength`; 1 when the page says nothing) makes them subtler: fewer streaks and fainter ones, none at 0, and nothing that is real changes.
82
83
  *
83
84
  * @example
84
85
  * ```ts no-run
@@ -114,6 +115,13 @@ export declare class ChikyuEarthRealistic extends HTMLElement {
114
115
  */
115
116
  get meteors(): boolean;
116
117
  set meteors(value: boolean);
118
+ /**
119
+ * How strongly the meteors are drawn, from 0 to 1 (the attribute `meteors-strength`; 1, the full look, when the page says nothing): it scales how bright each streak is and how many are drawn, so 0.3 is
120
+ * fewer and fainter and 0 draws none. It changes nothing that is real: the rates, the showers and `chikyu-meteors` are the same at every strength, and the line under the picture still says the streaks are an illustration.
121
+ * A number outside the range is brought to its nearest end; setting the property writes the attribute.
122
+ */
123
+ get meteorsStrength(): number;
124
+ set meteorsStrength(value: number);
117
125
  /** The controller behind the element's own hands (`set`, `fit`, `state`), while it is in a page. */
118
126
  get controller(): ViewController | undefined;
119
127
  /** Where the finer map tiles are served from (a folder with `manifest.json`), or `null` for none; the attribute `tiles`. The Earth loads only the tiles in view, over its own pictures. */
@@ -170,6 +178,7 @@ export declare class ChikyuEarthRealistic extends HTMLElement {
170
178
  /** The meteors: whether they are on, the streaks alive now and started so far, the streaks a second being drawn, and the strongest active shower's code and rate. */
171
179
  meteors: {
172
180
  on: boolean;
181
+ strength: number;
173
182
  alive: number;
174
183
  spawned: number;
175
184
  perSecond: number;
@@ -8,6 +8,7 @@ import { NOTES_STYLE, setAirNote } from "./air-note.js";
8
8
  import { cameraCentre, createEarthItem, discRadius, lookAt, newModel } from "./earth.js";
9
9
  import { MAX_SATELLITE_SPEED } from "../satellites/limits.js";
10
10
  import { MAX_ORBIT_GROUP } from "../space/satellite-layer.js";
11
+ import { readMeteorStrength } from "../meteors/strength.js";
11
12
  import { METEOR_NOTE_STYLE, prefersLessMotion, setMeteorNote } from "../meteors/note.js";
12
13
  import { createGate, frameCap } from "./gate.js";
13
14
  import { setSharedRenderer, setThreeLoader, takeRenderer } from "./shared.js";
@@ -104,6 +105,7 @@ export const readTime = (value) => {
104
105
  * where they fall, their height and the showers' dates are real (`@johnmorrisdotca/chikyu-earth/meteors`). They run while the clock runs, at any speed, and not
105
106
  * at all while it is held, out of sight, in a hidden tab, or for a reader who prefers reduced motion until the page sets a `speed` (a Play). `chikyu-meteors`
106
107
  * is sent when the strongest active shower changes, with `detail: { shower, zhr }` (`shower` is `null` when none is active).
108
+ * `meteors-strength` (0 to 1, the property `meteorsStrength`; 1 when the page says nothing) makes them subtler: fewer streaks and fainter ones, none at 0, and nothing that is real changes.
107
109
  *
108
110
  * @example
109
111
  * ```ts no-run
@@ -123,7 +125,7 @@ export const readTime = (value) => {
123
125
  * ```
124
126
  */
125
127
  export class ChikyuEarthRealistic extends HTMLElement {
126
- static observedAttributes = ["cloud-drift", "center", "time", "speed", "clouds", "lights", "light", "live-seconds", "tiles", "camera", "immersive", "meteors", "meteors-label", "air-thickness", "air-label", "lang"];
128
+ static observedAttributes = ["cloud-drift", "center", "time", "speed", "clouds", "lights", "light", "live-seconds", "tiles", "camera", "immersive", "meteors", "meteors-label", "meteors-strength", "air-thickness", "air-label", "lang"];
127
129
  #model = newModel();
128
130
  #mode = "now";
129
131
  #view;
@@ -182,6 +184,7 @@ export class ChikyuEarthRealistic extends HTMLElement {
182
184
  this.#airNote = root.getElementById("air-note");
183
185
  this.#played = false;
184
186
  this.#model.meteors.on = this.#meteorsAsked();
187
+ this.#model.meteors.strength = readMeteorStrength(this.getAttribute("meteors-strength"));
185
188
  this.#model.meteors.running = () => this.speed !== 0 && document.visibilityState !== "hidden" && (this.#played || !prefersLessMotion());
186
189
  this.#model.meteors.onShower = (shower, zhr) => this.dispatchEvent(new CustomEvent("chikyu-meteors", { detail: { shower, zhr } }));
187
190
  this.#meteorNote();
@@ -296,6 +299,10 @@ export class ChikyuEarthRealistic extends HTMLElement {
296
299
  }
297
300
  else if (name === "meteors")
298
301
  this.meteors = this.#meteorsAsked();
302
+ else if (name === "meteors-strength") {
303
+ this.#model.meteors.strength = readMeteorStrength(value);
304
+ this.#gate?.soon();
305
+ }
299
306
  else if (name === "air-thickness") {
300
307
  this.#model.airThickness = readAirThickness(value);
301
308
  this.#gate?.soon();
@@ -340,6 +347,17 @@ export class ChikyuEarthRealistic extends HTMLElement {
340
347
  this.#meteorNote();
341
348
  this.#gate?.soon();
342
349
  }
350
+ /**
351
+ * How strongly the meteors are drawn, from 0 to 1 (the attribute `meteors-strength`; 1, the full look, when the page says nothing): it scales how bright each streak is and how many are drawn, so 0.3 is
352
+ * fewer and fainter and 0 draws none. It changes nothing that is real: the rates, the showers and `chikyu-meteors` are the same at every strength, and the line under the picture still says the streaks are an illustration.
353
+ * A number outside the range is brought to its nearest end; setting the property writes the attribute.
354
+ */
355
+ get meteorsStrength() {
356
+ return this.#model.meteors.strength;
357
+ }
358
+ set meteorsStrength(value) {
359
+ this.setAttribute("meteors-strength", String(value));
360
+ }
343
361
  /** The controller behind the element's own hands (`set`, `fit`, `state`), while it is in a page. */
344
362
  get controller() {
345
363
  return this.#hands?.controller;
@@ -473,7 +491,7 @@ export class ChikyuEarthRealistic extends HTMLElement {
473
491
  contexts: stats?.contexts ?? 0,
474
492
  canvas: stats?.canvas ?? { width: 0, height: 0, pixels: 0 },
475
493
  assets: { entries: stats?.assets.entries ?? 0, refs: stats?.assets.refs ?? 0 },
476
- meteors: { on: this.#model.meteors.on, ...this.#model.meteors.drawn },
494
+ meteors: { on: this.#model.meteors.on, strength: this.#model.meteors.strength, ...this.#model.meteors.drawn },
477
495
  };
478
496
  }
479
497
  /**
@@ -155,6 +155,13 @@ export declare class ChikyuSpace extends HTMLElement {
155
155
  */
156
156
  get meteors(): boolean;
157
157
  set meteors(value: boolean);
158
+ /**
159
+ * How strongly the meteors are drawn, from 0 to 1 (the attribute `meteors-strength`; 1, the full look, when the page says nothing): it scales how bright each streak is and how many are drawn, so 0.3 is
160
+ * fewer and fainter and 0 draws none. It changes nothing that is real: the rates, the showers and `chikyu-meteors` are the same at every strength, and the line under the picture still says the streaks are an illustration.
161
+ * A number outside the range is brought to its nearest end; setting the property writes the attribute.
162
+ */
163
+ get meteorsStrength(): number;
164
+ set meteorsStrength(value: number);
158
165
  /**
159
166
  * How many times its real thickness the air is drawn, from 1 (the true thickness) to 5 (the attribute `air-thickness`; 3 when the page says nothing): see `<chikyu-earth-realistic>`. While it is above 1 the element says so in a line
160
167
  * under the picture (`air-label="off"` takes the line away, for a page that says it itself).
@@ -301,6 +308,7 @@ export declare class ChikyuSpace extends HTMLElement {
301
308
  /** The meteors: whether they are on, the streaks alive now and started so far, the streaks a second being drawn, and the strongest active shower's code and rate. */
302
309
  meteors: {
303
310
  on: boolean;
311
+ strength: number;
304
312
  alive: number;
305
313
  spawned: number;
306
314
  perSecond: number;
@@ -4,6 +4,7 @@ import { airFor, readAirThickness } from "../realistic/air.js";
4
4
  import { createGate, frameCap } from "../realistic/gate.js";
5
5
  import { setThreeLoader, takeRenderer } from "../realistic/shared.js";
6
6
  import { NOTES_STYLE, setAirNote } from "../realistic/air-note.js";
7
+ import { readMeteorStrength } from "../meteors/strength.js";
7
8
  import { METEOR_NOTE_STYLE, prefersLessMotion, setMeteorNote } from "../meteors/note.js";
8
9
  import { MAX_TEXTURE } from "../realistic/tiers.js";
9
10
  import { MAX_SATELLITE_SPEED } from "../satellites/limits.js";
@@ -99,7 +100,7 @@ const STYLE = `:host{display:block;aspect-ratio:1/1;position:relative;overflow:h
99
100
  * ```
100
101
  */
101
102
  export class ChikyuSpace extends HTMLElement {
102
- static observedAttributes = ["cloud-drift", "camera", "earth-size", "earth-x", "earth-y", "center", "time", "speed", "scale", "labels", "orbits", "bodies", "light", "meteors", "meteors-label", "air-thickness", "air-label", "lang"];
103
+ static observedAttributes = ["cloud-drift", "camera", "earth-size", "earth-x", "earth-y", "center", "time", "speed", "scale", "labels", "orbits", "bodies", "light", "meteors", "meteors-label", "meteors-strength", "air-thickness", "air-label", "lang"];
103
104
  #model = newSpaceModel();
104
105
  #mode = "now";
105
106
  #speed = 1;
@@ -160,6 +161,7 @@ export class ChikyuSpace extends HTMLElement {
160
161
  setAirNote(this.#airNote, this, this.#model.airThickness);
161
162
  this.#played = false;
162
163
  this.#model.meteors.on = this.#meteorsAsked();
164
+ this.#model.meteors.strength = readMeteorStrength(this.getAttribute("meteors-strength"));
163
165
  this.#model.meteors.running = () => this.#speed !== 0 && document.visibilityState !== "hidden" && (this.#played || !prefersLessMotion());
164
166
  this.#model.meteors.onShower = (shower, zhr) => this.dispatchEvent(new CustomEvent("chikyu-meteors", { detail: { shower, zhr } }));
165
167
  setMeteorNote(this.#note, this, this.#model.meteors.on);
@@ -253,6 +255,10 @@ export class ChikyuSpace extends HTMLElement {
253
255
  this.earthY = readNumber(value, 0.5, -2, 3);
254
256
  else if (name === "meteors")
255
257
  this.meteors = this.#meteorsAsked();
258
+ else if (name === "meteors-strength") {
259
+ this.#model.meteors.strength = readMeteorStrength(value);
260
+ this.#gate?.request();
261
+ }
256
262
  else if (name === "air-thickness") {
257
263
  this.#model.airThickness = readAirThickness(value);
258
264
  this.#gate?.request();
@@ -286,6 +292,17 @@ export class ChikyuSpace extends HTMLElement {
286
292
  setMeteorNote(this.#note, this, value);
287
293
  this.#gate?.request();
288
294
  }
295
+ /**
296
+ * How strongly the meteors are drawn, from 0 to 1 (the attribute `meteors-strength`; 1, the full look, when the page says nothing): it scales how bright each streak is and how many are drawn, so 0.3 is
297
+ * fewer and fainter and 0 draws none. It changes nothing that is real: the rates, the showers and `chikyu-meteors` are the same at every strength, and the line under the picture still says the streaks are an illustration.
298
+ * A number outside the range is brought to its nearest end; setting the property writes the attribute.
299
+ */
300
+ get meteorsStrength() {
301
+ return this.#model.meteors.strength;
302
+ }
303
+ set meteorsStrength(value) {
304
+ this.setAttribute("meteors-strength", String(value));
305
+ }
289
306
  /**
290
307
  * How many times its real thickness the air is drawn, from 1 (the true thickness) to 5 (the attribute `air-thickness`; 3 when the page says nothing): see `<chikyu-earth-realistic>`. While it is above 1 the element says so in a line
291
308
  * under the picture (`air-label="off"` takes the line away, for a page that says it itself).
@@ -643,7 +660,7 @@ export class ChikyuSpace extends HTMLElement {
643
660
  ride: { riding: this.#model.ride !== null, lost: this.#model.rideLost, gliding: this.#model.transition !== null },
644
661
  camera: { position: [this.#model.pose.p[0], this.#model.pose.p[1], this.#model.pose.p[2]], fov: this.#model.pose.fov },
645
662
  bodies: { look: this.#model.bodies || painter?.looks?.[0] || "plain", painted: this.#model.painted.bodies, moons: this.#model.painted.moons },
646
- meteors: { on: this.#model.meteors.on, ...this.#model.meteors.drawn },
663
+ meteors: { on: this.#model.meteors.on, strength: this.#model.meteors.strength, ...this.#model.meteors.drawn },
647
664
  };
648
665
  }
649
666
  #satelliteStats() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@johnmorrisdotca/chikyu-earth",
3
- "version": "0.29.0",
3
+ "version": "0.30.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 where you are, 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",