@pascal-app/viewer 1.0.3 → 1.0.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 (276) hide show
  1. package/dist/capture/capture-runtime.js +1 -1
  2. package/dist/components/error-boundary.d.ts.map +1 -1
  3. package/dist/components/renderers/node-renderer.d.ts +1 -1
  4. package/dist/components/renderers/node-renderer.d.ts.map +1 -1
  5. package/dist/components/renderers/node-renderer.js +12 -4
  6. package/dist/components/renderers/parametric-node-renderer.d.ts.map +1 -1
  7. package/dist/components/viewer/bvh-ecctrl.d.ts.map +1 -1
  8. package/dist/components/viewer/frame-limiter.d.ts +1 -0
  9. package/dist/components/viewer/frame-limiter.d.ts.map +1 -1
  10. package/dist/components/viewer/frame-limiter.js +22 -3
  11. package/dist/components/viewer/glb-interactive.d.ts +25 -1
  12. package/dist/components/viewer/glb-interactive.d.ts.map +1 -1
  13. package/dist/components/viewer/glb-interactive.js +253 -86
  14. package/dist/components/viewer/glb-mechanisms.d.ts +10 -0
  15. package/dist/components/viewer/glb-mechanisms.d.ts.map +1 -0
  16. package/dist/components/viewer/glb-mechanisms.js +19 -0
  17. package/dist/components/viewer/glb-reference-nodes.js +1 -1
  18. package/dist/components/viewer/glb-replace-instances.js +1 -1
  19. package/dist/components/viewer/glb-scene.d.ts +45 -27
  20. package/dist/components/viewer/glb-scene.d.ts.map +1 -1
  21. package/dist/components/viewer/glb-scene.js +421 -508
  22. package/dist/components/viewer/glb-walkthrough-controller.d.ts +1 -1
  23. package/dist/components/viewer/glb-walkthrough-controller.d.ts.map +1 -1
  24. package/dist/components/viewer/glb-walkthrough-controller.js +13 -2
  25. package/dist/components/viewer/index.d.ts +24 -1
  26. package/dist/components/viewer/index.d.ts.map +1 -1
  27. package/dist/components/viewer/index.js +111 -37
  28. package/dist/components/viewer/lights.d.ts.map +1 -1
  29. package/dist/components/viewer/lights.js +113 -22
  30. package/dist/components/viewer/perf-monitor.d.ts.map +1 -1
  31. package/dist/components/viewer/perf-monitor.js +6 -0
  32. package/dist/components/viewer/perf-panel.d.ts.map +1 -1
  33. package/dist/components/viewer/perf-panel.js +1 -1
  34. package/dist/components/viewer/post-processing.d.ts.map +1 -1
  35. package/dist/components/viewer/post-processing.js +104 -36
  36. package/dist/components/viewer/registered-systems.d.ts.map +1 -1
  37. package/dist/components/viewer/registered-systems.js +17 -3
  38. package/dist/components/viewer/render-error.d.ts +18 -0
  39. package/dist/components/viewer/render-error.d.ts.map +1 -0
  40. package/dist/components/viewer/render-error.js +29 -0
  41. package/dist/components/viewer/scene-bvh.d.ts.map +1 -1
  42. package/dist/components/viewer/scene-bvh.js +1 -1
  43. package/dist/components/viewer/scene-environment.d.ts.map +1 -1
  44. package/dist/components/viewer/scene-environment.js +31 -11
  45. package/dist/components/viewer/scene-ground-replacement.d.ts +6 -0
  46. package/dist/components/viewer/scene-ground-replacement.d.ts.map +1 -1
  47. package/dist/components/viewer/scene-ground-replacement.js +15 -0
  48. package/dist/components/viewer/selection-manager.d.ts.map +1 -1
  49. package/dist/components/viewer/selection-manager.js +25 -7
  50. package/dist/components/viewer/underground-ambiance.d.ts +9 -0
  51. package/dist/components/viewer/underground-ambiance.d.ts.map +1 -0
  52. package/dist/components/viewer/underground-ambiance.js +105 -0
  53. package/dist/components/viewer/viewer-camera.d.ts +4 -0
  54. package/dist/components/viewer/viewer-camera.d.ts.map +1 -1
  55. package/dist/components/viewer/viewer-camera.js +12 -2
  56. package/dist/components/viewer/viewer-presentations.d.ts.map +1 -1
  57. package/dist/hooks/use-gltf-ktx2.d.ts.map +1 -1
  58. package/dist/hooks/use-gltf-ktx2.js +2 -0
  59. package/dist/hooks/use-node-events.d.ts.map +1 -1
  60. package/dist/index.d.ts +36 -16
  61. package/dist/index.d.ts.map +1 -1
  62. package/dist/index.js +34 -19
  63. package/dist/lib/asset-url.d.ts.map +1 -1
  64. package/dist/lib/asset-url.js +7 -1
  65. package/dist/lib/backdrop.d.ts +17 -0
  66. package/dist/lib/backdrop.d.ts.map +1 -1
  67. package/dist/lib/backdrop.js +18 -1
  68. package/dist/lib/construction-dust.d.ts +57 -0
  69. package/dist/lib/construction-dust.d.ts.map +1 -0
  70. package/dist/lib/construction-dust.js +187 -0
  71. package/dist/lib/csg-utils.js +1 -1
  72. package/dist/lib/display-state.d.ts +25 -0
  73. package/dist/lib/display-state.d.ts.map +1 -0
  74. package/dist/lib/display-state.js +1 -0
  75. package/dist/lib/foundation-materials.d.ts +26 -0
  76. package/dist/lib/foundation-materials.d.ts.map +1 -0
  77. package/dist/lib/foundation-materials.js +65 -0
  78. package/dist/lib/gltf-unlit.d.ts +10 -0
  79. package/dist/lib/gltf-unlit.d.ts.map +1 -0
  80. package/dist/lib/gltf-unlit.js +23 -0
  81. package/dist/lib/ground-window.d.ts +33 -0
  82. package/dist/lib/ground-window.d.ts.map +1 -0
  83. package/dist/lib/ground-window.js +114 -0
  84. package/dist/lib/hero-pose.d.ts +13 -3
  85. package/dist/lib/hero-pose.d.ts.map +1 -1
  86. package/dist/lib/hero-pose.js +72 -5
  87. package/dist/lib/ink-edges.d.ts +6 -3
  88. package/dist/lib/ink-edges.d.ts.map +1 -1
  89. package/dist/lib/ink-edges.js +17 -7
  90. package/dist/lib/key-light-override.d.ts +11 -0
  91. package/dist/lib/key-light-override.d.ts.map +1 -0
  92. package/dist/lib/key-light-override.js +14 -0
  93. package/dist/lib/ktx2-loader.d.ts +7 -0
  94. package/dist/lib/ktx2-loader.d.ts.map +1 -1
  95. package/dist/lib/ktx2-loader.js +35 -0
  96. package/dist/lib/layer-pass.d.ts.map +1 -1
  97. package/dist/lib/layers.d.ts +11 -7
  98. package/dist/lib/layers.d.ts.map +1 -1
  99. package/dist/lib/layers.js +16 -6
  100. package/dist/lib/live-frame-hold.d.ts +14 -0
  101. package/dist/lib/live-frame-hold.d.ts.map +1 -0
  102. package/dist/lib/live-frame-hold.js +28 -0
  103. package/dist/lib/materials.d.ts +19 -7
  104. package/dist/lib/materials.d.ts.map +1 -1
  105. package/dist/lib/materials.js +65 -9
  106. package/dist/lib/merged-outline-node.d.ts +5 -0
  107. package/dist/lib/merged-outline-node.d.ts.map +1 -1
  108. package/dist/lib/merged-outline-node.js +80 -2
  109. package/dist/lib/node-top-surface-height.d.ts +6 -0
  110. package/dist/lib/node-top-surface-height.d.ts.map +1 -0
  111. package/dist/lib/node-top-surface-height.js +74 -0
  112. package/dist/lib/perf-probe-state.d.ts +39 -0
  113. package/dist/lib/perf-probe-state.d.ts.map +1 -0
  114. package/dist/lib/perf-probe-state.js +17 -0
  115. package/dist/lib/pointer-events.d.ts +26 -2
  116. package/dist/lib/pointer-events.d.ts.map +1 -1
  117. package/dist/lib/pointer-events.js +99 -12
  118. package/dist/lib/post-processing-resources.d.ts.map +1 -1
  119. package/dist/lib/procedural-emission.d.ts +7 -0
  120. package/dist/lib/procedural-emission.d.ts.map +1 -0
  121. package/dist/lib/procedural-emission.js +54 -0
  122. package/dist/lib/reveal-candidates.d.ts +80 -0
  123. package/dist/lib/reveal-candidates.d.ts.map +1 -0
  124. package/dist/lib/reveal-candidates.js +524 -0
  125. package/dist/lib/reveal-ghost.d.ts +9 -0
  126. package/dist/lib/reveal-ghost.d.ts.map +1 -0
  127. package/dist/lib/reveal-ghost.js +62 -0
  128. package/dist/lib/reveal-pending.d.ts +12 -0
  129. package/dist/lib/reveal-pending.d.ts.map +1 -0
  130. package/dist/lib/reveal-pending.js +12 -0
  131. package/dist/lib/reveal-pose.d.ts +70 -0
  132. package/dist/lib/reveal-pose.d.ts.map +1 -0
  133. package/dist/lib/reveal-pose.js +248 -0
  134. package/dist/lib/reveal-schedule.d.ts +208 -0
  135. package/dist/lib/reveal-schedule.d.ts.map +1 -0
  136. package/dist/lib/reveal-schedule.js +410 -0
  137. package/dist/lib/reveal-texture-scale.d.ts +5 -0
  138. package/dist/lib/reveal-texture-scale.d.ts.map +1 -0
  139. package/dist/lib/reveal-texture-scale.js +113 -0
  140. package/dist/lib/reveal-windows.d.ts +23 -0
  141. package/dist/lib/reveal-windows.d.ts.map +1 -0
  142. package/dist/lib/reveal-windows.js +31 -0
  143. package/dist/lib/reveal-wipe.d.ts +71 -0
  144. package/dist/lib/reveal-wipe.d.ts.map +1 -0
  145. package/dist/lib/reveal-wipe.js +105 -0
  146. package/dist/lib/scene-pass-mrt.d.ts +12 -0
  147. package/dist/lib/scene-pass-mrt.d.ts.map +1 -0
  148. package/dist/lib/scene-pass-mrt.js +23 -0
  149. package/dist/lib/scene-support-height.d.ts +4 -0
  150. package/dist/lib/scene-support-height.d.ts.map +1 -0
  151. package/dist/lib/scene-support-height.js +34 -0
  152. package/dist/lib/scene-themes.d.ts +30 -8
  153. package/dist/lib/scene-themes.d.ts.map +1 -1
  154. package/dist/lib/scene-themes.js +36 -0
  155. package/dist/lib/scene-visibility.d.ts +17 -1
  156. package/dist/lib/scene-visibility.d.ts.map +1 -1
  157. package/dist/lib/scene-visibility.js +53 -3
  158. package/dist/lib/scripted-opening.d.ts +11 -0
  159. package/dist/lib/scripted-opening.d.ts.map +1 -0
  160. package/dist/lib/scripted-opening.js +20 -0
  161. package/dist/lib/site-surfaces.d.ts +32 -0
  162. package/dist/lib/site-surfaces.d.ts.map +1 -0
  163. package/dist/lib/site-surfaces.js +70 -0
  164. package/dist/lib/snapshot-pipeline.d.ts +34 -3
  165. package/dist/lib/snapshot-pipeline.d.ts.map +1 -1
  166. package/dist/lib/snapshot-pipeline.js +247 -117
  167. package/dist/lib/terrain-perimeter-fill.d.ts.map +1 -1
  168. package/dist/lib/terrain-perimeter-fill.js +22 -14
  169. package/dist/lib/tsl-compat.d.ts +2 -2
  170. package/dist/lib/tsl-compat.d.ts.map +1 -1
  171. package/dist/lib/underground-ambiance.d.ts +168 -0
  172. package/dist/lib/underground-ambiance.d.ts.map +1 -0
  173. package/dist/lib/underground-ambiance.js +334 -0
  174. package/dist/lib/zone-geometry.d.ts +11 -0
  175. package/dist/lib/zone-geometry.d.ts.map +1 -0
  176. package/dist/lib/zone-geometry.js +46 -0
  177. package/dist/store/use-item-light-pool.d.ts +14 -10
  178. package/dist/store/use-item-light-pool.d.ts.map +1 -1
  179. package/dist/store/use-item-light-pool.js +52 -26
  180. package/dist/store/use-viewer.d.ts +194 -26
  181. package/dist/store/use-viewer.d.ts.map +1 -1
  182. package/dist/store/use-viewer.js +164 -21
  183. package/dist/systems/ceiling/ceiling-system.d.ts +15 -1
  184. package/dist/systems/ceiling/ceiling-system.d.ts.map +1 -1
  185. package/dist/systems/ceiling/ceiling-system.js +88 -6
  186. package/dist/systems/construction-reveal/construction-dust.d.ts +16 -0
  187. package/dist/systems/construction-reveal/construction-dust.d.ts.map +1 -0
  188. package/dist/systems/construction-reveal/construction-dust.js +92 -0
  189. package/dist/systems/construction-reveal/construction-reveal.d.ts +276 -0
  190. package/dist/systems/construction-reveal/construction-reveal.d.ts.map +1 -0
  191. package/dist/systems/construction-reveal/construction-reveal.js +2383 -0
  192. package/dist/systems/construction-reveal/dust-material.d.ts +10 -0
  193. package/dist/systems/construction-reveal/dust-material.d.ts.map +1 -0
  194. package/dist/systems/construction-reveal/dust-material.js +17 -0
  195. package/dist/systems/construction-reveal/ghost-dress.d.ts +10 -0
  196. package/dist/systems/construction-reveal/ghost-dress.d.ts.map +1 -0
  197. package/dist/systems/construction-reveal/ghost-dress.js +24 -0
  198. package/dist/systems/door/door-system.d.ts.map +1 -1
  199. package/dist/systems/door/door-system.js +55 -17
  200. package/dist/systems/elevator/elevator-interaction-system.d.ts +7 -0
  201. package/dist/systems/elevator/elevator-interaction-system.d.ts.map +1 -1
  202. package/dist/systems/elevator/elevator-interaction-system.js +18 -1
  203. package/dist/systems/floor-elevation/floor-elevation-system.d.ts +3 -1
  204. package/dist/systems/floor-elevation/floor-elevation-system.d.ts.map +1 -1
  205. package/dist/systems/floor-elevation/floor-elevation-system.js +33 -5
  206. package/dist/systems/geometry/geometry-system.d.ts.map +1 -1
  207. package/dist/systems/geometry/geometry-system.js +71 -11
  208. package/dist/systems/interactive/control-widget.d.ts.map +1 -1
  209. package/dist/systems/interactive/interactive-system.d.ts.map +1 -1
  210. package/dist/systems/interactive/interactive-system.js +52 -17
  211. package/dist/systems/interactive/procedural-controls.d.ts +13 -0
  212. package/dist/systems/interactive/procedural-controls.d.ts.map +1 -0
  213. package/dist/systems/interactive/procedural-controls.js +17 -0
  214. package/dist/systems/interactive/scripted-clips.d.ts +19 -0
  215. package/dist/systems/interactive/scripted-clips.d.ts.map +1 -0
  216. package/dist/systems/interactive/scripted-clips.js +134 -0
  217. package/dist/systems/item/item-system.d.ts.map +1 -1
  218. package/dist/systems/item/item-system.js +9 -3
  219. package/dist/systems/item/object-cut-invalidation.d.ts +3 -0
  220. package/dist/systems/item/object-cut-invalidation.d.ts.map +1 -0
  221. package/dist/systems/item/object-cut-invalidation.js +68 -0
  222. package/dist/systems/item-light/item-light-system.d.ts +1 -1
  223. package/dist/systems/item-light/item-light-system.d.ts.map +1 -1
  224. package/dist/systems/item-light/item-light-system.js +48 -53
  225. package/dist/systems/level/level-hold.d.ts +4 -0
  226. package/dist/systems/level/level-hold.d.ts.map +1 -0
  227. package/dist/systems/level/level-hold.js +14 -0
  228. package/dist/systems/level/level-system.d.ts.map +1 -1
  229. package/dist/systems/level/level-system.js +19 -6
  230. package/dist/systems/level/level-utils.d.ts +19 -6
  231. package/dist/systems/level/level-utils.d.ts.map +1 -1
  232. package/dist/systems/level/level-utils.js +68 -9
  233. package/dist/systems/level/shadow-only-levels.d.ts +9 -0
  234. package/dist/systems/level/shadow-only-levels.d.ts.map +1 -0
  235. package/dist/systems/level/shadow-only-levels.js +7 -0
  236. package/dist/systems/roof/__fixtures__/roof-plane-cases.d.ts +103 -0
  237. package/dist/systems/roof/__fixtures__/roof-plane-cases.d.ts.map +1 -0
  238. package/dist/systems/roof/__fixtures__/roof-plane-cases.js +317 -0
  239. package/dist/systems/roof/roof-materials.d.ts +16 -2
  240. package/dist/systems/roof/roof-materials.d.ts.map +1 -1
  241. package/dist/systems/roof/roof-materials.js +64 -31
  242. package/dist/systems/roof/roof-system.d.ts +21 -4
  243. package/dist/systems/roof/roof-system.d.ts.map +1 -1
  244. package/dist/systems/roof/roof-system.js +374 -49
  245. package/dist/systems/slab/slab-system.d.ts +1 -1
  246. package/dist/systems/slab/slab-system.d.ts.map +1 -1
  247. package/dist/systems/slab/slab-system.js +49 -19
  248. package/dist/systems/stair/stair-system.d.ts.map +1 -1
  249. package/dist/systems/stair/stair-system.js +133 -354
  250. package/dist/systems/wall/wall-cutout-cache.d.ts +39 -3
  251. package/dist/systems/wall/wall-cutout-cache.d.ts.map +1 -1
  252. package/dist/systems/wall/wall-cutout-cache.js +141 -19
  253. package/dist/systems/wall/wall-cutout.d.ts +6 -0
  254. package/dist/systems/wall/wall-cutout.d.ts.map +1 -1
  255. package/dist/systems/wall/wall-cutout.js +42 -28
  256. package/dist/systems/wall/wall-finish-data.d.ts +22 -0
  257. package/dist/systems/wall/wall-finish-data.d.ts.map +1 -0
  258. package/dist/systems/wall/wall-finish-data.js +17 -0
  259. package/dist/systems/wall/wall-material-variant.d.ts.map +1 -1
  260. package/dist/systems/wall/wall-materials.d.ts +9 -4
  261. package/dist/systems/wall/wall-materials.d.ts.map +1 -1
  262. package/dist/systems/wall/wall-materials.js +135 -153
  263. package/dist/systems/wall/wall-placeholder-sweep.d.ts.map +1 -1
  264. package/dist/systems/wall/wall-system.d.ts +33 -2
  265. package/dist/systems/wall/wall-system.d.ts.map +1 -1
  266. package/dist/systems/wall/wall-system.js +621 -159
  267. package/dist/systems/window/corner-frame.d.ts +10 -0
  268. package/dist/systems/window/corner-frame.d.ts.map +1 -0
  269. package/dist/systems/window/corner-frame.js +17 -0
  270. package/dist/systems/window/window-system.d.ts +1 -1
  271. package/dist/systems/window/window-system.d.ts.map +1 -1
  272. package/dist/systems/window/window-system.js +71 -27
  273. package/package.json +10 -10
  274. package/dist/systems/fence/fence-system.d.ts +0 -22
  275. package/dist/systems/fence/fence-system.d.ts.map +0 -1
  276. package/dist/systems/fence/fence-system.js +0 -357
