canvas-recorder-lib 0.8.1 → 0.8.4
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 +10 -2
- package/dev/canvas-recorder.css +20 -6
- package/dev/canvas-recorder.ts +389 -54
- package/dev/color-picker.ts +13 -0
- package/dev/component-picker.ts +60 -11
- package/dev/delay-files.ts +3 -1
- package/dev/font-widgets.ts +2 -2
- package/dev/format-editor.ts +3 -1
- package/dev/fourier-panel.ts +7 -3
- package/dev/handwriting-panel.ts +7 -7
- package/dev/multi-text-dialog.ts +28 -15
- package/dev/player-body.ts +78 -33
- package/dev/schedule-helpers.ts +10 -3
- package/dev/static-image-panel.ts +4 -4
- package/dev/subtitles.ts +170 -0
- package/dev/synced-file.ts +34 -0
- package/dev/timeline-display.ts +1 -1
- package/dev/transcribe-core.ts +7 -4
- package/dev/transcript-align.ts +24 -18
- package/dev/transcript-editor.ts +1187 -0
- package/dev/transcript-export.ts +90 -0
- package/dev/transcript-view.ts +8 -5
- package/dev/transcripts.ts +140 -15
- package/dev/video-clip-panel.ts +4 -4
- package/dist/dev/canvas-recorder.css +20 -6
- package/dist/dev/canvas-recorder.js +314 -48
- package/dist/dev/canvas-recorder.js.map +1 -1
- package/dist/dev/color-picker.d.ts.map +1 -1
- package/dist/dev/color-picker.js +15 -0
- package/dist/dev/color-picker.js.map +1 -1
- package/dist/dev/component-picker.d.ts +2 -1
- package/dist/dev/component-picker.d.ts.map +1 -1
- package/dist/dev/component-picker.js +56 -11
- package/dist/dev/component-picker.js.map +1 -1
- package/dist/dev/delay-files.d.ts.map +1 -1
- package/dist/dev/delay-files.js +3 -1
- package/dist/dev/delay-files.js.map +1 -1
- package/dist/dev/font-widgets.d.ts +2 -2
- package/dist/dev/font-widgets.d.ts.map +1 -1
- package/dist/dev/font-widgets.js.map +1 -1
- package/dist/dev/format-editor.d.ts.map +1 -1
- package/dist/dev/format-editor.js +3 -1
- package/dist/dev/format-editor.js.map +1 -1
- package/dist/dev/fourier-panel.d.ts.map +1 -1
- package/dist/dev/fourier-panel.js +4 -3
- package/dist/dev/fourier-panel.js.map +1 -1
- package/dist/dev/handwriting-panel.d.ts +4 -4
- package/dist/dev/handwriting-panel.d.ts.map +1 -1
- package/dist/dev/handwriting-panel.js.map +1 -1
- package/dist/dev/multi-text-dialog.d.ts.map +1 -1
- package/dist/dev/multi-text-dialog.js +23 -12
- package/dist/dev/multi-text-dialog.js.map +1 -1
- package/dist/dev/player-body.d.ts +1 -1
- package/dist/dev/player-body.d.ts.map +1 -1
- package/dist/dev/player-body.js +78 -33
- package/dist/dev/player-body.js.map +1 -1
- package/dist/dev/schedule-helpers.d.ts.map +1 -1
- package/dist/dev/schedule-helpers.js +4 -2
- package/dist/dev/schedule-helpers.js.map +1 -1
- package/dist/dev/static-image-panel.d.ts +3 -3
- package/dist/dev/static-image-panel.d.ts.map +1 -1
- package/dist/dev/subtitles.d.ts +36 -0
- package/dist/dev/subtitles.d.ts.map +1 -0
- package/dist/dev/subtitles.js +135 -0
- package/dist/dev/subtitles.js.map +1 -0
- package/dist/dev/synced-file.d.ts +14 -0
- package/dist/dev/synced-file.d.ts.map +1 -1
- package/dist/dev/synced-file.js +22 -0
- package/dist/dev/synced-file.js.map +1 -1
- package/dist/dev/timeline-display.d.ts +5 -0
- package/dist/dev/timeline-display.d.ts.map +1 -1
- package/dist/dev/timeline-display.js +1 -1
- package/dist/dev/timeline-display.js.map +1 -1
- package/dist/dev/transcribe-core.d.ts.map +1 -1
- package/dist/dev/transcribe-core.js +7 -4
- package/dist/dev/transcribe-core.js.map +1 -1
- package/dist/dev/transcript-align.d.ts +6 -4
- package/dist/dev/transcript-align.d.ts.map +1 -1
- package/dist/dev/transcript-align.js +18 -13
- package/dist/dev/transcript-align.js.map +1 -1
- package/dist/dev/transcript-editor.d.ts +36 -0
- package/dist/dev/transcript-editor.d.ts.map +1 -0
- package/dist/dev/transcript-editor.js +948 -0
- package/dist/dev/transcript-editor.js.map +1 -0
- package/dist/dev/transcript-export.d.ts +21 -0
- package/dist/dev/transcript-export.d.ts.map +1 -1
- package/dist/dev/transcript-export.js +65 -0
- package/dist/dev/transcript-export.js.map +1 -1
- package/dist/dev/transcript-view.d.ts +2 -0
- package/dist/dev/transcript-view.d.ts.map +1 -1
- package/dist/dev/transcript-view.js +1 -1
- package/dist/dev/transcript-view.js.map +1 -1
- package/dist/dev/transcripts.d.ts +18 -1
- package/dist/dev/transcripts.d.ts.map +1 -1
- package/dist/dev/transcripts.js +102 -12
- package/dist/dev/transcripts.js.map +1 -1
- package/dist/dev/video-clip-panel.d.ts +3 -3
- package/dist/dev/video-clip-panel.d.ts.map +1 -1
- package/dist/lib/index.d.ts +1 -0
- package/dist/lib/index.d.ts.map +1 -1
- package/dist/lib/index.js +1 -0
- package/dist/lib/index.js.map +1 -1
- package/dist/src/glib/line-font.d.ts +6 -0
- package/dist/src/glib/line-font.d.ts.map +1 -1
- package/dist/src/glib/line-font.js +9 -0
- package/dist/src/glib/line-font.js.map +1 -1
- package/dist/src/glib/path-shape.d.ts +23 -0
- package/dist/src/glib/path-shape.d.ts.map +1 -1
- package/dist/src/glib/path-shape.js +66 -221
- package/dist/src/glib/path-shape.js.map +1 -1
- package/dist/src/glib/svg-arc.d.ts +41 -0
- package/dist/src/glib/svg-arc.d.ts.map +1 -0
- package/dist/src/glib/svg-arc.js +114 -0
- package/dist/src/glib/svg-arc.js.map +1 -0
- package/dist/src/glib/svg-path-parser.d.ts +60 -0
- package/dist/src/glib/svg-path-parser.d.ts.map +1 -0
- package/dist/src/glib/svg-path-parser.js +258 -0
- package/dist/src/glib/svg-path-parser.js.map +1 -0
- package/dist/src/glib/transforms.d.ts +9 -0
- package/dist/src/glib/transforms.d.ts.map +1 -1
- package/dist/src/glib/transforms.js +7 -4
- package/dist/src/glib/transforms.js.map +1 -1
- package/dist/src/interpolate.d.ts +17 -10
- package/dist/src/interpolate.d.ts.map +1 -1
- package/dist/src/interpolate.js +1 -17
- package/dist/src/interpolate.js.map +1 -1
- package/dist/src/morph-animation.js +1 -1
- package/dist/src/morph-animation.js.map +1 -1
- package/dist/src/peano-fourier/fourier-shared.d.ts.map +1 -1
- package/dist/src/peano-fourier/fourier-shared.js +4 -2
- package/dist/src/peano-fourier/fourier-shared.js.map +1 -1
- package/dist/src/schedule-helper.d.ts +50 -28
- package/dist/src/schedule-helper.d.ts.map +1 -1
- package/dist/src/schedule-helper.js +22 -0
- package/dist/src/schedule-helper.js.map +1 -1
- package/dist/src/showable.d.ts +57 -10
- package/dist/src/showable.d.ts.map +1 -1
- package/dist/src/showable.js +19 -0
- package/dist/src/showable.js.map +1 -1
- package/dist/src/slide-components/arrow.d.ts +4 -4
- package/dist/src/slide-components/arrow.d.ts.map +1 -1
- package/dist/src/slide-components/cross-fade-transition.d.ts +2 -1
- package/dist/src/slide-components/cross-fade-transition.d.ts.map +1 -1
- package/dist/src/slide-components/cross-fade-transition.js +2 -1
- package/dist/src/slide-components/cross-fade-transition.js.map +1 -1
- package/dist/src/slide-components/duration-agnostic.d.ts +3 -2
- package/dist/src/slide-components/duration-agnostic.d.ts.map +1 -1
- package/dist/src/slide-components/duration-agnostic.js +4 -2
- package/dist/src/slide-components/duration-agnostic.js.map +1 -1
- package/dist/src/slide-components/fixed-duration.d.ts +3 -1
- package/dist/src/slide-components/fixed-duration.d.ts.map +1 -1
- package/dist/src/slide-components/fixed-duration.js +4 -2
- package/dist/src/slide-components/fixed-duration.js.map +1 -1
- package/dist/src/slide-components/fourier.d.ts +19 -12
- package/dist/src/slide-components/fourier.d.ts.map +1 -1
- package/dist/src/slide-components/fourier.js +77 -16
- package/dist/src/slide-components/fourier.js.map +1 -1
- package/dist/src/slide-components/function-graph.d.ts +4 -3
- package/dist/src/slide-components/function-graph.d.ts.map +1 -1
- package/dist/src/slide-components/function-graph.js +6 -2
- package/dist/src/slide-components/function-graph.js.map +1 -1
- package/dist/src/slide-components/halftone-shadow.d.ts +8 -7
- package/dist/src/slide-components/halftone-shadow.d.ts.map +1 -1
- package/dist/src/slide-components/halftone-shadow.js +14 -10
- package/dist/src/slide-components/halftone-shadow.js.map +1 -1
- package/dist/src/slide-components/handwriting-effect.d.ts +8 -6
- package/dist/src/slide-components/handwriting-effect.d.ts.map +1 -1
- package/dist/src/slide-components/handwriting-effect.js +4 -2
- package/dist/src/slide-components/handwriting-effect.js.map +1 -1
- package/dist/src/slide-components/hold.d.ts +4 -2
- package/dist/src/slide-components/hold.d.ts.map +1 -1
- package/dist/src/slide-components/hold.js +4 -2
- package/dist/src/slide-components/hold.js.map +1 -1
- package/dist/src/slide-components/image.d.ts +7 -7
- package/dist/src/slide-components/image.d.ts.map +1 -1
- package/dist/src/slide-components/image.js +4 -2
- package/dist/src/slide-components/image.js.map +1 -1
- package/dist/src/slide-components/in-parallel.d.ts +6 -3
- package/dist/src/slide-components/in-parallel.d.ts.map +1 -1
- package/dist/src/slide-components/in-parallel.js +12 -2
- package/dist/src/slide-components/in-parallel.js.map +1 -1
- package/dist/src/slide-components/in-series.d.ts +2 -1
- package/dist/src/slide-components/in-series.d.ts.map +1 -1
- package/dist/src/slide-components/in-series.js +2 -1
- package/dist/src/slide-components/in-series.js.map +1 -1
- package/dist/src/slide-components/live-duration.d.ts +3 -1
- package/dist/src/slide-components/live-duration.d.ts.map +1 -1
- package/dist/src/slide-components/live-duration.js +4 -2
- package/dist/src/slide-components/live-duration.js.map +1 -1
- package/dist/src/slide-components/multi-text.d.ts +39 -26
- package/dist/src/slide-components/multi-text.d.ts.map +1 -1
- package/dist/src/slide-components/multi-text.js +44 -29
- package/dist/src/slide-components/multi-text.js.map +1 -1
- package/dist/src/slide-components/rectangle.d.ts +5 -4
- package/dist/src/slide-components/rectangle.d.ts.map +1 -1
- package/dist/src/slide-components/rectangle.js +2 -1
- package/dist/src/slide-components/rectangle.js.map +1 -1
- package/dist/src/slide-components/registry.d.ts +5 -0
- package/dist/src/slide-components/registry.d.ts.map +1 -1
- package/dist/src/slide-components/registry.js +28 -27
- package/dist/src/slide-components/registry.js.map +1 -1
- package/dist/src/slide-components/show-error.d.ts.map +1 -1
- package/dist/src/slide-components/show-error.js +12 -4
- package/dist/src/slide-components/show-error.js.map +1 -1
- package/dist/src/slide-components/simple-text.d.ts +11 -10
- package/dist/src/slide-components/simple-text.d.ts.map +1 -1
- package/dist/src/slide-components/simple-text.js +5 -3
- package/dist/src/slide-components/simple-text.js.map +1 -1
- package/dist/src/slide-components/slide-component.d.ts +14 -13
- package/dist/src/slide-components/slide-component.d.ts.map +1 -1
- package/dist/src/slide-components/slide-component.js +2 -1
- package/dist/src/slide-components/slide-component.js.map +1 -1
- package/dist/src/slide-components/slide-left.d.ts +2 -1
- package/dist/src/slide-components/slide-left.d.ts.map +1 -1
- package/dist/src/slide-components/slide-left.js +2 -1
- package/dist/src/slide-components/slide-left.js.map +1 -1
- package/dist/src/slide-components/text-effect.d.ts +9 -1
- package/dist/src/slide-components/text-effect.d.ts.map +1 -1
- package/dist/src/slide-components/text-effect.js.map +1 -1
- package/dist/src/slide-components/traditional-text.d.ts +8 -8
- package/dist/src/slide-components/traditional-text.d.ts.map +1 -1
- package/dist/src/slide-components/video-clip.d.ts +4 -3
- package/dist/src/slide-components/video-clip.d.ts.map +1 -1
- package/dist/src/slide-components/video-clip.js +2 -1
- package/dist/src/slide-components/video-clip.js.map +1 -1
- package/lib/index.ts +1 -0
- package/package.json +2 -2
- package/src/glib/line-font.ts +9 -0
- package/src/glib/path-shape.ts +101 -245
- package/src/glib/svg-arc.ts +141 -0
- package/src/glib/svg-path-parser.ts +308 -0
- package/src/glib/transforms.ts +7 -4
- package/src/interpolate.ts +18 -27
- package/src/morph-animation.ts +1 -1
- package/src/peano-fourier/fourier-shared.ts +4 -2
- package/src/schedule-helper.ts +50 -28
- package/src/showable.ts +79 -10
- package/src/slide-components/arrow.ts +4 -4
- package/src/slide-components/cross-fade-transition.ts +9 -2
- package/src/slide-components/duration-agnostic.ts +4 -3
- package/src/slide-components/fixed-duration.ts +4 -2
- package/src/slide-components/fourier.ts +98 -29
- package/src/slide-components/function-graph.ts +7 -3
- package/src/slide-components/halftone-shadow.ts +21 -16
- package/src/slide-components/handwriting-effect.ts +8 -6
- package/src/slide-components/hold.ts +18 -4
- package/src/slide-components/image.ts +9 -7
- package/src/slide-components/in-parallel.ts +16 -1
- package/src/slide-components/in-series.ts +3 -1
- package/src/slide-components/live-duration.ts +4 -2
- package/src/slide-components/multi-text.ts +71 -44
- package/src/slide-components/rectangle.ts +6 -4
- package/src/slide-components/registry.ts +33 -27
- package/src/slide-components/show-error.ts +13 -4
- package/src/slide-components/simple-text.ts +22 -12
- package/src/slide-components/slide-component.ts +15 -13
- package/src/slide-components/slide-left.ts +9 -2
- package/src/slide-components/text-effect.ts +9 -0
- package/src/slide-components/traditional-text.ts +8 -8
- package/src/slide-components/video-clip.ts +5 -3
|
@@ -3,7 +3,11 @@
|
|
|
3
3
|
import { Point } from "bezier-js";
|
|
4
4
|
import { ReadOnlyRect } from "phil-lib/misc";
|
|
5
5
|
import { Font } from "../glib/letters-base.ts";
|
|
6
|
-
import {
|
|
6
|
+
import {
|
|
7
|
+
MIN_BOLDNESS,
|
|
8
|
+
MIN_FONT_SIZE,
|
|
9
|
+
MIN_FONT_WIDTH,
|
|
10
|
+
} from "../glib/line-font.ts";
|
|
7
11
|
import {
|
|
8
12
|
checkCharacters,
|
|
9
13
|
FONT_NAMES,
|
|
@@ -26,6 +30,7 @@ import {
|
|
|
26
30
|
ColorScheduleInfo,
|
|
27
31
|
} from "../schedule-helper.ts";
|
|
28
32
|
import {
|
|
33
|
+
ComponentOptions,
|
|
29
34
|
ShowOptions,
|
|
30
35
|
Showable,
|
|
31
36
|
ShowableParent,
|
|
@@ -33,7 +38,6 @@ import {
|
|
|
33
38
|
Scalar,
|
|
34
39
|
} from "../showable.ts";
|
|
35
40
|
import { DurationAgnosticComponent } from "./duration-agnostic.ts";
|
|
36
|
-
import { ShowChildInfo } from "./in-parallel.ts";
|
|
37
41
|
import { showError } from "./show-error.ts";
|
|
38
42
|
import {
|
|
39
43
|
EffectLetter,
|
|
@@ -41,14 +45,15 @@ import {
|
|
|
41
45
|
TextEffect,
|
|
42
46
|
TEXT_EFFECT,
|
|
43
47
|
} from "./text-effect.ts";
|
|
44
|
-
import {
|
|
48
|
+
import { TimedKeyframe } from "../interpolate.ts";
|
|
45
49
|
// Type-only: registry.ts imports this module, so a runtime import would be circular.
|
|
46
50
|
import type { ComponentRegistryEntry } from "./registry.ts";
|
|
47
51
|
|
|
48
52
|
/**
|
|
49
53
|
* This is needed as a default in some places but should never actually be used.
|
|
50
54
|
*/
|
|
51
|
-
|
|
55
|
+
/** Made the first time it's needed, so this module loads without a browser. */
|
|
56
|
+
let baseFont: Font | undefined;
|
|
52
57
|
|
|
53
58
|
const TEXT_FORMAT_LIST = Symbol("Text Format List");
|
|
54
59
|
function getFormat(
|
|
@@ -309,7 +314,7 @@ const ANCHOR_FRACTION = {
|
|
|
309
314
|
* This includes Multi Text Components that are wrapped in other components.
|
|
310
315
|
*/
|
|
311
316
|
export class MultiTextComponent extends DurationAgnosticComponent {
|
|
312
|
-
readonly registryKey
|
|
317
|
+
readonly registryKey: string;
|
|
313
318
|
/**
|
|
314
319
|
* Text Span and Text Format are what a Multi Text is made of, so offer them first.
|
|
315
320
|
* Text Format and the text effects only work as direct children of a Multi Text, so
|
|
@@ -616,6 +621,13 @@ export class MultiTextComponent extends DurationAgnosticComponent {
|
|
|
616
621
|
description: "Rotation",
|
|
617
622
|
type: "select",
|
|
618
623
|
choices: ROTATIONS,
|
|
624
|
+
// Which way the text reads. Saved as the names in ROTATIONS.
|
|
625
|
+
choiceLabels: {
|
|
626
|
+
none: "→",
|
|
627
|
+
"90° clockwise": "↓",
|
|
628
|
+
"180°": "←",
|
|
629
|
+
"90° counterclockwise": "↑",
|
|
630
|
+
} satisfies Record<(typeof ROTATIONS)[number], string>,
|
|
619
631
|
value: "none",
|
|
620
632
|
};
|
|
621
633
|
/** See {@link WIDTH_MODES}. */
|
|
@@ -682,15 +694,16 @@ export class MultiTextComponent extends DurationAgnosticComponent {
|
|
|
682
694
|
constructor(
|
|
683
695
|
initialValues: {
|
|
684
696
|
description?: string;
|
|
685
|
-
|
|
697
|
+
registryKey?: string;
|
|
698
|
+
position?: Point | readonly TimedKeyframe<Point>[];
|
|
686
699
|
alignment?: Parameters<MultiTextComponent["alignmentSchedule"]["set"]>[0];
|
|
687
700
|
anchorX?: Parameters<MultiTextComponent["anchorXSchedule"]["set"]>[0];
|
|
688
701
|
textBaseline?: Parameters<
|
|
689
702
|
MultiTextComponent["textBaselineSchedule"]["set"]
|
|
690
703
|
>[0];
|
|
691
|
-
width?: number | readonly
|
|
692
|
-
height?: number | readonly
|
|
693
|
-
additionalLineHeight?: number | readonly
|
|
704
|
+
width?: number | readonly TimedKeyframe<number>[];
|
|
705
|
+
height?: number | readonly TimedKeyframe<number>[];
|
|
706
|
+
additionalLineHeight?: number | readonly TimedKeyframe<number>[];
|
|
694
707
|
widthMode?: (typeof WIDTH_MODES)[number];
|
|
695
708
|
heightMode?: (typeof HEIGHT_MODES)[number];
|
|
696
709
|
mayGrow?: "shrink or grow" | "shrink only";
|
|
@@ -700,6 +713,7 @@ export class MultiTextComponent extends DurationAgnosticComponent {
|
|
|
700
713
|
} = {},
|
|
701
714
|
) {
|
|
702
715
|
super(initialValues.description ?? "Multi Text");
|
|
716
|
+
this.registryKey = initialValues.registryKey ?? "Multi Text";
|
|
703
717
|
this.schedules.push(
|
|
704
718
|
this.positionSchedule,
|
|
705
719
|
this.alignmentSchedule,
|
|
@@ -744,20 +758,6 @@ export class MultiTextComponent extends DurationAgnosticComponent {
|
|
|
744
758
|
if (initialValues.rotation !== undefined)
|
|
745
759
|
this.rotationScalar.value = initialValues.rotation;
|
|
746
760
|
}
|
|
747
|
-
protected override showChild(info: ShowChildInfo): void {
|
|
748
|
-
// We are not currently using this method.
|
|
749
|
-
console.warn("yes!");
|
|
750
|
-
if (info.child instanceof TextSpanComponent) {
|
|
751
|
-
// TODO we should display the result of each TextSpanComponent in this call.
|
|
752
|
-
// That way we can completely control the zIndex.
|
|
753
|
-
// For now the text is all displayed at the highest zIndex.
|
|
754
|
-
} else if (info.child instanceof TextFormatComponent) {
|
|
755
|
-
// Nothing to do.
|
|
756
|
-
// This is not a visible component.
|
|
757
|
-
} else {
|
|
758
|
-
super.showChild(info);
|
|
759
|
-
}
|
|
760
|
-
}
|
|
761
761
|
/**
|
|
762
762
|
* Our own {@link TextFormatComponent} children.
|
|
763
763
|
* These name the styles that our {@link TextSpanComponent} children can ask for.
|
|
@@ -808,7 +808,7 @@ export class MultiTextComponent extends DurationAgnosticComponent {
|
|
|
808
808
|
const { context, timeInMs } = options;
|
|
809
809
|
const spanIndexOf = new Map<WordInPlace["wordInfo"], number>();
|
|
810
810
|
const allFormatters = extractTextFormatList(options, this.#ownFormatters());
|
|
811
|
-
const paragraphLayout = new ParagraphLayout(baseFont);
|
|
811
|
+
const paragraphLayout = new ParagraphLayout((baseFont ??= Font.cursive(1)));
|
|
812
812
|
const initializedFormatters = new Map<
|
|
813
813
|
string,
|
|
814
814
|
ReturnType<TextFormatComponent["freeze"]> | undefined
|
|
@@ -1156,18 +1156,27 @@ export class MultiTextComponent extends DurationAgnosticComponent {
|
|
|
1156
1156
|
const { context } = options;
|
|
1157
1157
|
// Children that are neither spans nor formats draw normally, before the
|
|
1158
1158
|
// text, and they can see our formatters.
|
|
1159
|
+
// TODO: draw the text in its children's place, so zIndex works. For now
|
|
1160
|
+
// it's always drawn last, above everything else.
|
|
1159
1161
|
const childOptions = setTextFormatList(
|
|
1160
1162
|
options,
|
|
1161
1163
|
extractTextFormatList(options, this.#ownFormatters()),
|
|
1162
1164
|
);
|
|
1163
1165
|
const effects: TextEffect[] = [];
|
|
1164
1166
|
this.children.forEach(({ child }) => {
|
|
1167
|
+
if (
|
|
1168
|
+
child instanceof TextSpanComponent ||
|
|
1169
|
+
child instanceof TextFormatComponent
|
|
1170
|
+
) {
|
|
1171
|
+
return;
|
|
1172
|
+
}
|
|
1173
|
+
// These work in our coordinates, which are our parent's. So the editor
|
|
1174
|
+
// draws their markers (an effect's Center, say) in the right place,
|
|
1175
|
+
// even inside a moved or scaled Slide.
|
|
1176
|
+
options.registerTransform?.(child, context.getTransform());
|
|
1165
1177
|
if (isTextEffect(child)) {
|
|
1166
1178
|
effects.push(child);
|
|
1167
|
-
} else
|
|
1168
|
-
!(child instanceof TextSpanComponent) &&
|
|
1169
|
-
!(child instanceof TextFormatComponent)
|
|
1170
|
-
) {
|
|
1179
|
+
} else {
|
|
1171
1180
|
child.show(childOptions);
|
|
1172
1181
|
}
|
|
1173
1182
|
});
|
|
@@ -1181,6 +1190,7 @@ export class MultiTextComponent extends DurationAgnosticComponent {
|
|
|
1181
1190
|
? effects[0][TEXT_EFFECT](
|
|
1182
1191
|
MultiTextComponent.effectLetters(placed),
|
|
1183
1192
|
options,
|
|
1193
|
+
placed,
|
|
1184
1194
|
)
|
|
1185
1195
|
: laidOut.pathShapeByTag();
|
|
1186
1196
|
// The scale goes on the context rather than the path, so the stroke width
|
|
@@ -1214,19 +1224,24 @@ export class MultiTextComponent extends DurationAgnosticComponent {
|
|
|
1214
1224
|
// MARK: Text Span
|
|
1215
1225
|
|
|
1216
1226
|
export class TextSpanComponent implements Showable {
|
|
1217
|
-
readonly registryKey
|
|
1227
|
+
readonly registryKey: string;
|
|
1218
1228
|
public contentSchedule = new StringScheduleInfo("Content", "");
|
|
1219
1229
|
// TODO do not allow easing in styleSchedule.
|
|
1220
|
-
|
|
1230
|
+
/** Saved as "Style". Shown as "Style Name", the same as the Text Format's. */
|
|
1231
|
+
public styleSchedule = Object.assign(new StringScheduleInfo("Style", ""), {
|
|
1232
|
+
label: "Style Name",
|
|
1233
|
+
});
|
|
1221
1234
|
readonly schedules = [this.contentSchedule, this.styleSchedule] as const;
|
|
1222
|
-
readonly description
|
|
1235
|
+
readonly description: string;
|
|
1223
1236
|
readonly duration = 0;
|
|
1224
1237
|
constructor(
|
|
1225
1238
|
initialValues: {
|
|
1226
|
-
content?: string | readonly
|
|
1227
|
-
style?: string | readonly
|
|
1228
|
-
} = {},
|
|
1239
|
+
content?: string | readonly TimedKeyframe<string>[];
|
|
1240
|
+
style?: string | readonly TimedKeyframe<string>[];
|
|
1241
|
+
} & ComponentOptions = {},
|
|
1229
1242
|
) {
|
|
1243
|
+
this.description = initialValues.description ?? "Text Span";
|
|
1244
|
+
this.registryKey = initialValues.registryKey ?? "Text Span";
|
|
1230
1245
|
if (initialValues.content !== undefined)
|
|
1231
1246
|
this.contentSchedule.set(initialValues.content);
|
|
1232
1247
|
if (initialValues.style !== undefined)
|
|
@@ -1258,8 +1273,14 @@ type CachedFont = {
|
|
|
1258
1273
|
};
|
|
1259
1274
|
|
|
1260
1275
|
export class TextFormatComponent implements Showable {
|
|
1261
|
-
readonly registryKey
|
|
1262
|
-
|
|
1276
|
+
readonly registryKey: string;
|
|
1277
|
+
/**
|
|
1278
|
+
* The name Text Spans use to pick this format. Saved as "Name", and shown as "Style Name",
|
|
1279
|
+
* so it isn't confused with the component's own Name.
|
|
1280
|
+
*/
|
|
1281
|
+
readonly nameScalar = Object.assign(new StringScalarInfo("Name", ""), {
|
|
1282
|
+
label: "Style Name",
|
|
1283
|
+
});
|
|
1263
1284
|
readonly scalars = [this.nameScalar] as const;
|
|
1264
1285
|
readonly colorSchedule: ColorScheduleInfo;
|
|
1265
1286
|
/**
|
|
@@ -1286,16 +1307,18 @@ export class TextFormatComponent implements Showable {
|
|
|
1286
1307
|
constructor(
|
|
1287
1308
|
initialValues: {
|
|
1288
1309
|
description?: string;
|
|
1310
|
+
registryKey?: string;
|
|
1289
1311
|
name?: string;
|
|
1290
|
-
color?: string | readonly
|
|
1291
|
-
font?: FontName | readonly
|
|
1292
|
-
size?: number | readonly
|
|
1293
|
-
fontWidth?: number | readonly
|
|
1294
|
-
boldness?: number | readonly
|
|
1295
|
-
obliqueness?: number | readonly
|
|
1296
|
-
alpha?: number | readonly
|
|
1312
|
+
color?: string | readonly TimedKeyframe<string>[] | ColorScheduleInfo;
|
|
1313
|
+
font?: FontName | readonly TimedKeyframe<FontName>[];
|
|
1314
|
+
size?: number | readonly TimedKeyframe<number>[];
|
|
1315
|
+
fontWidth?: number | readonly TimedKeyframe<number>[];
|
|
1316
|
+
boldness?: number | readonly TimedKeyframe<number>[];
|
|
1317
|
+
obliqueness?: number | readonly TimedKeyframe<number>[];
|
|
1318
|
+
alpha?: number | readonly TimedKeyframe<number>[];
|
|
1297
1319
|
} = {},
|
|
1298
1320
|
) {
|
|
1321
|
+
this.registryKey = initialValues.registryKey ?? "Text Format";
|
|
1299
1322
|
this.description = initialValues.description ?? "Text Format";
|
|
1300
1323
|
if (initialValues.name !== undefined)
|
|
1301
1324
|
this.nameScalar.value = initialValues.name;
|
|
@@ -1352,7 +1375,11 @@ export class TextFormatComponent implements Showable {
|
|
|
1352
1375
|
MIN_FONT_WIDTH,
|
|
1353
1376
|
this.fontWidthSchedule.at(timeInMs) || 0,
|
|
1354
1377
|
);
|
|
1355
|
-
|
|
1378
|
+
// 0 or less would hang the font builder. As thin as it goes is the closest thing.
|
|
1379
|
+
const boldness = Math.max(
|
|
1380
|
+
MIN_BOLDNESS,
|
|
1381
|
+
this.boldnessSchedule.at(timeInMs) || 0,
|
|
1382
|
+
);
|
|
1356
1383
|
const obliqueness = this.obliquenessSchedule.at(timeInMs);
|
|
1357
1384
|
const alpha = this.alphaSchedule.at(timeInMs);
|
|
1358
1385
|
if (
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Showable, ShowOptions } from "../showable.ts";
|
|
2
|
-
import {
|
|
2
|
+
import { TimedKeyframe } from "../interpolate.ts";
|
|
3
3
|
import { ReadOnlyRect } from "phil-lib/misc";
|
|
4
4
|
import {
|
|
5
5
|
ColorScheduleInfo,
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
* position/size schedule.
|
|
12
12
|
*/
|
|
13
13
|
export class RectangleComponent implements Showable {
|
|
14
|
-
readonly registryKey
|
|
14
|
+
readonly registryKey: string;
|
|
15
15
|
readonly colorSchedule = new ColorScheduleInfo("Color", "cyan");
|
|
16
16
|
readonly rectSchedule = new RectangleScheduleInfo("Rect", {
|
|
17
17
|
x: 2,
|
|
@@ -25,10 +25,12 @@ export class RectangleComponent implements Showable {
|
|
|
25
25
|
constructor(
|
|
26
26
|
initialValues: {
|
|
27
27
|
description?: string;
|
|
28
|
-
|
|
29
|
-
|
|
28
|
+
registryKey?: string;
|
|
29
|
+
color?: string | readonly TimedKeyframe<string>[];
|
|
30
|
+
rect?: ReadOnlyRect | readonly TimedKeyframe<ReadOnlyRect>[];
|
|
30
31
|
} = {},
|
|
31
32
|
) {
|
|
33
|
+
this.registryKey = initialValues.registryKey ?? "Rectangle";
|
|
32
34
|
this.description = initialValues.description ?? "Rectangle";
|
|
33
35
|
if (initialValues.color !== undefined)
|
|
34
36
|
this.colorSchedule.set(initialValues.color);
|
|
@@ -33,6 +33,11 @@ export type ComponentRegistryEntry = {
|
|
|
33
33
|
* English text that can be displayed when the user selects this item.
|
|
34
34
|
*/
|
|
35
35
|
description?: string;
|
|
36
|
+
/**
|
|
37
|
+
* The name the Visual Editor shows for this kind of component, if not its key. The key is
|
|
38
|
+
* what save files store, so it (almost) never changes. This can.
|
|
39
|
+
*/
|
|
40
|
+
label?: string;
|
|
36
41
|
/**
|
|
37
42
|
* Offer this in the Visual Editor's "Wrap Component" dialog.
|
|
38
43
|
*
|
|
@@ -361,34 +366,35 @@ export const componentRegistry = new Map<string, ComponentRegistryEntry>([
|
|
|
361
366
|
],
|
|
362
367
|
]);
|
|
363
368
|
|
|
369
|
+
/**
|
|
370
|
+
* A check that runs at compile time, never at run time. The code generator behind Save Diffs
|
|
371
|
+
* writes `new X({ description: … })` for every class with `howToGenerate`, so each one has to
|
|
372
|
+
* take its name, and its registry key, in its options. A class added to the registry with
|
|
373
|
+
* `howToGenerate` belongs on this list. See `ComponentOptions` in showable.ts.
|
|
374
|
+
*/
|
|
364
375
|
if (false) {
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
new
|
|
372
|
-
new
|
|
373
|
-
new
|
|
374
|
-
new
|
|
375
|
-
new
|
|
376
|
-
new
|
|
377
|
-
new
|
|
378
|
-
new
|
|
379
|
-
new
|
|
380
|
-
new
|
|
381
|
-
new
|
|
382
|
-
new
|
|
383
|
-
|
|
384
|
-
new
|
|
385
|
-
|
|
386
|
-
new
|
|
387
|
-
new MultiTextComponent({ description: "test" });
|
|
388
|
-
// @ts-expect-error: TODO make this work.
|
|
389
|
-
new TextSpanComponent({ description: "test" });
|
|
390
|
-
new TextFormatComponent({ description: "test" });
|
|
391
|
-
new HalftoneShadowComponent({ description: "test" });
|
|
376
|
+
const options = { description: "test", registryKey: "test" };
|
|
377
|
+
new PaddingComponent(options);
|
|
378
|
+
new FrameCounter(options);
|
|
379
|
+
new InSeriesComponent(options);
|
|
380
|
+
new SlideLeftTransition(options);
|
|
381
|
+
new CrossFadeTransition(options);
|
|
382
|
+
new HoldPreviousTransition(options);
|
|
383
|
+
new HoldNextTransition(options);
|
|
384
|
+
new SlideComponent(options);
|
|
385
|
+
new TextComponent(options);
|
|
386
|
+
new TraditionalTextComponent(options);
|
|
387
|
+
new RectangleComponent(options);
|
|
388
|
+
new ArrowComponent(options);
|
|
389
|
+
new FunctionGraphComponent(options);
|
|
390
|
+
new SingleImageComponent(options);
|
|
391
|
+
new VideoClipComponent(options);
|
|
392
|
+
new MultiTextComponent(options);
|
|
393
|
+
new TextSpanComponent(options);
|
|
394
|
+
new TextFormatComponent(options);
|
|
395
|
+
new HandwritingEffectComponent(options);
|
|
396
|
+
new FourierComponent(options);
|
|
397
|
+
new HalftoneShadowComponent(options);
|
|
392
398
|
}
|
|
393
399
|
|
|
394
400
|
/**
|
|
@@ -1,7 +1,10 @@
|
|
|
1
|
+
import { canvasRecorder } from "../../lib/main-control.ts";
|
|
2
|
+
import type { Font } from "../glib/letters-base.ts";
|
|
1
3
|
import { makeLineFont } from "../glib/line-font.ts";
|
|
2
4
|
import { ParagraphLayout } from "../glib/paragraph-layout.ts";
|
|
3
5
|
|
|
4
|
-
|
|
6
|
+
/** Made the first time it's needed, so this module loads without a browser. */
|
|
7
|
+
let errorFont: Font | undefined;
|
|
5
8
|
|
|
6
9
|
/**
|
|
7
10
|
* Write text on the screen where it is big and easy to see, even without knowing what else is there.
|
|
@@ -10,13 +13,19 @@ const errorFont = makeLineFont(1);
|
|
|
10
13
|
* Can include " " and "\n" for optional and forced line breaks.
|
|
11
14
|
*/
|
|
12
15
|
export function showError(context: CanvasRenderingContext2D, text: string) {
|
|
13
|
-
const font = errorFont;
|
|
16
|
+
const font = (errorFont ??= makeLineFont(1));
|
|
17
|
+
/** Space on the left and right. */
|
|
18
|
+
const margin = 0.25;
|
|
19
|
+
// Read the width every time: it can change at any time.
|
|
20
|
+
const width = Math.max(1, canvasRecorder.width - 2 * margin);
|
|
14
21
|
const path = ParagraphLayout.singlePathShape({
|
|
15
22
|
font,
|
|
16
23
|
text,
|
|
17
24
|
alignment: "center",
|
|
18
|
-
width
|
|
19
|
-
})
|
|
25
|
+
width,
|
|
26
|
+
})
|
|
27
|
+
// Center on the canvas, not on the paragraph.
|
|
28
|
+
.translate((canvasRecorder.width - width) / 2, 0).canvasPath;
|
|
20
29
|
context.lineCap = "round";
|
|
21
30
|
context.lineJoin = "round";
|
|
22
31
|
context.lineWidth = font.strokeWidth * 3;
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import { ReadOnlyRect } from "phil-lib/misc";
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
MIN_BOLDNESS,
|
|
4
|
+
MIN_FONT_SIZE,
|
|
5
|
+
MIN_FONT_WIDTH,
|
|
6
|
+
} from "../glib/line-font.ts";
|
|
3
7
|
import {
|
|
4
8
|
checkCharacters,
|
|
5
9
|
FONT_NAMES,
|
|
@@ -17,7 +21,7 @@ import {
|
|
|
17
21
|
} from "../schedule-helper.ts";
|
|
18
22
|
import { ShowOptions } from "../showable.ts";
|
|
19
23
|
import { DurationAgnosticComponent } from "./duration-agnostic.ts";
|
|
20
|
-
import {
|
|
24
|
+
import { TimedKeyframe } from "../interpolate.ts";
|
|
21
25
|
import { Font } from "../glib/letters-base.ts";
|
|
22
26
|
|
|
23
27
|
type CachedFont = {
|
|
@@ -30,7 +34,7 @@ type CachedFont = {
|
|
|
30
34
|
};
|
|
31
35
|
|
|
32
36
|
export class TextComponent extends DurationAgnosticComponent {
|
|
33
|
-
readonly registryKey
|
|
37
|
+
readonly registryKey: string;
|
|
34
38
|
readonly colorSchedule = new ColorScheduleInfo("Color", "#888");
|
|
35
39
|
readonly rectSchedule = new RectangleScheduleInfo("Rect", {
|
|
36
40
|
x: 2,
|
|
@@ -66,15 +70,16 @@ export class TextComponent extends DurationAgnosticComponent {
|
|
|
66
70
|
constructor(
|
|
67
71
|
initialValues: {
|
|
68
72
|
description?: string;
|
|
73
|
+
registryKey?: string;
|
|
69
74
|
minDuration?: number;
|
|
70
|
-
color?: string | readonly
|
|
71
|
-
rect?: ReadOnlyRect | readonly
|
|
72
|
-
text?: string | readonly
|
|
73
|
-
font?: FontName | readonly
|
|
74
|
-
size?: number | readonly
|
|
75
|
-
fontWidth?: number | readonly
|
|
76
|
-
boldness?: number | readonly
|
|
77
|
-
obliqueness?: number | readonly
|
|
75
|
+
color?: string | readonly TimedKeyframe<string>[];
|
|
76
|
+
rect?: ReadOnlyRect | readonly TimedKeyframe<ReadOnlyRect>[];
|
|
77
|
+
text?: string | readonly TimedKeyframe<string>[];
|
|
78
|
+
font?: FontName | readonly TimedKeyframe<FontName>[];
|
|
79
|
+
size?: number | readonly TimedKeyframe<number>[];
|
|
80
|
+
fontWidth?: number | readonly TimedKeyframe<number>[];
|
|
81
|
+
boldness?: number | readonly TimedKeyframe<number>[];
|
|
82
|
+
obliqueness?: number | readonly TimedKeyframe<number>[];
|
|
78
83
|
// I have mixed feelings on the complicated type definition.
|
|
79
84
|
// It is exactly what it needs to be, and it avoids any duplicated code or namespace pollution.
|
|
80
85
|
// But it is long and complicated.
|
|
@@ -86,6 +91,7 @@ export class TextComponent extends DurationAgnosticComponent {
|
|
|
86
91
|
} = {},
|
|
87
92
|
) {
|
|
88
93
|
super(initialValues.description ?? "Text");
|
|
94
|
+
this.registryKey = initialValues.registryKey ?? "Text";
|
|
89
95
|
if (initialValues.minDuration !== undefined) {
|
|
90
96
|
this.minDurationScalar.value = initialValues.minDuration;
|
|
91
97
|
}
|
|
@@ -169,7 +175,11 @@ export class TextComponent extends DurationAgnosticComponent {
|
|
|
169
175
|
MIN_FONT_WIDTH,
|
|
170
176
|
this.fontWidthSchedule.at(timeInMs) || 0,
|
|
171
177
|
);
|
|
172
|
-
|
|
178
|
+
// 0 or less would hang the font builder. As thin as it goes is the closest thing.
|
|
179
|
+
const boldness = Math.max(
|
|
180
|
+
MIN_BOLDNESS,
|
|
181
|
+
this.boldnessSchedule.at(timeInMs) || 0,
|
|
182
|
+
);
|
|
173
183
|
const obliqueness = this.obliquenessSchedule.at(timeInMs);
|
|
174
184
|
const alignment = this.alignmentSchedule.at(timeInMs);
|
|
175
185
|
context.strokeStyle = color;
|
|
@@ -4,7 +4,7 @@ import { ShowOptions } from "../showable.ts";
|
|
|
4
4
|
import { DurationAgnosticComponent } from "./duration-agnostic.ts";
|
|
5
5
|
import { ShowChildInfo } from "./in-parallel.ts";
|
|
6
6
|
import { showError } from "./show-error.ts";
|
|
7
|
-
import {
|
|
7
|
+
import { TimedKeyframe } from "../interpolate.ts";
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* Mathematical Bold Script capital letters A–J, used as placeholders in
|
|
@@ -38,7 +38,7 @@ export const TRANSFORM_PLACEHOLDERS = [
|
|
|
38
38
|
* Exported so dev/canvas-recorder.ts can use instanceof for the custom panel.
|
|
39
39
|
*/
|
|
40
40
|
export class SlideComponent extends DurationAgnosticComponent {
|
|
41
|
-
readonly registryKey
|
|
41
|
+
readonly registryKey: string;
|
|
42
42
|
readonly transformTemplate = new StringScalarInfo(
|
|
43
43
|
"Transform Template",
|
|
44
44
|
"scale(1)",
|
|
@@ -68,21 +68,23 @@ export class SlideComponent extends DurationAgnosticComponent {
|
|
|
68
68
|
constructor(
|
|
69
69
|
initialValues: {
|
|
70
70
|
description?: string;
|
|
71
|
+
registryKey?: string;
|
|
71
72
|
transformTemplate?: string;
|
|
72
|
-
alpha?: number | readonly
|
|
73
|
-
placeA?: number | readonly
|
|
74
|
-
placeB?: number | readonly
|
|
75
|
-
placeC?: number | readonly
|
|
76
|
-
placeD?: number | readonly
|
|
77
|
-
placeE?: number | readonly
|
|
78
|
-
placeF?: number | readonly
|
|
79
|
-
placeG?: number | readonly
|
|
80
|
-
placeH?: number | readonly
|
|
81
|
-
placeI?: number | readonly
|
|
82
|
-
placeJ?: number | readonly
|
|
73
|
+
alpha?: number | readonly TimedKeyframe<number>[];
|
|
74
|
+
placeA?: number | readonly TimedKeyframe<number>[];
|
|
75
|
+
placeB?: number | readonly TimedKeyframe<number>[];
|
|
76
|
+
placeC?: number | readonly TimedKeyframe<number>[];
|
|
77
|
+
placeD?: number | readonly TimedKeyframe<number>[];
|
|
78
|
+
placeE?: number | readonly TimedKeyframe<number>[];
|
|
79
|
+
placeF?: number | readonly TimedKeyframe<number>[];
|
|
80
|
+
placeG?: number | readonly TimedKeyframe<number>[];
|
|
81
|
+
placeH?: number | readonly TimedKeyframe<number>[];
|
|
82
|
+
placeI?: number | readonly TimedKeyframe<number>[];
|
|
83
|
+
placeJ?: number | readonly TimedKeyframe<number>[];
|
|
83
84
|
} = {},
|
|
84
85
|
) {
|
|
85
86
|
super(initialValues.description ?? "Slide");
|
|
87
|
+
this.registryKey = initialValues.registryKey ?? "Slide";
|
|
86
88
|
this.scalars.push(this.transformTemplate);
|
|
87
89
|
if (initialValues.transformTemplate !== undefined)
|
|
88
90
|
this.transformTemplate.value = initialValues.transformTemplate;
|
|
@@ -12,10 +12,17 @@ export class SlideLeftTransition
|
|
|
12
12
|
extends ComponentWithLiveDuration
|
|
13
13
|
implements Transition
|
|
14
14
|
{
|
|
15
|
-
constructor(
|
|
15
|
+
constructor(
|
|
16
|
+
options: {
|
|
17
|
+
description?: string;
|
|
18
|
+
registryKey?: string;
|
|
19
|
+
duration?: number;
|
|
20
|
+
} = {},
|
|
21
|
+
) {
|
|
16
22
|
super(options.description ?? "Slide Left", options.duration ?? 1000);
|
|
23
|
+
this.registryKey = options.registryKey ?? "Slide Left Transition";
|
|
17
24
|
}
|
|
18
|
-
readonly registryKey
|
|
25
|
+
readonly registryKey: string;
|
|
19
26
|
override show(options: ShowOptions): void {
|
|
20
27
|
// Thoughts about the future:
|
|
21
28
|
// For now I'm focused on using this in an InSeriesComponent.
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import { PathShape } from "../glib/path-shape.ts";
|
|
4
4
|
import { Showable, ShowOptions } from "../showable.ts";
|
|
5
|
+
import type { PlacedText } from "./multi-text.ts";
|
|
5
6
|
|
|
6
7
|
/**
|
|
7
8
|
* A {@link MultiTextComponent} child with this key changes how the text is
|
|
@@ -77,6 +78,13 @@ export type TextEffect = Showable & {
|
|
|
77
78
|
* @param letters Every letter, in reading order.
|
|
78
79
|
* @param options The Multi Text's own options, so `timeInMs` is the Multi
|
|
79
80
|
* Text's local time.
|
|
81
|
+
* @param placed Where the Multi Text put the paragraph: scale, offset, turn
|
|
82
|
+
* and pivot. The letters are in the paragraph's own coordinates, and an
|
|
83
|
+
* effect that wants to work in the Multi Text's coordinates, where Position
|
|
84
|
+
* and the Visual Editor's point markers live, needs this to convert. The
|
|
85
|
+
* paragraph point `p` is drawn at the Multi Text's point `turn(offset + scale
|
|
86
|
+
* * p)`, as {@link PlacedText} describes. Optional for the implementer: an
|
|
87
|
+
* effect that doesn't need it can leave the parameter out.
|
|
80
88
|
* @returns What to stroke, grouped by {@link EffectLetter.tag}. This
|
|
81
89
|
* replaces `laidOut.pathShapeByTag()`. Each path is stroked by its tag's
|
|
82
90
|
* format, in the order of this map, so later entries are drawn on top. Leave
|
|
@@ -85,6 +93,7 @@ export type TextEffect = Showable & {
|
|
|
85
93
|
[TEXT_EFFECT](
|
|
86
94
|
letters: readonly EffectLetter[],
|
|
87
95
|
options: ShowOptions,
|
|
96
|
+
placed: PlacedText,
|
|
88
97
|
): Map<unknown, PathShape>;
|
|
89
98
|
};
|
|
90
99
|
|
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
} from "../schedule-helper.ts";
|
|
10
10
|
import { ShowOptions } from "../showable.ts";
|
|
11
11
|
import { DurationAgnosticComponent } from "./duration-agnostic.ts";
|
|
12
|
-
import {
|
|
12
|
+
import { TimedKeyframe } from "../interpolate.ts";
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
15
|
* `document.fonts.check()`/`.load()` only know about `FontFace` objects that
|
|
@@ -214,17 +214,17 @@ export class TraditionalTextComponent extends DurationAgnosticComponent {
|
|
|
214
214
|
registryKey?: string;
|
|
215
215
|
description?: string;
|
|
216
216
|
minDuration?: number;
|
|
217
|
-
text?: string | readonly
|
|
217
|
+
text?: string | readonly TimedKeyframe<string>[];
|
|
218
218
|
position?: Point;
|
|
219
|
-
fillColor?: string | readonly
|
|
220
|
-
outlineColor?: string | readonly
|
|
221
|
-
outlineWidth?: number | readonly
|
|
222
|
-
fontSize?: number | readonly
|
|
219
|
+
fillColor?: string | readonly TimedKeyframe<string>[];
|
|
220
|
+
outlineColor?: string | readonly TimedKeyframe<string>[];
|
|
221
|
+
outlineWidth?: number | readonly TimedKeyframe<number>[];
|
|
222
|
+
fontSize?: number | readonly TimedKeyframe<number>[];
|
|
223
223
|
fontStyle?: Parameters<
|
|
224
224
|
TraditionalTextComponent["fontStyleSchedule"]["set"]
|
|
225
225
|
>[0];
|
|
226
|
-
fontWeight?: number | readonly
|
|
227
|
-
fontFamily?: string | readonly
|
|
226
|
+
fontWeight?: number | readonly TimedKeyframe<number>[];
|
|
227
|
+
fontFamily?: string | readonly TimedKeyframe<string>[];
|
|
228
228
|
textAlign?: Parameters<
|
|
229
229
|
TraditionalTextComponent["textAlignSchedule"]["set"]
|
|
230
230
|
>[0];
|
|
@@ -16,7 +16,7 @@ import { ReadOnlyRect } from "phil-lib/misc";
|
|
|
16
16
|
import { RectangleScheduleInfo } from "../schedule-helper.ts";
|
|
17
17
|
import { Scalar, ShowOptions, SoundClip } from "../showable.ts";
|
|
18
18
|
import { SlowImage } from "../slow-image-sources.ts";
|
|
19
|
-
import {
|
|
19
|
+
import { TimedKeyframe } from "../interpolate.ts";
|
|
20
20
|
import { debugLog } from "../debug-log.ts";
|
|
21
21
|
import { readVideoInfo, VideoInfo } from "./video-info.ts";
|
|
22
22
|
|
|
@@ -488,7 +488,7 @@ export class VideoClipComponent extends ComponentWithLiveDuration {
|
|
|
488
488
|
* clip in the series at once.
|
|
489
489
|
*/
|
|
490
490
|
static readonly GET_READY_MS = 5_000;
|
|
491
|
-
readonly registryKey
|
|
491
|
+
readonly registryKey: string;
|
|
492
492
|
readonly urlScalar: Scalar<"string"> = {
|
|
493
493
|
description: "URL",
|
|
494
494
|
type: "string",
|
|
@@ -588,17 +588,19 @@ export class VideoClipComponent extends ComponentWithLiveDuration {
|
|
|
588
588
|
constructor(
|
|
589
589
|
initialValues: {
|
|
590
590
|
description?: string;
|
|
591
|
+
registryKey?: string;
|
|
591
592
|
url?: string;
|
|
592
593
|
startMsIntoClip?: number;
|
|
593
594
|
endMsIntoClip?: number;
|
|
594
595
|
duration?: number;
|
|
595
|
-
destinationRect?: ReadOnlyRect | readonly
|
|
596
|
+
destinationRect?: ReadOnlyRect | readonly TimedKeyframe<ReadOnlyRect>[];
|
|
596
597
|
} = {},
|
|
597
598
|
) {
|
|
598
599
|
super(
|
|
599
600
|
initialValues.description ?? "Video Clip",
|
|
600
601
|
initialValues.duration ?? 1_000,
|
|
601
602
|
);
|
|
603
|
+
this.registryKey = initialValues.registryKey ?? "Video Clip";
|
|
602
604
|
if (initialValues.url !== undefined) {
|
|
603
605
|
this.urlScalar.value = initialValues.url;
|
|
604
606
|
}
|