3d-spinner 0.9.3 → 0.9.5

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.
Files changed (62) hide show
  1. package/dist/animations/charged-orb.js +4 -2
  2. package/dist/animations/ghost-train.d.ts +72 -0
  3. package/dist/animations/ghost-train.js +249 -0
  4. package/dist/animations/grid-assembly.d.ts +11 -8
  5. package/dist/animations/grid-assembly.js +44 -30
  6. package/dist/animations/rocket-launch.d.ts +58 -0
  7. package/dist/animations/rocket-launch.js +375 -0
  8. package/dist/animations/spin.d.ts +3 -1
  9. package/dist/animations/spin.js +6 -1
  10. package/dist/cjs/animations/charged-orb.cjs +170 -28
  11. package/dist/cjs/animations/grid-assembly.cjs +192 -172
  12. package/dist/cjs/animations/object-motion.cjs +156 -24
  13. package/dist/cjs/animations/particles.cjs +167 -26
  14. package/dist/cjs/animations/spin.cjs +169 -27
  15. package/dist/cjs/engines/little-3d-engine/little-3d-engine.cjs +215 -55
  16. package/dist/cjs/engines/little-3d-engine/loaders/obj.cjs +51 -13
  17. package/dist/cjs/engines/little-3d-engine/renderers/canvas2d-textured.cjs +56 -6
  18. package/dist/cjs/engines/little-3d-engine/renderers/webgl-textured.cjs +55 -6
  19. package/dist/cjs/engines/little-3d-engine/renderers/webgpu-textured.cjs +64 -11
  20. package/dist/cjs/prefabs/prefabs.cjs +817 -205
  21. package/dist/engines/little-3d-engine/core/geometry.d.ts +15 -2
  22. package/dist/engines/little-3d-engine/core/geometry.js +25 -3
  23. package/dist/engines/little-3d-engine/core/light.d.ts +28 -4
  24. package/dist/engines/little-3d-engine/core/light.js +48 -7
  25. package/dist/engines/little-3d-engine/core/mesh.d.ts +33 -0
  26. package/dist/engines/little-3d-engine/core/mesh.js +12 -0
  27. package/dist/engines/little-3d-engine/little-3d-engine.d.ts +2 -2
  28. package/dist/engines/little-3d-engine/little-3d-engine.js +1 -1
  29. package/dist/engines/little-3d-engine/loaders/obj.d.ts +8 -7
  30. package/dist/engines/little-3d-engine/loaders/obj.js +74 -20
  31. package/dist/engines/little-3d-engine/renderers/canvas2d.js +23 -1
  32. package/dist/engines/little-3d-engine/renderers/webgl.js +34 -5
  33. package/dist/engines/little-3d-engine/renderers/webgpu.js +43 -10
  34. package/dist/engines/little-3d-engine/shapes/complex/plane.d.ts +8 -3
  35. package/dist/engines/little-3d-engine/shapes/complex/plane.js +10 -4
  36. package/dist/engines/little-3d-engine/shapes/primitives/cube.d.ts +3 -2
  37. package/dist/engines/little-3d-engine/shapes/primitives/cube.js +4 -2
  38. package/dist/engines/little-3d-engine/shapes/primitives/octahedron.d.ts +3 -2
  39. package/dist/engines/little-3d-engine/shapes/primitives/octahedron.js +4 -2
  40. package/dist/engines/little-3d-engine/shapes/primitives/pyramid.d.ts +3 -2
  41. package/dist/engines/little-3d-engine/shapes/primitives/pyramid.js +4 -2
  42. package/dist/engines/little-3d-engine/shapes/primitives/quad.d.ts +3 -2
  43. package/dist/engines/little-3d-engine/shapes/primitives/quad.js +4 -2
  44. package/dist/engines/little-3d-engine/shapes/primitives/spheres/cube-sphere.d.ts +3 -2
  45. package/dist/engines/little-3d-engine/shapes/primitives/spheres/cube-sphere.js +4 -2
  46. package/dist/engines/little-3d-engine/shapes/primitives/spheres/icosphere.d.ts +3 -2
  47. package/dist/engines/little-3d-engine/shapes/primitives/spheres/icosphere.js +4 -2
  48. package/dist/engines/little-3d-engine/shapes/primitives/spheres/octa-sphere.d.ts +3 -2
  49. package/dist/engines/little-3d-engine/shapes/primitives/spheres/octa-sphere.js +4 -2
  50. package/dist/engines/little-3d-engine/shapes/primitives/spheres/uv-sphere.d.ts +3 -2
  51. package/dist/engines/little-3d-engine/shapes/primitives/spheres/uv-sphere.js +4 -2
  52. package/dist/engines/little-3d-engine/shapes/primitives/tetrahedron.d.ts +3 -2
  53. package/dist/engines/little-3d-engine/shapes/primitives/tetrahedron.js +4 -2
  54. package/dist/engines/little-3d-engine/textures/dynamic/star.d.ts +14 -2
  55. package/dist/engines/little-3d-engine/textures/dynamic/star.js +26 -11
  56. package/dist/prefabs/ghost-train.d.ts +5 -4
  57. package/dist/prefabs/ghost-train.js +17 -24
  58. package/dist/prefabs/rocket-launch.d.ts +7 -5
  59. package/dist/prefabs/rocket-launch.js +10 -53
  60. package/dist/umd/spinner.global.js +877 -167
  61. package/dist/umd/spinner.global.min.js +58 -17
  62. package/package.json +2 -2