@@ -0,0 +1,70 @@
1
+ import { Box3, type Object3D, Vector3 } from 'three';
2
+ import type { PlayedStyle } from './reveal-wipe';
3
+ export declare function setRevealPose(object: Object3D, pivot: Vector3, scale: Vector3, lift?: number): void;
4
+ /**
5
+ * A piece the agent moved shows where it was and travels to where it now is: `left` is the share of
6
+ * the way still to go (1 at the start, 0 at rest), `hop` a lift in metres along the parent's up.
7
+ * `from` and `yaw` are its old position and turn in its parent's frame; the root's own transform is
8
+ * the new one, whenever the renderer writes it.
9
+ */
10
+ export declare function setGlidePose(object: Object3D, from: Vector3, yaw: number, left: number, hop?: number): void;
11
+ export declare function clearRevealPose(object: Object3D): void;
12
+ export declare function hasRevealPose(object: Object3D): boolean;
13
+ /** The share of a drop spent in the air; the rest is the landing. */
14
+ export declare const DROP_FALL = 0.68;
15
+ export type RevealPoseSample = {
16
+ lift: number;
17
+ scale: Vector3;
18
+ };
19
+ export type RevealPoseOptions = {
20
+ /**
21
+ * A drop's anticipation: it lifts this share of its height before it falls (0.05 on a 4 m
22
+ * drop is 20 cm), so the eye is told where it is about to fall from. None by default.
23
+ */
24
+ lead?: number;
25
+ /** A heavier drop lands with a bigger squash and hop; 1 by default. The last piece of a build is heavier. */
26
+ weight?: number;
27
+ /**
28
+ * A rise, a scale or a settle goes past its rest and comes back (GSAP's `back.out` strength,
29
+ * 1.7 is GSAP's default); 0, the default, is a plain ease out.
30
+ */
31
+ overshoot?: number;
32
+ };
33
+ /**
34
+ * Where a `style` reveal holds its node at `t` in [0, 1]: a lift in metres
35
+ * along the parent's up and a scale about the style's pivot. At `t >= 1` it
36
+ * is exactly the rest pose (no lift, unit scale), so nothing settles off by a
37
+ * rounding error.
38
+ */
39
+ export declare function revealPoseAt(style: PlayedStyle, t: number, height: number, out?: RevealPoseSample, options?: RevealPoseOptions): RevealPoseSample;
40
+ export type RetractPoseSample = RevealPoseSample & {
41
+ /** 1 while it is drawn whole; a piece that lifts away fades, and is 0 once gone. */
42
+ opacity: number;
43
+ };
44
+ export declare const RETRACT_LIFT_MIN = 0.3;
45
+ export declare const RETRACT_LIFT_MAX = 1.5;
46
+ /**
47
+ * Where a `style` reveal holds its node as it is taken back, `p` in [0, 1] from whole to gone: the
48
+ * build played in reverse for an undo. Whatever grew shrinks the way it grew (a wall sinks into
49
+ * the ground, an opening closes through its wall), slowly at first and faster as it goes, which is
50
+ * what a rewind looks like; whatever fell in lifts away and fades, quick off the mark, as a thing
51
+ * thrown up does. At `p >= 1` it is gone: its scale at the least and its opacity 0.
52
+ */
53
+ export declare function retractPoseAt(style: PlayedStyle, p: number, height: number, out?: RetractPoseSample): RetractPoseSample;
54
+ /**
55
+ * How far into its duration each style has arrived, the frame its contact or its last movement
56
+ * lands on: a drop's impact, a rise's last centimetre. An assembled node holds still: its parts land.
57
+ */
58
+ export declare const REVEAL_ARRIVAL: Record<PlayedStyle, number>;
59
+ /** Whether `style` has landed at `t`: a drop's impact, after which it only settles. */
60
+ export declare function revealHasLanded(style: PlayedStyle, t: number): boolean;
61
+ /** The root's drawn bounds in its own frame, ignoring the reveal pose and hidden parts. */
62
+ export declare function revealLocalBounds(root: Object3D, out?: Box3): Box3;
63
+ /**
64
+ * Where a reveal scales about, in the root's frame: under the origin at the
65
+ * base of its drawn bounds for `rise` (a wall's frame already starts at its
66
+ * base), the centre of the bounds for `cut`, and the base of their centre for
67
+ * the rest.
68
+ */
69
+ export declare function revealPivot(box: Box3, style: PlayedStyle): Vector3;
70
+ //# sourceMappingURL=reveal-pose.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"reveal-pose.d.ts","sourceRoot":"","sources":["../../src/lib/reveal-pose.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAsB,KAAK,QAAQ,EAAE,OAAO,EAAE,MAAM,OAAO,CAAA;AACxE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAwDhD,wBAAgB,aAAa,CAAC,MAAM,EAAE,QAAQ,EAAE,KAAK,EAA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nB;AAED;;;GAGG;AACH,eAAO,MAAM,cAAc,EAAE,MAAM,CAAC,WAAW,EAAE,MAAM,CAQtD,CAAA;AAED,uFAAuF;AACvF,wBAAgB,eAAe,CAAC,KAAK,EAAE,WAAW,EAAE,CAAC,EAAE,MAAM,GAAG,OAAO,CAGtE;AAKD,2FAA2F;AAC3F,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,QAAQ,EAAE,GAAG,GAAE,IAAiB,GAAG,IAAI,CAgB9E;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,GAAG,EAAE,IAAI,EAAE,KAAK,EAAE,WAAW,GAAG,OAAO,CAMlE"}
@@ -0,0 +1,248 @@
1
+ import { Box3, Matrix4, Vector3 } from 'three';
2
+ import { clearRevealWipe } from './reveal-wipe';
3
+ const poses = new WeakMap();
4
+ const step = new Matrix4();
5
+ const glideStep = new Matrix4();
6
+ const glideAround = new Matrix4();
7
+ function updateRevealedMatrix() {
8
+ ;
9
+ Object.getPrototypeOf(this).updateMatrix.call(this);
10
+ const pose = poses.get(this);
11
+ if (!pose)
12
+ return;
13
+ const { pivot, scale, lift, glide } = pose;
14
+ this.matrix.multiply(step.makeTranslation(pivot.x, pivot.y, pivot.z));
15
+ this.matrix.multiply(step.makeScale(scale.x, scale.y, scale.z));
16
+ this.matrix.multiply(step.makeTranslation(-pivot.x, -pivot.y, -pivot.z));
17
+ if (glide && glide.left > 0) {
18
+ // Read from the root as it is now, so a renderer that has not yet put it at its new place
19
+ // leaves it where it was: turned about its own origin by the share left of the way round, then carried.
20
+ const { position, rotation } = this;
21
+ let turn = glide.yaw - rotation.y;
22
+ turn -= Math.round(turn / (2 * Math.PI)) * 2 * Math.PI;
23
+ glideStep.makeTranslation((glide.from.x - position.x) * glide.left, (glide.from.y - position.y) * glide.left, (glide.from.z - position.z) * glide.left);
24
+ glideStep.multiply(glideAround.makeTranslation(position.x, position.y, position.z));
25
+ glideStep.multiply(glideAround.makeRotationY(turn * glide.left));
26
+ glideStep.multiply(glideAround.makeTranslation(-position.x, -position.y, -position.z));
27
+ this.matrix.premultiply(glideStep);
28
+ }
29
+ // Premultiplied: a fall is in metres along the parent's up, whatever the root's own scale.
30
+ this.matrix.elements[13] += lift;
31
+ }
32
+ export function setRevealPose(object, pivot, scale, lift = 0) {
33
+ let pose = poses.get(object);
34
+ if (!pose) {
35
+ pose = { pivot: new Vector3(), scale: new Vector3(), lift: 0, glide: null };
36
+ poses.set(object, pose);
37
+ object.updateMatrix = updateRevealedMatrix;
38
+ }
39
+ pose.pivot.copy(pivot);
40
+ pose.scale.copy(scale);
41
+ pose.lift = lift;
42
+ }
43
+ /**
44
+ * A piece the agent moved shows where it was and travels to where it now is: `left` is the share of
45
+ * the way still to go (1 at the start, 0 at rest), `hop` a lift in metres along the parent's up.
46
+ * `from` and `yaw` are its old position and turn in its parent's frame; the root's own transform is
47
+ * the new one, whenever the renderer writes it.
48
+ */
49
+ export function setGlidePose(object, from, yaw, left, hop = 0) {
50
+ if (!poses.has(object))
51
+ setRevealPose(object, new Vector3(), new Vector3(1, 1, 1));
52
+ const pose = poses.get(object);
53
+ pose.glide = { from: (pose.glide?.from ?? new Vector3()).copy(from), yaw, left };
54
+ pose.lift = hop;
55
+ }
56
+ export function clearRevealPose(object) {
57
+ // A covering laid in place ends with the pose that held its node.
58
+ clearRevealWipe(object);
59
+ if (!poses.delete(object))
60
+ return;
61
+ delete object.updateMatrix;
62
+ if (object.matrixAutoUpdate)
63
+ object.updateMatrix();
64
+ object.matrixWorldNeedsUpdate = true;
65
+ }
66
+ export function hasRevealPose(object) {
67
+ return poses.has(object);
68
+ }
69
+ const MIN_SCALE = 1e-3;
70
+ /** The share of a drop spent in the air; the rest is the landing. */
71
+ export const DROP_FALL = 0.68;
72
+ /** The share of a drop a lead takes: a hair of lift before the fall. */
73
+ const DROP_LEAD = 0.14;
74
+ /** A landing hops back up this share of the fall, at most `DROP_HOP_MAX` metres. */
75
+ const DROP_HOP = 0.012;
76
+ const DROP_HOP_MAX = 0.05;
77
+ const DROP_SQUASH = 0.08;
78
+ const easeOutCubic = (t) => 1 - (1 - t) ** 3;
79
+ /** GSAP's `back.out(s)`: past 1 by a little near the end, exactly 1 at the end. */
80
+ const easeOutBack = (t, s) => 1 + (s + 1) * (t - 1) ** 3 + s * (t - 1) ** 2;
81
+ /**
82
+ * Where a `style` reveal holds its node at `t` in [0, 1]: a lift in metres
83
+ * along the parent's up and a scale about the style's pivot. At `t >= 1` it
84
+ * is exactly the rest pose (no lift, unit scale), so nothing settles off by a
85
+ * rounding error.
86
+ */
87
+ export function revealPoseAt(style, t, height, out = { lift: 0, scale: new Vector3() }, options = {}) {
88
+ out.lift = 0;
89
+ out.scale.set(1, 1, 1);
90
+ if (t >= 1 || style === 'assemble' || style === 'cover')
91
+ return out;
92
+ const at = Math.max(0, t);
93
+ const overshoot = Math.max(0, options.overshoot ?? 0);
94
+ const eased = overshoot > 0 ? easeOutBack(at, overshoot) : easeOutCubic(at);
95
+ switch (style) {
96
+ case 'rise':
97
+ out.scale.y = Math.max(MIN_SCALE, eased);
98
+ break;
99
+ case 'scale': {
100
+ const f = Math.max(MIN_SCALE, eased);
101
+ out.scale.set(f, f, f);
102
+ break;
103
+ }
104
+ case 'settle':
105
+ out.lift = height * (1 - eased);
106
+ break;
107
+ case 'drop': {
108
+ const lead = Math.max(0, options.lead ?? 0);
109
+ const weight = Math.max(0.5, options.weight ?? 1);
110
+ const fallStart = lead > 0 ? DROP_LEAD : 0;
111
+ if (at < fallStart) {
112
+ // A hair of lift, up and back to where it hangs: the fall is about to start.
113
+ out.lift = height * (1 + lead * Math.sin((Math.PI * at) / fallStart));
114
+ break;
115
+ }
116
+ if (at < DROP_FALL) {
117
+ // Gravity: slow off the hook, fastest at the impact.
118
+ const fell = (at - fallStart) / (DROP_FALL - fallStart);
119
+ out.lift = height * (1 - fell * fell);
120
+ break;
121
+ }
122
+ const u = (at - DROP_FALL) / (1 - DROP_FALL);
123
+ out.lift = Math.min(DROP_HOP_MAX, height * DROP_HOP) * weight * 4 * u * (1 - u);
124
+ // The squash at impact, a rebound past rest (follow-through), then still: it is zero, and flat,
125
+ // exactly at the end.
126
+ const squash = DROP_SQUASH * weight * (1 - u) ** 1.5 * Math.cos(1.5 * Math.PI * u);
127
+ out.scale.set(1 + squash / 2, 1 - squash, 1 + squash / 2);
128
+ break;
129
+ }
130
+ case 'cut':
131
+ // Through the wall only, along its normal (the opening's z): carved out, not popped in.
132
+ out.scale.z = Math.max(MIN_SCALE, easeOutCubic(at));
133
+ break;
134
+ }
135
+ return out;
136
+ }
137
+ /** A piece that fell in lifts away this share of the height it fell from, at least and at most this many metres. */
138
+ const RETRACT_LIFT_SHARE = 0.5;
139
+ export const RETRACT_LIFT_MIN = 0.3;
140
+ export const RETRACT_LIFT_MAX = 1.5;
141
+ const smoothstep = (low, high, value) => {
142
+ const x = Math.min(1, Math.max(0, (value - low) / (high - low)));
143
+ return x * x * (3 - 2 * x);
144
+ };
145
+ /**
146
+ * Where a `style` reveal holds its node as it is taken back, `p` in [0, 1] from whole to gone: the
147
+ * build played in reverse for an undo. Whatever grew shrinks the way it grew (a wall sinks into
148
+ * the ground, an opening closes through its wall), slowly at first and faster as it goes, which is
149
+ * what a rewind looks like; whatever fell in lifts away and fades, quick off the mark, as a thing
150
+ * thrown up does. At `p >= 1` it is gone: its scale at the least and its opacity 0.
151
+ */
152
+ export function retractPoseAt(style, p, height, out = { lift: 0, scale: new Vector3(), opacity: 1 }) {
153
+ out.lift = 0;
154
+ out.scale.set(1, 1, 1);
155
+ out.opacity = 1;
156
+ const at = Math.min(1, Math.max(0, p));
157
+ const shrunk = Math.max(MIN_SCALE, 1 - at * at);
158
+ switch (style) {
159
+ case 'rise':
160
+ out.scale.y = shrunk;
161
+ break;
162
+ case 'scale':
163
+ out.scale.set(shrunk, shrunk, shrunk);
164
+ break;
165
+ case 'cut':
166
+ out.scale.z = shrunk;
167
+ break;
168
+ case 'cover':
169
+ // Its covering lifts off row by row (`setRevealWipe`); the bare node goes with the last.
170
+ if (at >= 1)
171
+ out.scale.set(MIN_SCALE, MIN_SCALE, MIN_SCALE);
172
+ break;
173
+ case 'settle':
174
+ case 'drop':
175
+ case 'assemble':
176
+ out.lift =
177
+ Math.min(RETRACT_LIFT_MAX, Math.max(RETRACT_LIFT_MIN, height * RETRACT_LIFT_SHARE)) *
178
+ easeOutCubic(at);
179
+ out.opacity = 1 - smoothstep(0.1, 0.8, at);
180
+ break;
181
+ }
182
+ if (at >= 1) {
183
+ // Gone: what shrank is at its smallest already; what lifted away shrinks away with its last fade.
184
+ if (out.lift > 0)
185
+ out.scale.set(MIN_SCALE, MIN_SCALE, MIN_SCALE);
186
+ out.opacity = 0;
187
+ }
188
+ return out;
189
+ }
190
+ /**
191
+ * How far into its duration each style has arrived, the frame its contact or its last movement
192
+ * lands on: a drop's impact, a rise's last centimetre. An assembled node holds still: its parts land.
193
+ */
194
+ export const REVEAL_ARRIVAL = {
195
+ rise: 1,
196
+ scale: 1,
197
+ settle: 1,
198
+ drop: DROP_FALL,
199
+ cut: 1,
200
+ assemble: 0,
201
+ cover: 1,
202
+ };
203
+ /** Whether `style` has landed at `t`: a drop's impact, after which it only settles. */
204
+ export function revealHasLanded(style, t) {
205
+ if (style === 'cover')
206
+ return t >= 1;
207
+ return style !== 'drop' || t >= DROP_FALL;
208
+ }
209
+ const bounds = new Box3();
210
+ const part = new Box3();
211
+ /** The root's drawn bounds in its own frame, ignoring the reveal pose and hidden parts. */
212
+ export function revealLocalBounds(root, out = new Box3()) {
213
+ bounds.makeEmpty();
214
+ const visit = (object, matrix) => {
215
+ if (object.visible === false)
216
+ return;
217
+ const geometry = object.isMesh ? object.geometry : undefined;
218
+ if (geometry?.getAttribute('position')) {
219
+ if (!geometry.boundingBox)
220
+ geometry.computeBoundingBox();
221
+ if (geometry.boundingBox)
222
+ bounds.union(part.copy(geometry.boundingBox).applyMatrix4(matrix));
223
+ }
224
+ for (const child of object.children) {
225
+ if (child.matrixAutoUpdate)
226
+ child.updateMatrix();
227
+ visit(child, new Matrix4().multiplyMatrices(matrix, child.matrix));
228
+ }
229
+ };
230
+ visit(root, new Matrix4());
231
+ return out.copy(bounds);
232
+ }
233
+ /**
234
+ * Where a reveal scales about, in the root's frame: under the origin at the
235
+ * base of its drawn bounds for `rise` (a wall's frame already starts at its
236
+ * base), the centre of the bounds for `cut`, and the base of their centre for
237
+ * the rest.
238
+ */
239
+ export function revealPivot(box, style) {
240
+ if (box.isEmpty())
241
+ return new Vector3();
242
+ const centre = box.getCenter(new Vector3());
243
+ if (style === 'rise')
244
+ return new Vector3(0, box.min.y, 0);
245
+ if (style === 'cut')
246
+ return centre;
247
+ return new Vector3(centre.x, box.min.y, centre.z);
248
+ }
@@ -0,0 +1,208 @@
1
+ import type { RevealPhase, RevealStyle } from '@pascal-app/core';
2
+ import type { CoverRange, PlayedStyle } from './reveal-wipe';
3
+ export declare const REVEAL_PHASE_ORDER: readonly RevealPhase[];
4
+ export type RevealTiming = {
5
+ /** Between two nodes of one phase on one level. */
6
+ nodeGapMs: number;
7
+ /** Between one (phase, level) group and the next. */
8
+ groupGapMs: number;
9
+ /** A reveal ends within this however many nodes it has: the gaps shrink, no node is skipped. */
10
+ capMs: number;
11
+ /**
12
+ * How long each style moves its node. `assemble` holds its node still (its parts drop), `cover`
13
+ * holds it still while its covering is laid, and the heights of the travelling styles are
14
+ * declared by each kind (`capabilities.reveal.height`).
15
+ */
16
+ durationMs: Record<RevealStyle, number>;
17
+ };
18
+ /** The one place to tune the reveal's pace; the heights live in the kinds' declarations. */
19
+ export declare const REVEAL_TIMING: RevealTiming;
20
+ /**
21
+ * How long `style` moves its node in `table`. Only the Framing level's table has a `cover` time (it
22
+ * lays a roof's covering where Full drops the roof whole); a plan made on a Full table or the reverse
23
+ * play of a framing build gives a covering twice what the whole roof takes to come or go.
24
+ */
25
+ export declare function styleMs(table: Readonly<Record<RevealStyle, number>> & {
26
+ cover?: number;
27
+ }, style: PlayedStyle): number;
28
+ export type RevealCandidate = {
29
+ id: string;
30
+ phase: RevealPhase;
31
+ style: PlayedStyle;
32
+ /** Metres above the rest pose for the travelling styles, 0 for the others. */
33
+ height: number;
34
+ levelId: string | null;
35
+ /** The level's storey; nodes outside any level come first. */
36
+ levelIndex: number;
37
+ /** Ancestor count, so a host starts before what it hosts. */
38
+ depth: number;
39
+ /** Arrival order, the last tie-break: a room's walls arrive along its outline. */
40
+ seq: number;
41
+ /** Who wrote it, as the host named it on the commit (`'agent'`); events pass it on. */
42
+ source?: string | null;
43
+ /** A drop's anticipation, as a share of its height (see `RevealPoseOptions.lead`). */
44
+ lead?: number;
45
+ /**
46
+ * The room (or wall run) it is built with, for the lazy schedule: rooms of a floor build side
47
+ * by side, a beat apart. Absent: it belongs to its floor as a whole (a slab under every room).
48
+ */
49
+ cluster?: string;
50
+ /** Where its room comes in its floor's sweep: the lower first. */
51
+ sweep?: number;
52
+ /** Its place in its room: a wall's turn around the room's outline. */
53
+ order?: number;
54
+ /**
55
+ * How long a plugin's own presentation plays at its turn before the node itself moves in (a wall's
56
+ * frame and boards, Bones): the lazy schedule leaves the time, and the node starts after it.
57
+ */
58
+ prerollMs?: number;
59
+ };
60
+ export type PlannedReveal = RevealCandidate & {
61
+ group: string;
62
+ startMs: number;
63
+ /** The last piece of the plan to arrive: it lands with a slightly bigger beat. */
64
+ finale?: boolean;
65
+ };
66
+ export declare function revealGroupKey(candidate: Pick<RevealCandidate, 'phase' | 'levelId'>): string;
67
+ /**
68
+ * Start times for `candidates`, from `startMs`. Phase after phase; within a phase every floor
69
+ * plays at once, its nodes in a scattered order (GSAP's stagger from "random") and evenly spaced,
70
+ * floors interleaved within one gap, so no frame starts a crowd. On a floor, what stands on
71
+ * something (a book on a shelf) starts after it.
72
+ */
73
+ export declare function planReveal(candidates: readonly RevealCandidate[], startMs: number, timing?: RevealTiming): PlannedReveal[];
74
+ /**
75
+ * The lazy, nested schedule (the `framing` level): floors a beat apart, the rooms of a floor a beat
76
+ * apart, the pieces of a room a beat apart, each with a little jitter, so many small builds progress
77
+ * side by side instead of one global pulse. A big build takes proportionally longer, up to `capMs`.
78
+ */
79
+ export type LazyRevealTiming = {
80
+ /** Between one floor's build and the next one's: floors go up side by side, offset. */
81
+ floorOffsetMs: number;
82
+ /** Between one room (or wall run) of a floor and the next, in each phase. */
83
+ roomOffsetMs: number;
84
+ /** Between two pieces of one room, by phase: a room's walls go up one after the other. */
85
+ elementOffsetMs: Record<RevealPhase, number>;
86
+ /** After a floor's phase has started its last piece, before its next phase starts. */
87
+ phaseGapMs: number;
88
+ /** Each start moves by up to this share of its offset, either way (never mechanical). */
89
+ jitter: number;
90
+ /** A plan longer than this is pulled together to end by it: a huge build does not take forever. */
91
+ capMs: number;
92
+ /** How long each style moves its node at this level; `cover` is the longest a roof's covering takes to lay. */
93
+ durationMs: Record<PlayedStyle, number>;
94
+ /**
95
+ * A covering takes this long for each metre of what it covers, never under `coverMinMs` nor over
96
+ * `durationMs.cover` (`coverRangeAt`).
97
+ */
98
+ coverMsPerM: number;
99
+ coverMinMs: number;
100
+ /**
101
+ * How far a rise, a scale or a settle goes past its rest before it settles (GSAP's `back.out`
102
+ * strength; 0 is a plain ease out). A rise's is gentler: a wall 2 % past its top, not into the slab over it.
103
+ */
104
+ overshoot: Record<'rise' | 'scale' | 'settle', number>;
105
+ /** Drops and settles fall from at least this high (m), whatever their kind declares. */
106
+ minHeightM: Partial<Record<PlayedStyle, number>>;
107
+ };
108
+ /**
109
+ * The Framing level's pace: one factor on its whole timeline, the staging and the motions alike. 1 is
110
+ * the pace it was built at; 1.75 makes a build that took 20 s take 35 s, and anything smaller or
111
+ * larger takes proportionally longer. A pace of `p` multiplies every offset, gap, beat, duration and
112
+ * cap of this level (`LAZY_REVEAL_TIMING`) and of the frame each wall plays before it rises (Bones'
113
+ * `WALL_BUILD`), so pieces still snap and the build only plays out slower. The Full level reads
114
+ * `REVEAL_TIMING` and does not move with it.
115
+ */
116
+ export declare const FRAMING_PACE = 1.75;
117
+ /** The lazy schedule at pace 1; `LAZY_REVEAL_TIMING` is this at `FRAMING_PACE`. */
118
+ export declare const LAZY_REVEAL_BASE_TIMING: LazyRevealTiming;
119
+ /** `timing` played at `pace` times its length: times scale, shares and heights do not. */
120
+ export declare function pacedLazyTiming(timing: LazyRevealTiming, pace: number): LazyRevealTiming;
121
+ /** The one place the lazy schedule and the framing level's motion are read from. */
122
+ export declare const LAZY_REVEAL_TIMING: LazyRevealTiming;
123
+ /**
124
+ * The person's animation speed: how fast the build animations play, as a multiple of today's.
125
+ * Higher is faster, so every time of a schedule is divided by it: ×2 plays a build in half the
126
+ * time, ×0.5 in twice as long. ×1 is every table exactly as shipped (the very same objects).
127
+ */
128
+ export declare const ANIMATION_SPEEDS: readonly [0.5, 0.75, 1, 1.5, 2];
129
+ export type AnimationSpeed = (typeof ANIMATION_SPEEDS)[number];
130
+ export declare const DEFAULT_ANIMATION_SPEED: AnimationSpeed;
131
+ /** The step nearest to `value`; anything that is not a finite positive number is ×1. */
132
+ export declare function normalizeAnimationSpeed(value: unknown): AnimationSpeed;
133
+ /** `timing` with every time divided by `speed`: durations, gaps and the cap. */
134
+ export declare function pacedRevealTiming(timing: RevealTiming, speed: number): RevealTiming;
135
+ /** `timing` with every time divided by `speed`; the share `speed` of its pace is not a time. */
136
+ export declare function pacedRetractTiming(timing: RetractTiming, speed: number): RetractTiming;
137
+ /** The Full level's schedule at `speed`; at ×1 it is `REVEAL_TIMING` itself. */
138
+ export declare const revealTimingAt: (speed: number) => RevealTiming;
139
+ /** The Framing level's schedule at `speed`; at ×1 it is `LAZY_REVEAL_TIMING` itself. */
140
+ export declare const lazyTimingAt: (speed: number) => LazyRevealTiming;
141
+ /** The reverse play's schedule at `speed`; at ×1 it is `RETRACT_TIMING` itself. */
142
+ export declare const retractTimingAt: (speed: number) => RetractTiming;
143
+ /**
144
+ * Start times for `candidates` on the lazy, nested schedule, from `startMs`:
145
+ * - each floor builds its foundation, structure, stairs and openings, a phase after the other, and
146
+ * the floors go up side by side, `floorOffsetMs` apart;
147
+ * - in a phase, the rooms (`cluster`) start `roomOffsetMs` apart in their sweep order, and the
148
+ * pieces of a room `elementOffsetMs` apart around it; what belongs to the whole floor comes first;
149
+ * - roofs come once every floor is up, then the furniture, floor by floor and room by room again;
150
+ * - a piece with a preroll starts after it (its plugin plays then), and its room's next phase waits.
151
+ * Every start is jittered. The plan grows with the build (its biggest room, its rooms, its floors),
152
+ * and is pulled together only past `capMs`. `startMs` of a planned entry is when the node itself
153
+ * moves; its preroll plays before.
154
+ */
155
+ export declare function planLazyReveal(candidates: readonly RevealCandidate[], startMs: number, timing?: LazyRevealTiming): PlannedReveal[];
156
+ export type RetractTiming = {
157
+ /** A reverse plan keeps the build's order, reversed, at this share of its pace. */
158
+ speed: number;
159
+ /** Between two pieces of one phase on one level, in a reverse plan with room to spare. */
160
+ nodeGapMs: number;
161
+ /** A reverse play ends within this however many pieces it takes back. */
162
+ capMs: number;
163
+ /** How long each style takes to go: a rewind is quicker than the build. */
164
+ durationMs: Record<RevealStyle, number> & {
165
+ cover?: number;
166
+ };
167
+ };
168
+ /** The one place to tune the reverse play's pace. */
169
+ export declare const RETRACT_TIMING: RetractTiming;
170
+ export type PlannedRetract = RevealCandidate & {
171
+ group: string;
172
+ startMs: number;
173
+ durationMs: number;
174
+ };
175
+ /**
176
+ * The reverse play at the Framing level: the rewind's durations at the Framing pace, so a deleted
177
+ * floor comes apart as slowly as it went up. `capMs` keeps a whole floor's deconstruction in a
178
+ * bounded time however many pieces it takes back.
179
+ */
180
+ /** A covering lifts off in this share of the time it took to lay. */
181
+ export declare const COVER_REVERSE_SHARE = 0.6;
182
+ export declare const LAZY_RETRACT_TIMING: RetractTiming;
183
+ /**
184
+ * How long a roof's covering takes by the size it covers at the Framing level at `speed`: its range
185
+ * in metres of sweep (`coverDurationMs`); `reverse` for the lifting off of a deletion or an undo.
186
+ */
187
+ export declare function coverRangeAt(speed: number, reverse?: boolean): CoverRange;
188
+ /** The Framing level's reverse play at `speed`; at ×1 it is `LAZY_RETRACT_TIMING` itself. */
189
+ export declare const lazyRetractTimingAt: (speed: number) => RetractTiming;
190
+ /**
191
+ * The Framing build played backwards, for a deletion or an undo: the plan of the build (floor by
192
+ * floor, room by room, piece by piece, `planLazyReveal`) read from its end, so the furniture lifts
193
+ * out first, then the roof, the openings, the walls and the slabs last, and the floors come apart
194
+ * from the top down, each room as it went up. Each piece takes its own style's rewind time; a piece
195
+ * that had a preroll keeps it, after its own going, for the plugin that took it apart (a wall's
196
+ * boards come off and its studs fly up then). The whole ends within the cap by pulling the starts
197
+ * closer, never by skipping a piece.
198
+ */
199
+ export declare function planLazyRetract(candidates: readonly RevealCandidate[], startMs: number, timing?: RetractTiming, build?: LazyRevealTiming): PlannedRetract[];
200
+ /**
201
+ * The build played backwards, for an undo: the last phase goes first and each goes after the one
202
+ * built on it (the furniture, the roof, the openings, the walls, the slab), and inside a phase the last
203
+ * piece to arrive is the first to go, so the plan reads one phase at a time as the build did. It is
204
+ * quicker; each piece takes its own style's rewind duration; and the whole ends within the cap by
205
+ * pulling the starts closer, never by skipping a piece.
206
+ */
207
+ export declare function planRetract(candidates: readonly RevealCandidate[], startMs: number, timing?: RetractTiming, build?: RevealTiming): PlannedRetract[];
208
+ //# sourceMappingURL=reveal-schedule.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"reveal-schedule.d.ts","sourceRoot":"","sources":["../../src/lib/reveal-schedule.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAEhE,OAAO,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAE5D,eAAO,MAAM,kBAAkB,EAAE,SAAS,WAAW,EAOpD,CAAA;AAED,MAAM,MAAM,YAAY,GAAG;IACzB,mDAAmD;IACnD,SAAS,EAAE,MAAM,CAAA;IACjB,qDAAqD;IACrD,UAAU,EAAE,MAAM,CAAA;IAClB,gGAAgG;IAChG,KAAK,E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