@redwilly/anima 0.1.0 → 0.1.2

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 (239) hide show
  1. package/dist/cli/index.js +203 -57
  2. package/dist/index.d.ts +2086 -18
  3. package/dist/index.js +5343 -22
  4. package/package.json +5 -3
  5. package/dist/cli/SceneLoader.d.ts +0 -22
  6. package/dist/cli/SceneLoader.js +0 -47
  7. package/dist/cli/commands/export-frame.d.ts +0 -13
  8. package/dist/cli/commands/export-frame.js +0 -60
  9. package/dist/cli/commands/list-scenes.d.ts +0 -5
  10. package/dist/cli/commands/list-scenes.js +0 -22
  11. package/dist/cli/commands/preview.d.ts +0 -5
  12. package/dist/cli/commands/preview.js +0 -11
  13. package/dist/cli/commands/render.d.ts +0 -16
  14. package/dist/cli/commands/render.js +0 -76
  15. package/dist/cli/index.d.ts +0 -2
  16. package/dist/core/animations/Animation.d.ts +0 -41
  17. package/dist/core/animations/Animation.js +0 -76
  18. package/dist/core/animations/camera/Follow.d.ts +0 -70
  19. package/dist/core/animations/camera/Follow.js +0 -69
  20. package/dist/core/animations/camera/Shake.d.ts +0 -90
  21. package/dist/core/animations/camera/Shake.js +0 -87
  22. package/dist/core/animations/camera/index.d.ts +0 -2
  23. package/dist/core/animations/camera/index.js +0 -2
  24. package/dist/core/animations/categories/ExitAnimation.d.ts +0 -17
  25. package/dist/core/animations/categories/ExitAnimation.js +0 -15
  26. package/dist/core/animations/categories/IntroductoryAnimation.d.ts +0 -16
  27. package/dist/core/animations/categories/IntroductoryAnimation.js +0 -14
  28. package/dist/core/animations/categories/TransformativeAnimation.d.ts +0 -25
  29. package/dist/core/animations/categories/TransformativeAnimation.js +0 -25
  30. package/dist/core/animations/categories/index.d.ts +0 -3
  31. package/dist/core/animations/categories/index.js +0 -3
  32. package/dist/core/animations/composition/Parallel.d.ts +0 -37
  33. package/dist/core/animations/composition/Parallel.js +0 -79
  34. package/dist/core/animations/composition/Sequence.d.ts +0 -41
  35. package/dist/core/animations/composition/Sequence.js +0 -95
  36. package/dist/core/animations/composition/index.d.ts +0 -2
  37. package/dist/core/animations/composition/index.js +0 -3
  38. package/dist/core/animations/draw/Draw.d.ts +0 -30
  39. package/dist/core/animations/draw/Draw.js +0 -122
  40. package/dist/core/animations/draw/Unwrite.d.ts +0 -30
  41. package/dist/core/animations/draw/Unwrite.js +0 -120
  42. package/dist/core/animations/draw/Write.d.ts +0 -35
  43. package/dist/core/animations/draw/Write.js +0 -119
  44. package/dist/core/animations/draw/index.d.ts +0 -3
  45. package/dist/core/animations/draw/index.js +0 -3
  46. package/dist/core/animations/draw/partialPath.d.ts +0 -6
  47. package/dist/core/animations/draw/partialPath.js +0 -138
  48. package/dist/core/animations/easing/bounce.d.ts +0 -13
  49. package/dist/core/animations/easing/bounce.js +0 -37
  50. package/dist/core/animations/easing/index.d.ts +0 -7
  51. package/dist/core/animations/easing/index.js +0 -11
  52. package/dist/core/animations/easing/manim.d.ts +0 -46
  53. package/dist/core/animations/easing/manim.js +0 -102
  54. package/dist/core/animations/easing/registry.d.ts +0 -8
  55. package/dist/core/animations/easing/registry.js +0 -25
  56. package/dist/core/animations/easing/standard.d.ts +0 -113
  57. package/dist/core/animations/easing/standard.js +0 -151
  58. package/dist/core/animations/easing/types.d.ts +0 -6
  59. package/dist/core/animations/easing/types.js +0 -0
  60. package/dist/core/animations/fade/FadeIn.d.ts +0 -17
  61. package/dist/core/animations/fade/FadeIn.js +0 -22
  62. package/dist/core/animations/fade/FadeOut.d.ts +0 -17
  63. package/dist/core/animations/fade/FadeOut.js +0 -23
  64. package/dist/core/animations/fade/index.d.ts +0 -2
  65. package/dist/core/animations/fade/index.js +0 -2
  66. package/dist/core/animations/index.d.ts +0 -11
  67. package/dist/core/animations/index.js +0 -17
  68. package/dist/core/animations/keyframes/KeyframeAnimation.d.ts +0 -33
  69. package/dist/core/animations/keyframes/KeyframeAnimation.js +0 -40
  70. package/dist/core/animations/keyframes/KeyframeTrack.d.ts +0 -31
  71. package/dist/core/animations/keyframes/KeyframeTrack.js +0 -83
  72. package/dist/core/animations/keyframes/index.d.ts +0 -4
  73. package/dist/core/animations/keyframes/index.js +0 -5
  74. package/dist/core/animations/keyframes/types.d.ts +0 -25
  75. package/dist/core/animations/keyframes/types.js +0 -6
  76. package/dist/core/animations/morph/MorphTo.d.ts +0 -22
  77. package/dist/core/animations/morph/MorphTo.js +0 -42
  78. package/dist/core/animations/morph/index.d.ts +0 -1
  79. package/dist/core/animations/morph/index.js +0 -1
  80. package/dist/core/animations/transform/MoveTo.d.ts +0 -24
  81. package/dist/core/animations/transform/MoveTo.js +0 -38
  82. package/dist/core/animations/transform/Rotate.d.ts +0 -23
  83. package/dist/core/animations/transform/Rotate.js +0 -34
  84. package/dist/core/animations/transform/Scale.d.ts +0 -23
  85. package/dist/core/animations/transform/Scale.js +0 -35
  86. package/dist/core/animations/transform/index.d.ts +0 -3
  87. package/dist/core/animations/transform/index.js +0 -3
  88. package/dist/core/animations/types.d.ts +0 -52
  89. package/dist/core/animations/types.js +0 -6
  90. package/dist/core/camera/Camera.d.ts +0 -87
  91. package/dist/core/camera/Camera.js +0 -175
  92. package/dist/core/camera/CameraFrame.d.ts +0 -242
  93. package/dist/core/camera/CameraFrame.js +0 -322
  94. package/dist/core/camera/index.d.ts +0 -4
  95. package/dist/core/camera/index.js +0 -3
  96. package/dist/core/camera/types.d.ts +0 -17
  97. package/dist/core/camera/types.js +0 -1
  98. package/dist/core/errors/AnimationErrors.d.ts +0 -12
  99. package/dist/core/errors/AnimationErrors.js +0 -37
  100. package/dist/core/errors/index.d.ts +0 -1
  101. package/dist/core/errors/index.js +0 -1
  102. package/dist/core/math/Vector2/Vector2.d.ts +0 -23
  103. package/dist/core/math/Vector2/Vector2.js +0 -46
  104. package/dist/core/math/Vector2/index.d.ts +0 -1
  105. package/dist/core/math/Vector2/index.js +0 -1
  106. package/dist/core/math/bezier/BezierPath.d.ts +0 -38
  107. package/dist/core/math/bezier/BezierPath.js +0 -264
  108. package/dist/core/math/bezier/evaluators.d.ts +0 -9
  109. package/dist/core/math/bezier/evaluators.js +0 -36
  110. package/dist/core/math/bezier/index.d.ts +0 -8
  111. package/dist/core/math/bezier/index.js +0 -6
  112. package/dist/core/math/bezier/length.d.ts +0 -5
  113. package/dist/core/math/bezier/length.js +0 -27
  114. package/dist/core/math/bezier/morphing.d.ts +0 -16
  115. package/dist/core/math/bezier/morphing.js +0 -151
  116. package/dist/core/math/bezier/sampling.d.ts +0 -7
  117. package/dist/core/math/bezier/sampling.js +0 -153
  118. package/dist/core/math/bezier/split.d.ts +0 -19
  119. package/dist/core/math/bezier/split.js +0 -44
  120. package/dist/core/math/bezier/types.d.ts +0 -8
  121. package/dist/core/math/bezier/types.js +0 -0
  122. package/dist/core/math/color/Color.d.ts +0 -28
  123. package/dist/core/math/color/Color.js +0 -60
  124. package/dist/core/math/color/conversions.d.ts +0 -17
  125. package/dist/core/math/color/conversions.js +0 -100
  126. package/dist/core/math/color/index.d.ts +0 -2
  127. package/dist/core/math/color/index.js +0 -2
  128. package/dist/core/math/index.d.ts +0 -4
  129. package/dist/core/math/index.js +0 -5
  130. package/dist/core/math/matrix/Matrix3x3.d.ts +0 -23
  131. package/dist/core/math/matrix/Matrix3x3.js +0 -91
  132. package/dist/core/math/matrix/factories.d.ts +0 -12
  133. package/dist/core/math/matrix/factories.js +0 -44
  134. package/dist/core/math/matrix/index.d.ts +0 -2
  135. package/dist/core/math/matrix/index.js +0 -2
  136. package/dist/core/renderer/FrameRenderer.d.ts +0 -37
  137. package/dist/core/renderer/FrameRenderer.js +0 -75
  138. package/dist/core/renderer/ProgressReporter.d.ts +0 -19
  139. package/dist/core/renderer/ProgressReporter.js +0 -58
  140. package/dist/core/renderer/Renderer.d.ts +0 -36
  141. package/dist/core/renderer/Renderer.js +0 -102
  142. package/dist/core/renderer/drawMobject.d.ts +0 -8
  143. package/dist/core/renderer/drawMobject.js +0 -109
  144. package/dist/core/renderer/formats/index.d.ts +0 -3
  145. package/dist/core/renderer/formats/index.js +0 -3
  146. package/dist/core/renderer/formats/png.d.ts +0 -5
  147. package/dist/core/renderer/formats/png.js +0 -7
  148. package/dist/core/renderer/formats/sprite.d.ts +0 -6
  149. package/dist/core/renderer/formats/sprite.js +0 -24
  150. package/dist/core/renderer/formats/video.d.ts +0 -8
  151. package/dist/core/renderer/formats/video.js +0 -51
  152. package/dist/core/renderer/index.d.ts +0 -7
  153. package/dist/core/renderer/index.js +0 -9
  154. package/dist/core/renderer/types.d.ts +0 -87
  155. package/dist/core/renderer/types.js +0 -13
  156. package/dist/core/scene/Scene.d.ts +0 -104
  157. package/dist/core/scene/Scene.js +0 -225
  158. package/dist/core/scene/index.d.ts +0 -2
  159. package/dist/core/scene/index.js +0 -1
  160. package/dist/core/scene/types.d.ts +0 -23
  161. package/dist/core/scene/types.js +0 -0
  162. package/dist/core/serialization/animation.d.ts +0 -23
  163. package/dist/core/serialization/animation.js +0 -176
  164. package/dist/core/serialization/easingLookup.d.ts +0 -13
  165. package/dist/core/serialization/easingLookup.js +0 -65
  166. package/dist/core/serialization/index.d.ts +0 -23
  167. package/dist/core/serialization/index.js +0 -29
  168. package/dist/core/serialization/mobject.d.ts +0 -23
  169. package/dist/core/serialization/mobject.js +0 -248
  170. package/dist/core/serialization/prettyPrint.d.ts +0 -12
  171. package/dist/core/serialization/prettyPrint.js +0 -16
  172. package/dist/core/serialization/primitives.d.ts +0 -24
  173. package/dist/core/serialization/primitives.js +0 -98
  174. package/dist/core/serialization/registry.d.ts +0 -29
  175. package/dist/core/serialization/registry.js +0 -39
  176. package/dist/core/serialization/scene.d.ts +0 -28
  177. package/dist/core/serialization/scene.js +0 -114
  178. package/dist/core/serialization/types.d.ts +0 -152
  179. package/dist/core/serialization/types.js +0 -6
  180. package/dist/core/timeline/Timeline.d.ts +0 -70
  181. package/dist/core/timeline/Timeline.js +0 -144
  182. package/dist/core/timeline/index.d.ts +0 -5
  183. package/dist/core/timeline/index.js +0 -4
  184. package/dist/core/timeline/types.d.ts +0 -29
  185. package/dist/core/timeline/types.js +0 -0
  186. package/dist/mobjects/Mobject.d.ts +0 -98
  187. package/dist/mobjects/Mobject.js +0 -343
  188. package/dist/mobjects/VGroup/VGroup.d.ts +0 -51
  189. package/dist/mobjects/VGroup/VGroup.js +0 -142
  190. package/dist/mobjects/VGroup/index.d.ts +0 -3
  191. package/dist/mobjects/VGroup/index.js +0 -2
  192. package/dist/mobjects/VGroup/layout.d.ts +0 -20
  193. package/dist/mobjects/VGroup/layout.js +0 -139
  194. package/dist/mobjects/VMobject.d.ts +0 -106
  195. package/dist/mobjects/VMobject.js +0 -216
  196. package/dist/mobjects/geometry/Arc.d.ts +0 -8
  197. package/dist/mobjects/geometry/Arc.js +0 -46
  198. package/dist/mobjects/geometry/Arrow.d.ts +0 -7
  199. package/dist/mobjects/geometry/Arrow.js +0 -34
  200. package/dist/mobjects/geometry/Circle.d.ts +0 -4
  201. package/dist/mobjects/geometry/Circle.js +0 -10
  202. package/dist/mobjects/geometry/Line.d.ts +0 -8
  203. package/dist/mobjects/geometry/Line.js +0 -19
  204. package/dist/mobjects/geometry/Point.d.ts +0 -5
  205. package/dist/mobjects/geometry/Point.js +0 -11
  206. package/dist/mobjects/geometry/Polygon.d.ts +0 -7
  207. package/dist/mobjects/geometry/Polygon.js +0 -21
  208. package/dist/mobjects/geometry/Rectangle.d.ts +0 -6
  209. package/dist/mobjects/geometry/Rectangle.js +0 -18
  210. package/dist/mobjects/geometry/index.d.ts +0 -7
  211. package/dist/mobjects/geometry/index.js +0 -7
  212. package/dist/mobjects/graph/Graph.d.ts +0 -28
  213. package/dist/mobjects/graph/Graph.js +0 -119
  214. package/dist/mobjects/graph/GraphEdge.d.ts +0 -26
  215. package/dist/mobjects/graph/GraphEdge.js +0 -64
  216. package/dist/mobjects/graph/GraphNode.d.ts +0 -19
  217. package/dist/mobjects/graph/GraphNode.js +0 -63
  218. package/dist/mobjects/graph/index.d.ts +0 -5
  219. package/dist/mobjects/graph/index.js +0 -5
  220. package/dist/mobjects/graph/layouts/circular.d.ts +0 -8
  221. package/dist/mobjects/graph/layouts/circular.js +0 -23
  222. package/dist/mobjects/graph/layouts/forceDirected.d.ts +0 -9
  223. package/dist/mobjects/graph/layouts/forceDirected.js +0 -102
  224. package/dist/mobjects/graph/layouts/index.d.ts +0 -3
  225. package/dist/mobjects/graph/layouts/index.js +0 -3
  226. package/dist/mobjects/graph/layouts/tree.d.ts +0 -9
  227. package/dist/mobjects/graph/layouts/tree.js +0 -99
  228. package/dist/mobjects/graph/types.d.ts +0 -35
  229. package/dist/mobjects/graph/types.js +0 -0
  230. package/dist/mobjects/index.d.ts +0 -6
  231. package/dist/mobjects/index.js +0 -6
  232. package/dist/mobjects/text/Glyph.d.ts +0 -11
  233. package/dist/mobjects/text/Glyph.js +0 -72
  234. package/dist/mobjects/text/Text.d.ts +0 -19
  235. package/dist/mobjects/text/Text.js +0 -76
  236. package/dist/mobjects/text/index.d.ts +0 -4
  237. package/dist/mobjects/text/index.js +0 -3
  238. package/dist/mobjects/text/types.d.ts +0 -12
  239. package/dist/mobjects/text/types.js +0 -8
