Skip to content

Open source CapCut alternative.

TypeScript

fix(effects-kit): let a typewriter type as long as its line takes [rebuild]

David Lec8705b489e59
diff --git a/site/packages/effects-kit/src/count.test.ts b/site/packages/effects-kit/src/count.test.ts
index df6ba551..d738e7cf 100644
--- a/site/packages/effects-kit/src/count.test.ts
+++ b/site/packages/effects-kit/src/count.test.ts
@@ -70,6 +70,10 @@ describe("the count entrance", () => {
expect(edgeMaxSeconds("fade")).toBe(OVERLAY_ANIM_MAX_SECONDS);
});
+ test("a typewriter types for as long as the line takes, like a count", () => {
+ expect(edgeMaxSeconds("typewriter")).toBe(edgeMaxSeconds("count"));
+ });
+
test("counts up over the entrance, holds, and counts down on the exit", () => {
const o = title("100 %", anim);
expect(drawnAt(o, 0)).toBe("0 %");
diff --git a/site/packages/effects-kit/src/motion/edges.json b/site/packages/effects-kit/src/motion/edges.json
index ce718bfa..cfb2f961 100644
--- a/site/packages/effects-kit/src/motion/edges.json
+++ b/site/packages/effects-kit/src/motion/edges.json
@@ -633,6 +633,7 @@
},
"typewriter": {
"label": "Typewriter",
+ "maxSeconds": 10,
"slots": [
"in",
"out"
diff --git a/site/packages/effects-kit/src/motion/types.ts b/site/packages/effects-kit/src/motion/types.ts
index 99f2ef27..c11ccd32 100644
--- a/site/packages/effects-kit/src/motion/types.ts
+++ b/site/packages/effects-kit/src/motion/types.ts
@@ -145,7 +145,8 @@ export interface MotionPreset {
/** Loops only: one cycle in seconds at speed 1. */
period?: number;
/** Edges only: the longest the ramp may run, seconds, over the shared cap
- * (a count can run for as long as a loading bar does). */
+ * (a count can run for as long as a loading bar does, a typewriter as
+ * long as its line takes to type). */
maxSeconds?: number;
selector?: RangeSelector;
wiggly?: WigglySelector;