@nodetool-ai/timeline 0.8.18 → 0.8.19

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 (94) hide show
  1. package/dist/.nodetool-build-stamp +1 -1
  2. package/dist/animation/custom.d.ts.map +1 -1
  3. package/dist/animation/custom.js +35 -0
  4. package/dist/animation/custom.js.map +1 -1
  5. package/dist/animation/sample.d.ts +14 -0
  6. package/dist/animation/sample.d.ts.map +1 -1
  7. package/dist/animation/sample.js +22 -1
  8. package/dist/animation/sample.js.map +1 -1
  9. package/dist/animation/types.d.ts +8 -1
  10. package/dist/animation/types.d.ts.map +1 -1
  11. package/dist/animation/types.js +31 -3
  12. package/dist/animation/types.js.map +1 -1
  13. package/dist/authoredStyles.d.ts +7 -1
  14. package/dist/authoredStyles.d.ts.map +1 -1
  15. package/dist/authoredStyles.js +6 -1
  16. package/dist/authoredStyles.js.map +1 -1
  17. package/dist/finish-storyboard.d.ts.map +1 -1
  18. package/dist/finish-storyboard.js +6 -1
  19. package/dist/finish-storyboard.js.map +1 -1
  20. package/dist/index.d.ts +5 -0
  21. package/dist/index.d.ts.map +1 -1
  22. package/dist/index.js +5 -0
  23. package/dist/index.js.map +1 -1
  24. package/dist/keyframes.d.ts +12 -2
  25. package/dist/keyframes.d.ts.map +1 -1
  26. package/dist/keyframes.js +24 -1
  27. package/dist/keyframes.js.map +1 -1
  28. package/dist/model3d.d.ts +132 -8
  29. package/dist/model3d.d.ts.map +1 -1
  30. package/dist/model3d.js +230 -7
  31. package/dist/model3d.js.map +1 -1
  32. package/dist/model3dBake.d.ts +41 -11
  33. package/dist/model3dBake.d.ts.map +1 -1
  34. package/dist/model3dBake.js +58 -21
  35. package/dist/model3dBake.js.map +1 -1
  36. package/dist/model3dBlockout.d.ts +62 -0
  37. package/dist/model3dBlockout.d.ts.map +1 -0
  38. package/dist/model3dBlockout.js +59 -0
  39. package/dist/model3dBlockout.js.map +1 -0
  40. package/dist/model3dCameraDescription.d.ts +27 -0
  41. package/dist/model3dCameraDescription.d.ts.map +1 -0
  42. package/dist/model3dCameraDescription.js +171 -0
  43. package/dist/model3dCameraDescription.js.map +1 -0
  44. package/dist/model3dCameraKeys.d.ts +47 -0
  45. package/dist/model3dCameraKeys.d.ts.map +1 -0
  46. package/dist/model3dCameraKeys.js +156 -0
  47. package/dist/model3dCameraKeys.js.map +1 -0
  48. package/dist/model3dCameraMoves.d.ts +97 -0
  49. package/dist/model3dCameraMoves.d.ts.map +1 -0
  50. package/dist/model3dCameraMoves.js +329 -0
  51. package/dist/model3dCameraMoves.js.map +1 -0
  52. package/dist/model3dReference.d.ts +75 -0
  53. package/dist/model3dReference.d.ts.map +1 -0
  54. package/dist/model3dReference.js +100 -0
  55. package/dist/model3dReference.js.map +1 -0
  56. package/dist/ops/apply.d.ts.map +1 -1
  57. package/dist/ops/apply.js +168 -2
  58. package/dist/ops/apply.js.map +1 -1
  59. package/dist/ops/op.d.ts +35 -2
  60. package/dist/ops/op.d.ts.map +1 -1
  61. package/dist/ops/op.js +2 -0
  62. package/dist/ops/op.js.map +1 -1
  63. package/dist/ops/parse.d.ts.map +1 -1
  64. package/dist/ops/parse.js +8 -0
  65. package/dist/ops/parse.js.map +1 -1
  66. package/dist/ops/types.d.ts +22 -0
  67. package/dist/ops/types.d.ts.map +1 -1
  68. package/dist/render/index.d.ts +1 -0
  69. package/dist/render/index.d.ts.map +1 -1
  70. package/dist/render/index.js +1 -0
  71. package/dist/render/index.js.map +1 -1
  72. package/dist/render/model3dReferenceSamples.d.ts +25 -0
  73. package/dist/render/model3dReferenceSamples.d.ts.map +1 -0
  74. package/dist/render/model3dReferenceSamples.js +25 -0
  75. package/dist/render/model3dReferenceSamples.js.map +1 -0
  76. package/dist/render/sceneModel.d.ts +1 -1
  77. package/dist/render/sceneModel.d.ts.map +1 -1
  78. package/dist/render/sceneModel.js +10 -5
  79. package/dist/render/sceneModel.js.map +1 -1
  80. package/dist/scene.d.ts +1 -0
  81. package/dist/scene.d.ts.map +1 -1
  82. package/dist/scene.js +1 -0
  83. package/dist/scene.js.map +1 -1
  84. package/dist/shotLink.d.ts +35 -0
  85. package/dist/shotLink.d.ts.map +1 -1
  86. package/dist/shotLink.js +100 -0
  87. package/dist/shotLink.js.map +1 -1
  88. package/dist/testing/ops.d.ts.map +1 -1
  89. package/dist/testing/ops.js +49 -2
  90. package/dist/testing/ops.js.map +1 -1
  91. package/dist/types.d.ts +30 -2
  92. package/dist/types.d.ts.map +1 -1
  93. package/dist/types.js.map +1 -1
  94. package/package.json +5 -5