package/dist/cli/index.js CHANGED
@@ -1,63 +1,209 @@
1
- #!/usr/bin/env bun
2
- import { Command } from 'commander';
3
- import { listScenes } from './commands/list-scenes';
4
- import { render } from './commands/render';
5
- import { preview } from './commands/preview';
6
- import { exportFrame } from './commands/export-frame';
7
- const program = new Command();
8
- program
9
- .name('anima')
10
- .description('CLI for Anima animation engine')
11
- .version('0.1.0');
12
- // Global options
13
- program.option('-d, --debug', 'output extra debugging');
14
- // list-scenes command
15
- program
16
- .command('list-scenes')
17
- .description('List all scenes in a file')
18
- .argument('<file>', 'TypeScript file to load')
19
- .action(async (file) => {
20
- await listScenes(file);
1
+ #!/usr/bin/env node
2
+
3
+ // src/cli/index.ts
4
+ import { Command } from "commander";
5
+
6
+ // src/cli/SceneLoader.ts
7
+ import { Scene } from "@redwilly/anima";
8
+ import { pathToFileURL } from "url";
9
+ import { resolve } from "path";
10
+ var SceneLoader = class {
11
+ /**
12
+ * Loads all scenes from the specified file.
13
+ *
14
+ * @param filePath Path to the TypeScript file containing scenes
15
+ * @returns Loaded scenes and any error
16
+ */
17
+ async load(filePath) {
18
+ const absolutePath = resolve(filePath);
19
+ const fileUrl = pathToFileURL(absolutePath).href;
20
+ try {
21
+ const module = await import(fileUrl);
22
+ const scenes = /* @__PURE__ */ new Map();
23
+ for (const [name, exportValue] of Object.entries(module)) {
24
+ if (typeof exportValue === "function" && exportValue.prototype instanceof Scene) {
25
+ try {
26
+ const SceneClass = exportValue;
27
+ const instance = new SceneClass();
28
+ scenes.set(name, instance);
29
+ } catch (err) {
30
+ console.warn(`Failed to instantiate scene '${name}':`, err);
31
+ }
32
+ }
33
+ }
34
+ if (scenes.size === 0) {
35
+ return { scenes, error: "No Scene subclasses found in file." };
36
+ }
37
+ return { scenes };
38
+ } catch (err) {
39
+ return {
40
+ scenes: /* @__PURE__ */ new Map(),
41
+ error: `Failed to load file: ${err instanceof Error ? err.message : String(err)}`
42
+ };
43
+ }
44
+ }
45
+ };
46
+
47
+ // src/cli/commands/list-scenes.ts
48
+ import { resolve as resolve2 } from "path";
49
+ async function listScenes(file) {
50
+ const loader = new SceneLoader();
51
+ const { scenes, error } = await loader.load(file);
52
+ if (error) {
53
+ console.error(`Error: ${error}`);
54
+ process.exit(1);
55
+ }
56
+ if (scenes.size === 0) {
57
+ console.log("No scenes found in this file.");
58
+ return;
59
+ }
60
+ console.log(`Found ${scenes.size} scene(s) in '${resolve2(file)}':`);
61
+ for (const name of scenes.keys()) {
62
+ console.log(` - ${name}`);
63
+ }
64
+ }
65
+
66
+ // src/cli/commands/render.ts
67
+ import { Renderer, Resolution } from "@redwilly/anima";
68
+ async function render(file, options) {
69
+ const loader = new SceneLoader();
70
+ const { scenes, error } = await loader.load(file);
71
+ if (error) {
72
+ console.error(`Error: ${error}`);
73
+ process.exit(1);
74
+ }
75
+ let scene;
76
+ if (options.scene) {
77
+ const found = scenes.get(options.scene);
78
+ if (!found) {
79
+ console.error(`Error: Scene '${options.scene}' not found in file.`);
80
+ console.log("Available scenes:");
81
+ for (const name of scenes.keys()) {
82
+ console.log(` - ${name}`);
83
+ }
84
+ process.exit(1);
85
+ }
86
+ scene = found;
87
+ } else {
88
+ if (scenes.size === 1) {
89
+ scene = scenes.values().next().value;
90
+ } else {
91
+ console.error("Error: Multiple scenes found in file. Please specify one with --scene.");
92
+ for (const name of scenes.keys()) {
93
+ console.log(` - ${name}`);
94
+ }
95
+ process.exit(1);
96
+ }
97
+ }
98
+ if (!scene) {
99
+ console.error("Error: No scene found to render.");
100
+ process.exit(1);
101
+ }
102
+ const renderer = new Renderer();
103
+ const outputPath = options.output ?? `output.${options.format ?? "mp4"}`;
104
+ let width = scene.getWidth();
105
+ let height = scene.getHeight();
106
+ if (options.resolution) {
107
+ const presetKey = `p${options.resolution}`;
108
+ const preset = Resolution[presetKey];
109
+ if (preset) {
110
+ width = preset.width;
111
+ height = preset.height;
112
+ } else {
113
+ console.warn(`Warning: Resolution preset '${options.resolution}' not found. Using scene defaults.`);
114
+ }
115
+ }
116
+ console.log(`Rendering scene to '${outputPath}'...`);
117
+ await renderer.render(scene, outputPath, {
118
+ width,
119
+ height,
120
+ frameRate: options.fps ? parseInt(options.fps, 10) : void 0,
121
+ format: options.format,
122
+ quality: options.quality,
123
+ onProgress: (progress) => {
124
+ const percent = progress.percentage.toFixed(1);
125
+ const eta = (progress.estimatedRemainingMs / 1e3).toFixed(1);
126
+ process.stdout.write(`\rProgress: ${percent}% | ETA: ${eta}s `);
127
+ if (progress.percentage === 100) {
128
+ process.stdout.write("\n");
129
+ }
130
+ }
131
+ });
132
+ console.log("Rendering complete.");
133
+ }
134
+
135
+ // src/cli/commands/preview.ts
136
+ async function preview(file, options) {
137
+ await render(file, {
138
+ ...options,
139
+ quality: "preview"
140
+ });
141
+ }
142
+
143
+ // src/cli/commands/export-frame.ts
144
+ import { Renderer as Renderer2 } from "@redwilly/anima";
145
+ async function exportFrame(file, options) {
146
+ const loader = new SceneLoader();
147
+ const { scenes, error } = await loader.load(file);
148
+ if (error) {
149
+ console.error(`Error: ${error}`);
150
+ process.exit(1);
151
+ }
152
+ let scene;
153
+ if (options.scene) {
154
+ scene = scenes.get(options.scene);
155
+ if (!scene) {
156
+ console.error(`Error: Scene '${options.scene}' not found.`);
157
+ process.exit(1);
158
+ }
159
+ } else if (scenes.size === 1) {
160
+ scene = scenes.values().next().value;
161
+ } else {
162
+ console.error("Error: Multiple scenes found in file. Please specify one with --scene.");
163
+ process.exit(1);
164
+ }
165
+ if (!scene) {
166
+ console.error("Error: No scene found.");
167
+ process.exit(1);
168
+ }
169
+ const renderer = new Renderer2();
170
+ const totalDuration = scene.getTotalDuration();
171
+ const frameRate = scene.getFrameRate();
172
+ let time;
173
+ if (options.frame === "last") {
174
+ time = totalDuration;
175
+ } else {
176
+ const frameIndex = parseInt(options.frame, 10);
177
+ time = frameIndex / frameRate;
178
+ }
179
+ const outputPath = options.output ?? `frame_${options.frame}.png`;
180
+ console.log(`Exporting frame ${options.frame} to '${outputPath}'...`);
181
+ if (options.frame === "last") {
182
+ await renderer.renderLastFrame(scene, outputPath);
183
+ } else {
184
+ await renderer.renderLastFrame(scene, outputPath);
185
+ }
186
+ console.log("Export complete.");
187
+ }
188
+
189
+ // src/cli/index.ts
190
+ var program = new Command();
191
+ program.name("anima").description("CLI for Anima animation engine").version("0.1.0");
192
+ program.option("-d, --debug", "output extra debugging");
193
+ program.command("list-scenes").description("List all scenes in a file").argument("<file>", "TypeScript file to load").action(async (file) => {
194
+ await listScenes(file);
21
195
  });
22
- // render command
23
- program
24
- .command('render')
25
- .description('Render a scene from a file')
26
- .argument('<file>', 'TypeScript file to load')
27
- .option('-s, --scene <name>', 'Specific scene to render')
28
- .option('-f, --format <type>', 'Output format (mp4, webp, gif, sprite, png)', 'mp4')
29
- .option('-r, --resolution <preset>', 'Resolution preset (480, 720, 1080, 4K)')
30
- .option('--fps <number>', 'Frames per second')
31
- .option('-q, --quality <level>', 'Render quality (production, preview)', 'production')
32
- .option('-o, --output <path>', 'Output file path')
33
- .action(async (file, options) => {
34
- await render(file, options);
196
+ program.command("render").description("Render a scene from a file").argument("<file>", "TypeScript file to load").option("-s, --scene <name>", "Specific scene to render").option("-f, --format <type>", "Output format (mp4, webp, gif, sprite, png)", "mp4").option("-r, --resolution <preset>", "Resolution preset (480, 720, 1080, 4K)").option("--fps <number>", "Frames per second").option("-q, --quality <level>", "Render quality (production, preview)", "production").option("-o, --output <path>", "Output file path").action(async (file, options) => {
197
+ await render(file, options);
35
198
  });
36
- // preview command
37
- program
38
- .command('preview')
39
- .description('Quickly preview a scene (lower quality)')
40
- .argument('<file>', 'TypeScript file to load')
41
- .option('-s, --scene <name>', 'Specific scene to preview')
42
- .option('-f, --format <type>', 'Output format', 'mp4')
43
- .option('-o, --output <path>', 'Output file path')
44
- .action(async (file, options) => {
45
- await preview(file, options);
199
+ program.command("preview").description("Quickly preview a scene (lower quality)").argument("<file>", "TypeScript file to load").option("-s, --scene <name>", "Specific scene to preview").option("-f, --format <type>", "Output format", "mp4").option("-o, --output <path>", "Output file path").action(async (file, options) => {
200
+ await preview(file, options);
46
201
  });
47
- // export-frame command
48
- program
49
- .command('export-frame')
50
- .description('Export a single frame as PNG')
51
- .argument('<file>', 'TypeScript file to load')
52
- .option('-s, --scene <name>', 'Specific scene')
53
- .option('--frame <number|last>', 'Frame number or "last"', 'last')
54
- .option('-o, --output <path>', 'Output file path')
55
- .action(async (file, options) => {
56
- await exportFrame(file, options);
202
+ program.command("export-frame").description("Export a single frame as PNG").argument("<file>", "TypeScript file to load").option("-s, --scene <name>", "Specific scene").option("--frame <number|last>", 'Frame number or "last"', "last").option("-o, --output <path>", "Output file path").action(async (file, options) => {
203
+ await exportFrame(file, options);
57
204
  });
58
- // Handle unknown commands
59
- program.on('command:*', () => {
60
- console.error('Invalid command: %s\nSee --help for a list of available commands.', program.args.join(' '));
61
- process.exit(1);
205
+ program.on("command:*", () => {
206
+ console.error("Invalid command: %s\nSee --help for a list of available commands.", program.args.join(" "));
207
+ process.exit(1);
62
208
  });
63
209
  program.parse(process.argv);