@beff/aula 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -6,4 +6,4 @@ The `aula` command is in [`@beff/aula-cli`](https://www.npmjs.com/package/@beff/
6
6
 
7
7
  ## Licenses
8
8
 
9
- aula's own code is MIT; the engine includes eSpeak NG, GPL-3.0-or-later, so the package as a whole is MIT AND GPL-3.0-or-later. The engine component also has third-party code and data, with their own licenses, in `dist/licenses/`: eSpeak NG (GPL-3.0-or-later), misaki (Apache-2.0), spaCy (MIT) and the fonts Nunito Sans and JetBrains Mono (SIL Open Font License 1.1).
9
+ aula's own code is MIT; the engine includes eSpeak NG, GPL-3.0-or-later, so the package as a whole is MIT AND GPL-3.0-or-later. The engine component also has third-party code and data, with their own licenses, in `dist/licenses/`: eSpeak NG (GPL-3.0-or-later), misaki (Apache-2.0), spaCy (MIT), Skia's PathOps (BSD-3-Clause, ported to Rust by valo-pathops, MIT) and the fonts Nunito Sans and JetBrains Mono (SIL Open Font License 1.1).
@@ -139,7 +139,8 @@ export declare class FadeTransformAnimation extends TransformAnimation {
139
139
  * from `mobject`'s box (Manim `FadeTransform`). At the end the target takes its place. */
140
140
  export declare function FadeTransform(mobject: Mobject, targetMobject: Mobject, opts?: FadeTransformOptions): FadeTransformAnimation;
141
141
  /** `FadeTransform` part by part: each submobject of `mobject` goes to the submobject of
142
- * `targetMobject` at the same place in the list (Manim `FadeTransformPieces`). */
142
+ * `targetMobject` at the same place in the list (Manim `FadeTransformPieces`). It is one
143
+ * transform, as in Manim: the rate and the lag ratio apply to all the parts together. */
143
144
  export declare function FadeTransformPieces(mobject: Mobject, targetMobject: Mobject, opts?: FadeTransformOptions): FadeTransformAnimation;
144
145
  /** Draws the strokes of the mobject from their start (Manim `Create`; `lagRatio` 1: one part
145
146
  * after another). */
@@ -541,26 +541,11 @@ class FadeTransformPiecesAnimation extends FadeTransformAnimation {
541
541
  }
542
542
  }
543
543
  /** `FadeTransform` part by part: each submobject of `mobject` goes to the submobject of
544
- * `targetMobject` at the same place in the list (Manim `FadeTransformPieces`). */
544
+ * `targetMobject` at the same place in the list (Manim `FadeTransformPieces`). It is one
545
+ * transform, as in Manim: the rate and the lag ratio apply to all the parts together. */
545
546
  export function FadeTransformPieces(mobject, targetMobject, opts = {}) {
546
- const sources = mobject.submobjects;
547
- const targets = targetMobject.submobjects;
548
- if (sources.length === 0 || targets.length === 0)
549
- return FadeTransform(mobject, targetMobject, opts);
550
- const { runTime, rateFunc: rate, lagRatio, stretch = true, dimToMatch = 1, ...each } = opts;
551
- const n = Math.max(sources.length, targets.length);
552
- const pieces = Array.from({ length: n }, (_, i) => {
553
- const s = sources[Math.min(i, sources.length - 1)];
554
- const t = targets[Math.min(i, targets.length - 1)];
555
- const source = i < sources.length ? s : s?.copy();
556
- return source === undefined || t === undefined ? [] : [FadeTransform(source, t, { ...each, stretch, dimToMatch })];
557
- }).flat();
558
- const handle = engine.animationGroup(animations("FadeTransformPieces", pieces));
559
- const a = engineAnimation(FadeTransformPiecesAnimation, handle, mobject, {
560
- ...(runTime === undefined ? {} : { runTime }),
561
- ...(rate === undefined ? {} : { rateFunc: rate }),
562
- ...(lagRatio === undefined ? {} : { lagRatio }),
563
- }, { rate: linear });
547
+ const { stretch = true, dimToMatch = 1, ...rest } = opts;
548
+ const a = engineAnimation(FadeTransformPiecesAnimation, engine.fadeTransformPieces(raw(mobject), raw(targetMobject), stretch, dimToMatch), mobject, rest);
564
549
  a.targetMobject = targetMobject;
565
550
  a.stretch = stretch;
566
551
  a.dimToMatch = dimToMatch;
package/dist/engine.js CHANGED
@@ -3176,20 +3176,13 @@ function rowsOf(chapter) {
3176
3176
  function noteList(notes) {
3177
3177
  return Object.entries(notes).map(([key, v]) => ({ key, values: typeof v === "string" ? [v] : [...v] }));
3178
3178
  }
3179
- /** Gives the rows to the engine in order; with a scene, it runs each move after its `show`.
3180
- * With a scene, it stops at the first paragraph that the narration does not cover (a partial
3181
- * render): the moves after it do not run. */
3179
+ /** Gives the rows to the engine in order; with a scene, it runs each move after its `show`. */
3182
3180
  function write(handle, chapter, rows, slot, scene, card) {
3183
- const narrated = scene === undefined ? Infinity : handle.narratedParagraphs();
3184
- let paragraphs = 0;
3185
3181
  handle.header(placeIn(chapter.call, slot), chapter.heading, chapter.metaphor);
3186
3182
  card?.();
3187
3183
  for (const r of rows) {
3188
3184
  const at = placeIn(r.call, slot);
3189
3185
  if (r.kind === "paragraph") {
3190
- paragraphs += 1;
3191
- if (paragraphs > narrated)
3192
- return;
3193
3186
  handle.paragraph(at, noteList(r.notes));
3194
3187
  }
3195
3188
  else if (r.kind === "say") {
@@ -3330,8 +3323,7 @@ function finished(handle) {
3330
3323
  * error). */
3331
3324
  export function drawRows(chapter, theme, card, slot, drawing) {
3332
3325
  const rows = rowsOf(chapter);
3333
- const { text } = textOf(chapter, rows, slot);
3334
- const handle = engine.Chapter.render(drawing.narration, theme.background, slot.number, drawing.count, drawing.name, drawing.lint, text);
3326
+ const handle = engine.Chapter.render(drawing.narration, theme.background, slot.number, drawing.count, drawing.name, drawing.lint);
3335
3327
  const scene = new Scene(handle, slot);
3336
3328
  const heading = { title: chapter.heading, chapter: slot.number, count: slot.count, theme };
3337
3329
  write(handle, chapter, rows, slot, scene, () => {
@@ -3342,7 +3334,7 @@ export function drawRows(chapter, theme, card, slot, drawing) {
3342
3334
  /** Draws chapter 0: the card of the project `title` while the title is spoken. */
3343
3335
  export function drawTitle(title, theme, card, drawing) {
3344
3336
  freshSeed();
3345
- const handle = engine.Chapter.render(drawing.narration, theme.background, 0, drawing.count, drawing.name, drawing.lint, undefined);
3337
+ const handle = engine.Chapter.render(drawing.narration, theme.background, 0, drawing.count, drawing.name, drawing.lint);
3346
3338
  const count = drawing.count - 1;
3347
3339
  const slot = { number: 0, count, source: "", file: "", frames: () => [] };
3348
3340
  playCard(handle, slot, { file: "", line: 0, col: 0 }, card, { title, chapter: 0, count, theme });
Binary file
Binary file
Binary file