@@ -1,8 +1,10 @@
1
1
  import type { ProgressSpinnerOptions } from "../index.js";
2
- import type { MotionProgressPrefabOptions } from "./types.js";
2
+ import type { ProgressPrefabOptions } from "./types.js";
3
3
  /**
4
- * A progress story: a silver rocket glides in and patrols a slow loop on a
5
- * column of embers while progress climbs; at 100% it pitches up and blasts off
6
- * the top of the view, exhaust trailing behind it.
4
+ * A progress story on a launch pad: every 5% of progress a small rocket slides
5
+ * in cartoon-style from the right and lines up under the progress text, idling
6
+ * on a thin wisp of smoke. At 100% the whole row blasts off in a loose stagger
7
+ * on columns of fire; partway up, three of them suddenly veer 30-50 degrees and
8
+ * streak away.
7
9
  */
8
- export declare function rocketLaunch(options?: MotionProgressPrefabOptions): ProgressSpinnerOptions;
10
+ export declare function rocketLaunch(options?: ProgressPrefabOptions): ProgressSpinnerOptions;
@@ -1,59 +1,16 @@
1
- import { CompositeAnimation } from "../composite-animation.js";
2
- import { ObjectMotionAnimation } from "../animations/object-motion.js";
3
- import { ParticlesAnimation } from "../animations/particles.js";
4
- import { pyramid, shineTexture } from "../engines/little-3d-engine/little-3d-engine.js";
5
- import { easeInCubic } from "../engines/little-tween-engine/core/tweens.js";
6
- import { circleMotion } from "../motion/circle.js";
1
+ import { RocketLaunchAnimation } from "../animations/rocket-launch.js";
7
2
  import { progressSpinner } from "./spinner.js";
8
- // C1 launch: the handoff velocity coasts to a stop while the vertical climb
9
- // accelerates, so the nose rotates smoothly from the patrol tangent to straight up.
10
- const launchUp = ({ delta, position, velocity, durationMs }) => {
11
- const coast = durationMs * delta * (1 - 0.5 * delta);
12
- const climb = 5.5 * easeInCubic(delta);
13
- return {
14
- position: {
15
- x: position.x + (velocity?.x ?? 0) * coast,
16
- y: position.y + (velocity?.y ?? 0) * coast + climb,
17
- z: position.z + (velocity?.z ?? 0) * coast,
18
- },
19
- };
20
- };
21
3
  /**
22
- * A progress story: a silver rocket glides in and patrols a slow loop on a
23
- * column of embers while progress climbs; at 100% it pitches up and blasts off
24
- * the top of the view, exhaust trailing behind it.
4
+ * A progress story on a launch pad: every 5% of progress a small rocket slides
5
+ * in cartoon-style from the right and lines up under the progress text, idling
6
+ * on a thin wisp of smoke. At 100% the whole row blasts off in a loose stagger
7
+ * on columns of fire; partway up, three of them suddenly veer 30-50 degrees and
8
+ * streak away.
25
9
  */
26
10
  export function rocketLaunch(options = {}) {
27
- const motion = options.object?.motion
28
- ?? circleMotion({ radius: 0.55, periodMs: 7000, tilt: 0.15 });
29
- const particles = options.particles ?? {};
30
- const object = new ObjectMotionAnimation({
31
- mesh: () => pyramid(1, ["#e2e8f0", "#f8fafc", "#cbd5e1", "#94a3b8", "#e2e8f0"]),
32
- motion,
33
- size: 0.44,
34
- facing: "+y",
35
- outro: { transition: launchUp, durationMs: 1300 },
11
+ return progressSpinner(new RocketLaunchAnimation({
36
12
  backend: options.backend,
37
- ...options.object,
38
- label: options.object?.label,
39
- });
40
- const exhaust = new ParticlesAnimation({
41
- rate: 46,
42
- lifeMs: 1100,
43
- size: 0.18,
44
- speed: 0.5,
45
- direction: { x: 0, y: -1, z: 0 },
46
- spread: 0.3,
47
- gravity: { x: 0, y: -0.6, z: 0 },
48
- colors: ["#fde047", "#fb923c", "#ef4444", "#fef3c7"],
49
- texture: particles.texture ?? shineTexture(),
50
- emitter: object.trailEmitter(),
51
- outroMs: object.outroDurationMs,
52
- seed: 9,
53
- backend: options.backend,
54
- ...particles,
55
- label: options.label ?? particles.label,
56
- fadeLabel: options.fadeLabel ?? particles.fadeLabel,
57
- });
58
- return progressSpinner(new CompositeAnimation([exhaust, object]), options);
13
+ label: options.label,
14
+ fadeLabel: options.fadeLabel,
15
+ }), options);
59
16
  }