@@ -0,0 +1,59 @@
1
+ /**
2
+ * How a shot's blockout reaches the video model that renders a take of it.
3
+ *
4
+ * A model that takes reference video is sent the blockout's reference render.
5
+ * Any other model is sent no reference, and the camera move is written into
6
+ * the prompt instead. The choice is made from the model's declared tasks,
7
+ * never from its name.
8
+ */
9
+ /**
10
+ * The model tasks that take a reference video. `reference_to_video` is the one
11
+ * task in the model catalog whose provider call carries reference videos
12
+ * (`BaseProvider.referenceToVideo`). `motion_control` is a chat composer mode
13
+ * with no model task and no provider call behind it, so no model can declare
14
+ * it and it is not listed.
15
+ */
16
+ export const BLOCKOUT_REFERENCE_VIDEO_TASKS = ["reference_to_video"];
17
+ /**
18
+ * Whether a video model takes a reference video, from the `supported_tasks`
19
+ * the catalog reports for it. A model that declares no tasks does not: the
20
+ * model picker treats `reference_to_video` as a task a model must declare.
21
+ */
22
+ export function modelTakesReferenceVideo(supportedTasks) {
23
+ return (supportedTasks?.some((task) => BLOCKOUT_REFERENCE_VIDEO_TASKS.some((accepted) => accepted === task)) ?? false);
24
+ }
25
+ /** What the model is told about the reference video it is sent. */
26
+ export const BLOCKOUT_REFERENCE_INSTRUCTION = "Follow the camera movement, framing and staging of the reference video. " +
27
+ "The reference is an untextured grey 3D blockout: take its motion and " +
28
+ "composition, not its grey look.";
29
+ /** Shown to the user when the selected model takes no reference video. */
30
+ export const BLOCKOUT_PROMPT_ONLY_NOTE = "This model does not take a reference video. The blockout's camera move " +
31
+ "was added to the prompt as text, and the grey render was not sent.";
32
+ /**
33
+ * Decide what a take generated from a blockout sends.
34
+ *
35
+ * `reference_video`: the reference asset rides in `referenceVideos`, with its
36
+ * full asset id, and the prompt gains {@link BLOCKOUT_REFERENCE_INSTRUCTION}
37
+ * and the camera sentence. `prompt_only`: nothing is attached and the prompt
38
+ * gains the camera sentence alone.
39
+ */
40
+ export function planBlockoutGeneration(input) {
41
+ const base = input.prompt.trim();
42
+ const camera = input.cameraMove.trim();
43
+ const join = (...parts) => parts.filter((part) => part.length > 0).join("\n\n");
44
+ if (modelTakesReferenceVideo(input.supportedTasks) &&
45
+ input.referenceAssetId.length > 0) {
46
+ return {
47
+ route: "reference_video",
48
+ prompt: join(base, `${BLOCKOUT_REFERENCE_INSTRUCTION} ${camera}`.trim()),
49
+ capability: "reference_to_video",
50
+ referenceVideos: [{ type: "video", asset_id: input.referenceAssetId }]
51
+ };
52
+ }
53
+ return {
54
+ route: "prompt_only",
55
+ prompt: join(base, camera),
56
+ note: BLOCKOUT_PROMPT_ONLY_NOTE
57
+ };
58
+ }
59
+ //# sourceMappingURL=model3dBlockout.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"model3dBlockout.js","sourceRoot":"","sources":["../src/model3dBlockout.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,8BAA8B,GAAG,CAAC,oBAAoB,CAAU,CAAC;AAE9E;;;;GAIG;AACH,MAAM,UAAU,wBAAwB,CACtC,cAAoD;IAEpD,OAAO,CACL,cAAc,EAAE,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAC5B,8BAA8B,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,KAAK,IAAI,CAAC,CACrE,IAAI,KAAK,CACX,CAAC;AACJ,CAAC;AAED,mEAAmE;AACnE,MAAM,CAAC,MAAM,8BAA8B,GACzC,0EAA0E;IAC1E,uEAAuE;IACvE,iCAAiC,CAAC;AAEpC,0EAA0E;AAC1E,MAAM,CAAC,MAAM,yBAAyB,GACpC,yEAAyE;IACzE,oEAAoE,CAAC;AAiCvE;;;;;;;GAOG;AACH,MAAM,UAAU,sBAAsB,CACpC,KAA8B;IAE9B,MAAM,IAAI,GAAG,KAAK,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC;IACjC,MAAM,MAAM,GAAG,KAAK,CAAC,UAAU,CAAC,IAAI,EAAE,CAAC;IACvC,MAAM,IAAI,GAAG,CAAC,GAAG,KAAe,EAAU,EAAE,CAC1C,KAAK,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IACvD,IACE,wBAAwB,CAAC,KAAK,CAAC,cAAc,CAAC;QAC9C,KAAK,CAAC,gBAAgB,CAAC,MAAM,GAAG,CAAC,EACjC,CAAC;QACD,OAAO;YACL,KAAK,EAAE,iBAAiB;YACxB,MAAM,EAAE,IAAI,CAAC,IAAI,EAAE,GAAG,8BAA8B,IAAI,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC;YACxE,UAAU,EAAE,oBAAoB;YAChC,eAAe,EAAE,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,QAAQ,EAAE,KAAK,CAAC,gBAAgB,EAAE,CAAC;SACvE,CAAC;IACJ,CAAC;IACD,OAAO;QACL,KAAK,EAAE,aAAa;QACpB,MAAM,EAAE,IAAI,CAAC,IAAI,EAAE,MAAM,CAAC;QAC1B,IAAI,EAAE,yBAAyB;KAChC,CAAC;AACJ,CAAC"}
@@ -0,0 +1,27 @@
1
+ /**
2
+ * A plain-language description of a `model3d` clip's camera move, for a video
3
+ * model that takes no reference video.
4
+ *
5
+ * The words come from the clip's keyframed camera at its first and last
6
+ * instant. Preset animations on the clip are not read, as in
7
+ * `model3dKeyframedFreeCameraPose`.
8
+ */
9
+ import type { TimelineClip } from "./types.js";
10
+ /** What {@link describeModel3DCameraMove} says when nothing moves. */
11
+ export declare const MODEL3D_STATIC_CAMERA_DESCRIPTION = "The camera is static and holds one framing for the whole shot.";
12
+ /**
13
+ * Describe the clip's camera move between its first and last instant, for a
14
+ * prompt: "The camera pushes in slowly and pans right."
15
+ *
16
+ * A free camera is read as a push in or pull out (movement along the view
17
+ * axis), a truck (sideways), a pedestal (eye and target rise together) or a
18
+ * crane (the eye rises and keeps looking at the target), a pan and a tilt
19
+ * (the view direction turning about the eye), an orbit (the eye circling a
20
+ * target that stays put), a zoom (the lens) and a roll. An orbit camera is
21
+ * read from its azimuth, elevation, zoom and lens channels. A scene camera
22
+ * has no keyed pose and reads as static. A change under the thresholds at the
23
+ * top of this file is left out, and a clip with nothing left reads as
24
+ * {@link MODEL3D_STATIC_CAMERA_DESCRIPTION}.
25
+ */
26
+ export declare function describeModel3DCameraMove(clip: TimelineClip): string;
27
+ //# sourceMappingURL=model3dCameraDescription.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"model3dCameraDescription.d.ts","sourceRoot":"","sources":["../src/model3dCameraDescription.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAKH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAE/C,sEAAsE;AACtE,eAAO,MAAM,iCAAiC,mEACoB,CAAC;AAkFnE;;;;;;;;;;;;;GAaG;AACH,wBAAgB,yBAAyB,CAAC,IAAI,EAAE,YAAY,GAAG,MAAM,CAkGpE"}
@@ -0,0 +1,171 @@
1
+ /**
2
+ * A plain-language description of a `model3d` clip's camera move, for a video
3
+ * model that takes no reference video.
4
+ *
5
+ * The words come from the clip's keyframed camera at its first and last
6
+ * instant. Preset animations on the clip are not read, as in
7
+ * `model3dKeyframedFreeCameraPose`.
8
+ */
9
+ import { keyframeValueAt } from "./keyframes.js";
10
+ import { model3dFreeCameraBasis } from "./model3d.js";
11
+ import { model3dKeyframedFreeCameraPose } from "./model3dCameraMoves.js";
12
+ /** What {@link describeModel3DCameraMove} says when nothing moves. */
13
+ export const MODEL3D_STATIC_CAMERA_DESCRIPTION = "The camera is static and holds one framing for the whole shot.";
14
+ /** Rotation below this many degrees is not described. */
15
+ const ANGLE_THRESHOLD_DEG = 3;
16
+ /** Translation below this fraction of the eye-to-target distance is not described. */
17
+ const DISTANCE_THRESHOLD = 0.05;
18
+ /** Lens change below this many degrees of field of view is not described. */
19
+ const FOV_THRESHOLD_DEG = 2;
20
+ /** A vertical move is a crane when the target rises less than this share of the eye's rise. */
21
+ const CRANE_TARGET_SHARE = 0.5;
22
+ const RAD = 180 / Math.PI;
23
+ const sub = (a, b) => [
24
+ a[0] - b[0],
25
+ a[1] - b[1],
26
+ a[2] - b[2]
27
+ ];
28
+ const dot = (a, b) => a[0] * b[0] + a[1] * b[1] + a[2] * b[2];
29
+ const length = (a) => Math.sqrt(dot(a, a));
30
+ /** Wrap an angle difference into -180..180. */
31
+ const wrapDeg = (deg) => ((((deg + 180) % 360) + 360) % 360) - 180;
32
+ /**
33
+ * "slowly", "quickly" or nothing, from a rate measured against the rate an
34
+ * unremarkable move has. `rate` and `typical` share a unit per second.
35
+ */
36
+ function pace(rate, typical) {
37
+ if (rate < typical / 3)
38
+ return " slowly";
39
+ if (rate > typical * 3)
40
+ return " quickly";
41
+ return "";
42
+ }
43
+ function sentence(phrases) {
44
+ if (phrases.length === 0)
45
+ return MODEL3D_STATIC_CAMERA_DESCRIPTION;
46
+ const joined = phrases.length === 1
47
+ ? phrases[0]
48
+ : `${phrases.slice(0, -1).join(", ")} and ${phrases[phrases.length - 1]}`;
49
+ return `The camera ${joined}.`;
50
+ }
51
+ function describeOrbitCamera(clip, seconds) {
52
+ const delta = (property) => keyframeValueAt(clip, property, clip.durationMs) -
53
+ keyframeValueAt(clip, property, 0);
54
+ const phrases = [];
55
+ const azimuth = delta("cameraAzimuth");
56
+ if (Math.abs(azimuth) >= ANGLE_THRESHOLD_DEG) {
57
+ phrases.push(`orbits ${azimuth > 0 ? "right" : "left"} around the subject` +
58
+ pace(Math.abs(azimuth) / seconds, 20));
59
+ }
60
+ const elevation = delta("cameraElevation");
61
+ if (Math.abs(elevation) >= ANGLE_THRESHOLD_DEG) {
62
+ phrases.push(`${elevation > 0 ? "rises" : "descends"}` +
63
+ pace(Math.abs(elevation) / seconds, 20));
64
+ }
65
+ // `cameraZoom` multiplies the framing distance multiplier, so the move is
66
+ // the ratio of its two ends. Above one is closer.
67
+ const zoomStart = keyframeValueAt(clip, "cameraZoom", 0);
68
+ const zoomEnd = keyframeValueAt(clip, "cameraZoom", clip.durationMs);
69
+ const zoom = zoomStart > 0 && zoomEnd > 0 ? zoomEnd / zoomStart : 1;
70
+ if (Math.abs(zoom - 1) >= DISTANCE_THRESHOLD) {
71
+ phrases.push(`${zoom > 1 ? "pushes in" : "pulls out"}` +
72
+ pace(Math.abs(Math.log(zoom)) / seconds, 0.15));
73
+ }
74
+ const fov = delta("cameraFov");
75
+ if (Math.abs(fov) >= FOV_THRESHOLD_DEG) {
76
+ phrases.push(`zooms ${fov < 0 ? "in" : "out"}` + pace(Math.abs(fov) / seconds, 8));
77
+ }
78
+ return sentence(phrases);
79
+ }
80
+ /**
81
+ * Describe the clip's camera move between its first and last instant, for a
82
+ * prompt: "The camera pushes in slowly and pans right."
83
+ *
84
+ * A free camera is read as a push in or pull out (movement along the view
85
+ * axis), a truck (sideways), a pedestal (eye and target rise together) or a
86
+ * crane (the eye rises and keeps looking at the target), a pan and a tilt
87
+ * (the view direction turning about the eye), an orbit (the eye circling a
88
+ * target that stays put), a zoom (the lens) and a roll. An orbit camera is
89
+ * read from its azimuth, elevation, zoom and lens channels. A scene camera
90
+ * has no keyed pose and reads as static. A change under the thresholds at the
91
+ * top of this file is left out, and a clip with nothing left reads as
92
+ * {@link MODEL3D_STATIC_CAMERA_DESCRIPTION}.
93
+ */
94
+ export function describeModel3DCameraMove(clip) {
95
+ const style = clip.model3dStyle;
96
+ if (!style || style.camera.mode === "scene") {
97
+ return MODEL3D_STATIC_CAMERA_DESCRIPTION;
98
+ }
99
+ const seconds = Math.max(clip.durationMs / 1000, 1e-3);
100
+ if (style.camera.mode === "orbit") {
101
+ return describeOrbitCamera(clip, seconds);
102
+ }
103
+ const start = model3dKeyframedFreeCameraPose(clip, 0);
104
+ const end = model3dKeyframedFreeCameraPose(clip, clip.durationMs);
105
+ const basis = model3dFreeCameraBasis(start.position, start.target, start.rollDeg);
106
+ const endBasis = model3dFreeCameraBasis(end.position, end.target, end.rollDeg);
107
+ const distance = Math.max(length(sub(start.target, start.position)), 1e-6);
108
+ const endDistance = length(sub(end.target, end.position));
109
+ const eyeMove = sub(end.position, start.position);
110
+ const targetMove = sub(end.target, start.target);
111
+ // The unrolled right axis, so a rolled camera still trucks "left" and
112
+ // "right" in the ground plane.
113
+ const flat = model3dFreeCameraBasis(start.position, start.target, 0);
114
+ const forward = dot(eyeMove, basis.forward) / distance;
115
+ const sideways = dot(eyeMove, flat.right) / distance;
116
+ const vertical = eyeMove[1] / distance;
117
+ const yaw = (f) => Math.atan2(f[0], -f[2]) * RAD;
118
+ const pitch = (f) => Math.asin(Math.min(1, Math.max(-1, f[1]))) * RAD;
119
+ const pan = wrapDeg(yaw(endBasis.forward) - yaw(basis.forward));
120
+ const tilt = pitch(endBasis.forward) - pitch(basis.forward);
121
+ const phrases = [];
122
+ // An orbit: the target stays where it was, the eye keeps its distance and
123
+ // swings around it. Seen from the eye that is a sideways move plus an
124
+ // opposite pan, which reads wrong as "trucks right and pans left".
125
+ const targetHeld = length(targetMove) / distance < DISTANCE_THRESHOLD;
126
+ const distanceHeld = Math.abs(endDistance - distance) / distance < DISTANCE_THRESHOLD * 2;
127
+ const orbiting = targetHeld && distanceHeld && Math.abs(pan) >= ANGLE_THRESHOLD_DEG;
128
+ if (orbiting) {
129
+ phrases.push(`orbits ${sideways > 0 ? "right" : "left"} around the subject` +
130
+ pace(Math.abs(pan) / seconds, 20));
131
+ if (Math.abs(vertical) >= DISTANCE_THRESHOLD) {
132
+ phrases.push(vertical > 0 ? "rises" : "descends");
133
+ }
134
+ }
135
+ else {
136
+ if (Math.abs(forward) >= DISTANCE_THRESHOLD) {
137
+ phrases.push(`${forward > 0 ? "pushes in" : "pulls out"}` +
138
+ pace(Math.abs(forward) / seconds, 0.15));
139
+ }
140
+ if (Math.abs(sideways) >= DISTANCE_THRESHOLD) {
141
+ phrases.push(`trucks ${sideways > 0 ? "right" : "left"}` +
142
+ pace(Math.abs(sideways) / seconds, 0.15));
143
+ }
144
+ // A crane raises the eye while it keeps looking at the target, so the
145
+ // tilt that comes with it is part of the move. A pedestal raises the eye
146
+ // and the target together.
147
+ const crane = Math.abs(vertical) >= DISTANCE_THRESHOLD &&
148
+ Math.abs(targetMove[1]) < Math.abs(eyeMove[1]) * CRANE_TARGET_SHARE;
149
+ if (Math.abs(vertical) >= DISTANCE_THRESHOLD) {
150
+ phrases.push(`${crane ? "cranes" : "pedestals"} ${vertical > 0 ? "up" : "down"}` +
151
+ pace(Math.abs(vertical) / seconds, 0.15));
152
+ }
153
+ if (Math.abs(pan) >= ANGLE_THRESHOLD_DEG) {
154
+ phrases.push(`pans ${pan > 0 ? "right" : "left"}` + pace(Math.abs(pan) / seconds, 20));
155
+ }
156
+ if (!crane && Math.abs(tilt) >= ANGLE_THRESHOLD_DEG) {
157
+ phrases.push(`tilts ${tilt > 0 ? "up" : "down"}` + pace(Math.abs(tilt) / seconds, 20));
158
+ }
159
+ }
160
+ const fov = end.fovDeg - start.fovDeg;
161
+ if (Math.abs(fov) >= FOV_THRESHOLD_DEG) {
162
+ phrases.push(`zooms ${fov < 0 ? "in" : "out"}` + pace(Math.abs(fov) / seconds, 8));
163
+ }
164
+ const roll = end.rollDeg - start.rollDeg;
165
+ if (Math.abs(roll) >= ANGLE_THRESHOLD_DEG) {
166
+ // Positive roll turns the horizon clockwise in the picture.
167
+ phrases.push(`rolls so the horizon turns ${roll > 0 ? "clockwise" : "counterclockwise"}`);
168
+ }
169
+ return sentence(phrases);
170
+ }
171
+ //# sourceMappingURL=model3dCameraDescription.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"model3dCameraDescription.js","sourceRoot":"","sources":["../src/model3dCameraDescription.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACjD,OAAO,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAC;AACtD,OAAO,EAAE,8BAA8B,EAAE,MAAM,yBAAyB,CAAC;AAGzE,sEAAsE;AACtE,MAAM,CAAC,MAAM,iCAAiC,GAC5C,gEAAgE,CAAC;AAEnE,yDAAyD;AACzD,MAAM,mBAAmB,GAAG,CAAC,CAAC;AAC9B,sFAAsF;AACtF,MAAM,kBAAkB,GAAG,IAAI,CAAC;AAChC,6EAA6E;AAC7E,MAAM,iBAAiB,GAAG,CAAC,CAAC;AAC5B,+FAA+F;AAC/F,MAAM,kBAAkB,GAAG,GAAG,CAAC;AAE/B,MAAM,GAAG,GAAG,GAAG,GAAG,IAAI,CAAC,EAAE,CAAC;AAI1B,MAAM,GAAG,GAAG,CAAC,CAAO,EAAE,CAAO,EAA4B,EAAE,CAAC;IAC1D,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;IACX,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;IACX,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CACZ,CAAC;AACF,MAAM,GAAG,GAAG,CAAC,CAAO,EAAE,CAAO,EAAU,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;AAClF,MAAM,MAAM,GAAG,CAAC,CAAO,EAAU,EAAE,CAAC,IAAI,CAAC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-0,0 +1,47 @@
1
+ /**
2
+ * Keying a `model3d` clip's free camera at one instant, and the lens
3
+ * conversion a camera patch accepts.
4
+ *
5
+ * A camera key is one keyframe on each free camera channel at the same time,
6
+ * so the whole pose is pinned there and a later key on one channel cannot
7
+ * drag the others. The channels fold by addition onto the clip's authored
8
+ * camera, so every stored value is the wanted pose minus the authored one.
9
+ */
10
+ import type { ClipAnimation } from "./animation/types.js";
11
+ import { type Model3DFreeCameraPose } from "./model3d.js";
12
+ import type { TimelineClip } from "./types.js";
13
+ /** The widest and the narrowest lens a free camera takes, vertical degrees. */
14
+ export declare const MODEL3D_MIN_FOV_DEG = 1;
15
+ export declare const MODEL3D_MAX_FOV_DEG = 170;
16
+ /** The lens of a camera patch: a field of view or a focal length, never both. */
17
+ export interface Model3DLensInput {
18
+ fovDeg?: number;
19
+ focalLengthMm?: number;
20
+ }
21
+ /**
22
+ * The vertical field of view a lens input asks for, or undefined when it names
23
+ * no lens. `field` is the path of the object in the caller's arguments, for
24
+ * the message.
25
+ */
26
+ export declare function resolveModel3DLensFovDeg(lens: Model3DLensInput, field?: string): number | undefined;
27
+ /** A free camera pose with the lens in both units, rounded for a report. */
28
+ export interface Model3DFreeCameraReport extends Model3DFreeCameraPose {
29
+ focalLengthMm: number;
30
+ }
31
+ export declare function model3dFreeCameraReport(pose: Model3DFreeCameraPose): Model3DFreeCameraReport;
32
+ /** Throws when `easing` is outside the easing grammar. `field` names it. */
33
+ export declare function assertKnownEasing(easing: string, field: string): void;
34
+ export interface KeyModel3DFreeCameraOptions {
35
+ /** Easing of the segment that arrives at this key. Linear when absent. */
36
+ easing?: string;
37
+ }
38
+ /**
39
+ * Key the clip's free camera at `atMs`, clip-relative, and return the clip's
40
+ * new animation list, the way `setKeyframe` does.
41
+ *
42
+ * Every field `pose` leaves out keeps the value the camera has at `atMs`, so
43
+ * `{}` pins the current picture. All eight free channels get a keyframe. The
44
+ * clip has to be in `free` mode and `atMs` inside the clip.
45
+ */
46
+ export declare function keyModel3DFreeCamera(clip: TimelineClip, atMs: number, pose?: Partial<Model3DFreeCameraPose>, options?: KeyModel3DFreeCameraOptions): ClipAnimation[];
47
+ //# sourceMappingURL=model3dCameraKeys.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"model3dCameraKeys.d.ts","sourceRoot":"","sources":["../src/model3dCameraKeys.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAGH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAE1D,OAAO,EAML,KAAK,qBAAqB,EAC3B,MAAM,cAAc,CAAC;AAEtB,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAE/C,+EAA+E;AAC/E,eAAO,MAAM,mBAAmB,IAAI,CAAC;AACrC,eAAO,MAAM,mBAAmB,MAAM,CAAC;AAEvC,iFAAiF;AACjF,MAAM,WAAW,gBAAgB;IAC/B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAOD;;;;GAIG;AACH,wBAAgB,wBAAwB,CACtC,IAAI,EAAE,gBAAgB,EACtB,KAAK,SAAW,GACf,MAAM,GAAG,SAAS,CAmBpB;AAED,4EAA4E;AAC5E,MAAM,WAAW,uBAAwB,SAAQ,qBAAqB;IACpE,aAAa,EAAE,MAAM,CAAC;CACvB;AAED,wBAAgB,uBAAuB,CACrC,IAAI,EAAE,qBAAqB,GAC1B,uBAAuB,CAgBzB;AAED,4EAA4E;AAC5E,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAOrE;AAsCD,MAAM,WAAW,2BAA2B;IAC1C,0EAA0E;IAC1E,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;;;;;;GAOG;AACH,wBAAgB,oBAAoB,CAClC,IAAI,EAAE,YAAY,EAClB,IAAI,EAAE,MAAM,EACZ,IAAI,GAAE,OAAO,CAAC,qBAAqB,CAAM,EACzC,OAAO,GAAE,2BAAgC,GACxC,aAAa,EAAE,CAsEjB"}
@@ -0,0 +1,156 @@
1
+ /**
2
+ * Keying a `model3d` clip's free camera at one instant, and the lens
3
+ * conversion a camera patch accepts.
4
+ *
5
+ * A camera key is one keyframe on each free camera channel at the same time,
6
+ * so the whole pose is pinned there and a later key on one channel cannot
7
+ * drag the others. The channels fold by addition onto the clip's authored
8
+ * camera, so every stored value is the wanted pose minus the authored one.
9
+ */
10
+ import { parseEasing } from "./animation/easing.js";
11
+ import { setKeyframe, setKeyframeEasing } from "./keyframes.js";
12
+ import { MODEL3D_FREE_CAMERA_PROPERTIES, focalLengthMmToFovDeg, fovDegToFocalLengthMm, model3dFreeCameraPose } from "./model3d.js";
13
+ import { model3dKeyframedFreeCameraPose } from "./model3dCameraMoves.js";
14
+ /** The widest and the narrowest lens a free camera takes, vertical degrees. */
15
+ export const MODEL3D_MIN_FOV_DEG = 1;
16
+ export const MODEL3D_MAX_FOV_DEG = 170;
17
+ function round(value, digits) {
18
+ const scale = 10 ** digits;
19
+ return Math.round(value * scale) / scale;
20
+ }
21
+ /**
22
+ * The vertical field of view a lens input asks for, or undefined when it names
23
+ * no lens. `field` is the path of the object in the caller's arguments, for
24
+ * the message.
25
+ */
26
+ export function resolveModel3DLensFovDeg(lens, field = "camera") {
27
+ const { fovDeg, focalLengthMm } = lens;
28
+ if (fovDeg !== undefined && focalLengthMm !== undefined) {
29
+ throw new Error(`${field} has both fovDeg (${fovDeg}) and focalLengthMm ` +
30
+ `(${focalLengthMm}). Send one of them: focalLengthMm ` +
31
+ `${focalLengthMm} is fovDeg ${round(focalLengthMmToFovDeg(focalLengthMm), 2)}.`);
32
+ }
33
+ if (focalLengthMm !== undefined) {
34
+ if (!Number.isFinite(focalLengthMm) || focalLengthMm <= 0) {
35
+ throw new Error(`${field}.focalLengthMm must be a focal length above 0 in mm, such ` +
36
+ `as 35, and it is ${focalLengthMm}.`);
37
+ }
38
+ return focalLengthMmToFovDeg(focalLengthMm);
39
+ }
40
+ return fovDeg;
41
+ }
42
+ export function model3dFreeCameraReport(pose) {
43
+ return {
44
+ position: [
45
+ round(pose.position[0], 4),
46
+ round(pose.position[1], 4),
47
+ round(pose.position[2], 4)
48
+ ],
49
+ target: [
50
+ round(pose.target[0], 4),
51
+ round(pose.target[1], 4),
52
+ round(pose.target[2], 4)
53
+ ],
54
+ rollDeg: round(pose.rollDeg, 3),
55
+ fovDeg: round(pose.fovDeg, 3),
56
+ focalLengthMm: round(fovDegToFocalLengthMm(pose.fovDeg), 2)
57
+ };
58
+ }
59
+ /** Throws when `easing` is outside the easing grammar. `field` names it. */
60
+ export function assertKnownEasing(easing, field) {
61
+ if (parseEasing(easing) !== null)
62
+ return;
63
+ throw new Error(`${field} "${easing}" is not an easing. Use a named one such as ` +
64
+ `"linear", "easeInOut" or "easeOutExpo", or ` +
65
+ `"cubic-bezier(x1,y1,x2,y2)".`);
66
+ }
67
+ function assertFiniteVec3(value, field) {
68
+ if (value.length !== 3 || value.some((n) => !Number.isFinite(n))) {
69
+ throw new Error(`${field} must be [x, y, z] with three finite numbers, and it is ` +
70
+ `${JSON.stringify(value)}.`);
71
+ }
72
+ }
73
+ function channelOffset(property, pose, base) {
74
+ switch (property) {
75
+ case "cameraPosX":
76
+ return pose.position[0] - base.position[0];
77
+ case "cameraPosY":
78
+ return pose.position[1] - base.position[1];
79
+ case "cameraPosZ":
80
+ return pose.position[2] - base.position[2];
81
+ case "cameraTargetX":
82
+ return pose.target[0] - base.target[0];
83
+ case "cameraTargetY":
84
+ return pose.target[1] - base.target[1];
85
+ case "cameraTargetZ":
86
+ return pose.target[2] - base.target[2];
87
+ case "cameraRoll":
88
+ return pose.rollDeg - base.rollDeg;
89
+ case "cameraFov":
90
+ return pose.fovDeg - base.fovDeg;
91
+ default:
92
+ return 0;
93
+ }
94
+ }
95
+ /**
96
+ * Key the clip's free camera at `atMs`, clip-relative, and return the clip's
97
+ * new animation list, the way `setKeyframe` does.
98
+ *
99
+ * Every field `pose` leaves out keeps the value the camera has at `atMs`, so
100
+ * `{}` pins the current picture. All eight free channels get a keyframe. The
101
+ * clip has to be in `free` mode and `atMs` inside the clip.
102
+ */
103
+ export function keyModel3DFreeCamera(clip, atMs, pose = {}, options = {}) {
104
+ const style = clip.model3dStyle;
105
+ const mode = style?.camera.mode;
106
+ if (!style || mode !== "free") {
107
+ throw new Error(`keyAtMs keys a free camera, and clip "${clip.name}" has ` +
108
+ `${mode === undefined ? "no camera" : `a ${mode} camera`}. Send ` +
109
+ `patch.camera.mode "free" in the same call, or leave keyAtMs out to ` +
110
+ `change the resting pose.`);
111
+ }
112
+ if (!Number.isFinite(atMs) || atMs < 0 || atMs > clip.durationMs) {
113
+ throw new Error(`keyAtMs ${atMs} is outside clip "${clip.name}", which runs from 0 to ` +
114
+ `${clip.durationMs} ms. keyAtMs counts from the clip's start, not ` +
115
+ `from the start of the timeline.`);
116
+ }
117
+ if (pose.position)
118
+ assertFiniteVec3(pose.position, "patch.camera.position");
119
+ if (pose.target)
120
+ assertFiniteVec3(pose.target, "patch.camera.target");
121
+ if (pose.rollDeg !== undefined && !Number.isFinite(pose.rollDeg)) {
122
+ throw new Error(`patch.camera.rollDeg must be a finite number of degrees, and it is ${pose.rollDeg}.`);
123
+ }
124
+ if (pose.fovDeg !== undefined &&
125
+ !(pose.fovDeg >= MODEL3D_MIN_FOV_DEG && pose.fovDeg <= MODEL3D_MAX_FOV_DEG)) {
126
+ throw new Error(`patch.camera.fovDeg must be between ${MODEL3D_MIN_FOV_DEG} and ` +
127
+ `${MODEL3D_MAX_FOV_DEG} degrees, and it is ${pose.fovDeg}. A 35 mm ` +
128
+ `lens is fovDeg 37.85, or send focalLengthMm.`);
129
+ }
130
+ if (options.easing !== undefined) {
131
+ assertKnownEasing(options.easing, "keyEasing");
132
+ }
133
+ const current = model3dKeyframedFreeCameraPose(clip, atMs);
134
+ const wanted = {
135
+ position: pose.position ? [...pose.position] : current.position,
136
+ target: pose.target ? [...pose.target] : current.target,
137
+ rollDeg: pose.rollDeg ?? current.rollDeg,
138
+ fovDeg: pose.fovDeg ?? current.fovDeg
139
+ };
140
+ const base = model3dFreeCameraPose(style.camera);
141
+ let working = clip;
142
+ for (const property of MODEL3D_FREE_CAMERA_PROPERTIES) {
143
+ working = {
144
+ ...working,
145
+ animations: setKeyframe(working, property, atMs, channelOffset(property, wanted, base))
146
+ };
147
+ }
148
+ if (options.easing !== undefined) {
149
+ working = {
150
+ ...working,
151
+ animations: setKeyframeEasing(working, MODEL3D_FREE_CAMERA_PROPERTIES, atMs, options.easing)
152
+ };
153
+ }
154
+ return working.animations ?? [];
155
+ }
156
+ //# sourceMappingURL=model3dCameraKeys.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"model3dCameraKeys.js","sourceRoot":"","sources":["../src/model3dCameraKeys.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAEpD,OAAO,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAChE,OAAO,EACL,8BAA8B,EAC9B,qBAAqB,EACrB,qBAAqB,EACrB,qBAAqB,EAGtB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,8BAA8B,EAAE,MAAM,yBAAyB,CAAC;AAGzE,+EAA+E;AAC/E,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,CAAC;AACrC,MAAM,CAAC,MAAM,mBAAmB,GAAG,GAAG,CAAC;AAQvC,SAAS,KAAK,CAAC,KAAa,EAAE,MAAc;IAC1C,MAAM,KAAK,GAAG,EAAE,IAAI,MAAM,CAAC;IAC3B,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK,GAAG,KAAK,CAAC,GAAG,KAAK,CAAC;AAC3C,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,wBAAwB,CACtC,IAAsB,EACtB,KAAK,GAAG,QAAQ;IAEhB,MAAM,EAAE,MAAM,EAAE,a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,MAAM;QACvD,OAAO,EAAE,IAAI,CAAC,OAAO,IAAI,OAAO,CAAC,OAAO;QACxC,MAAM,EAAE,IAAI,CAAC,MAAM,IAAI,OAAO,CAAC,MAAM;KACtC,CAAC;IACF,MAAM,IAAI,GAAG,qBAAqB,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IACjD,IAAI,OAAO,GAAG,IAAI,CAAC;IACnB,KAAK,MAAM,QAAQ,IAAI,8BAA8B,EAAE,CAAC;QACtD,OAAO,GAAG;YACR,GAAG,OAAO;YACV,UAAU,EAAE,WAAW,CACrB,OAAO,EACP,QAAQ,EACR,IAAI,EACJ,aAAa,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,CAAC,CACtC;SACF,CAAC;IACJ,CAAC;IACD,IAAI,OAAO,CAAC,MAAM,KAAK,SAAS,EAAE,CAAC;QACjC,OAAO,GAAG;YACR,GAAG,OAAO;YACV,UAAU,EAAE,iBAAiB,CAC3B,OAAO,EACP,8BAA8B,EAC9B,IAAI,EACJ,OAAO,CAAC,MAAM,CACf;SACF,CAAC;IACJ,CAAC;IACD,OAAO,OAAO,CAAC,UAAU,IAAI,EAAE,CAAC;AAClC,CAAC"}
@@ -0,0 +1,97 @@
1
+ /**
2
+ * Camera move presets for a `model3d` clip's free camera.
3
+ *
4
+ * A move is a pure function from a start pose to the pose at each instant of
5
+ * the move. `model3dCameraMoveCurves` turns one into keyframe curves on the
6
+ * free camera channels, in the curve shape a custom animation stores, and
7
+ * `applyModel3DCameraMove` writes them into the clip's keyframe animation.
8
+ *
9
+ * The channels are additive, so every curve value is an offset from the start
10
+ * pose: 0 at the start of the move.
11
+ */
12
+ import type { ClipAnimation, CustomClipAnimation } from "./animation/types.js";
13
+ import { type Model3DCameraProperty, type Model3DFreeCameraPose } from "./model3d.js";
14
+ import type { TimelineClip } from "./types.js";
15
+ export type Model3DCameraMoveId = "pan" | "tilt" | "orbit" | "pushIn" | "truck" | "crane" | "pedestal" | "zoom" | "dollyZoom" | "dutch";
16
+ /**
17
+ * What a move's `amount` measures.
18
+ *
19
+ * - `degrees`: an angle.
20
+ * - `distance`: a fraction of the distance from the eye to the target at the
21
+ * start of the move, so a move reads the same on a set of any size.
22
+ * - `factor`: a multiplier on the focal length.
23
+ */
24
+ export type Model3DCameraMoveUnit = "degrees" | "distance" | "factor";
25
+ export interface Model3DCameraMoveSpec {
26
+ id: Model3DCameraMoveId;
27
+ label: string;
28
+ unit: Model3DCameraMoveUnit;
29
+ /** The amount a caller gets when it passes none. */
30
+ defaultAmount: number;
31
+ /** What a positive amount does. */
32
+ describe: string;
33
+ /** The channels the move writes. */
34
+ properties: readonly Model3DCameraProperty[];
35
+ /**
36
+ * True when the path is not a straight line in channel space, so the curves
37
+ * hold one keyframe per sample instead of a start and an end.
38
+ */
39
+ sampled: boolean;
40
+ }
41
+ export declare const MODEL3D_CAMERA_MOVES: readonly Model3DCameraMoveSpec[];
42
+ /** How many segments a sampled move is cut into by default. */
43
+ export declare const MODEL3D_CAMERA_MOVE_SAMPLES = 24;
44
+ /** A dolly never reaches the target: the eye stops at 5% of the distance. */
45
+ export declare const MODEL3D_MAX_DOLLY_FRACTION = 0.95;
46
+ export declare function model3dCameraMoveSpec(move: Model3DCameraMoveId): Model3DCameraMoveSpec;
47
+ /**
48
+ * The pose `progress` of the way through a move, 0 at the start and 1 at the
49
+ * end. `amount` defaults to the move's `defaultAmount`.
50
+ *
51
+ * Directions are the camera's own at the start of the move, with roll left
52
+ * out: "right" is horizontal and "up" is world +Y.
53
+ */
54
+ export declare function model3dCameraMovePoseAt(move: Model3DCameraMoveId, start: Model3DFreeCameraPose, progress: number, amount?: number): Model3DFreeCameraPose;
55
+ export interface Model3DCameraMoveOptions {
56
+ /** In the move's unit. The move's `defaultAmount` when absent. */
57
+ amount?: number;
58
+ /** An easing id from `animation/easing.ts`. Linear when absent. */
59
+ easing?: string;
60
+ /** Segments of a sampled move. {@link MODEL3D_CAMERA_MOVE_SAMPLES} when absent. */
61
+ samples?: number;
62
+ }
63
+ /**
64
+ * The curves of one move, in the shape `CustomClipAnimation.curves` stores:
65
+ * `t` runs 0..1 over the move and every value is an offset from the start
66
+ * pose, 0 at `t` 0.
67
+ *
68
+ * A straight move is two keyframes, with `easing` on the second, which is the
69
+ * keyframe that eases the segment arriving at it. A sampled move is evenly
70
+ * spaced linear keyframes with the easing folded into their values, because an
71
+ * arc cut into eased chords would not follow the arc.
72
+ */
73
+ export declare function model3dCameraMoveCurves(move: Model3DCameraMoveId, start: Model3DFreeCameraPose, options?: Model3DCameraMoveOptions): CustomClipAnimation["curves"];
74
+ export interface ApplyModel3DCameraMoveOptions extends Model3DCameraMoveOptions {
75
+ /** Clip-relative start of the move. 0 when absent. */
76
+ startMs?: number;
77
+ /** Length of the move. The rest of the clip when absent. */
78
+ durationMs?: number;
79
+ }
80
+ /**
81
+ * The clip's free camera at a clip-relative time, folded with its keyframe
82
+ * curves. Preset animations on the clip are not read: they add onto whatever
83
+ * the keyframes say, before and after a move alike.
84
+ */
85
+ export declare function model3dKeyframedFreeCameraPose(clip: TimelineClip, atMs: number): Model3DFreeCameraPose;
86
+ /**
87
+ * Write a camera move into the clip's keyframe animation and return the
88
+ * clip's new animation list, the way `setKeyframe` does.
89
+ *
90
+ * The move starts from the camera the clip's keyframes give at `startMs`, and
91
+ * each written value is the channel's value there plus the move's offset, so
92
+ * the picture does not jump at the start. Keyframes the move's channels
93
+ * already had inside its span are replaced. The clip has to be in `free` mode:
94
+ * convert an orbit camera with `orbitCameraToFree` first.
95
+ */
96
+ export declare function applyModel3DCameraMove(clip: TimelineClip, move: Model3DCameraMoveId, options?: ApplyModel3DCameraMoveOptions): ClipAnimation[];
97
+ //# sourceMappingURL=model3dCameraMoves.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"model3dCameraMoves.d.ts","sourceRoot":"","sources":["../src/model3dCameraMoves.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAGH,OAAO,KAAK,EAAE,aAAa,EAAE,mBA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