Skip to content

Code-first video & image, rendered natively on WebGPU.

qa video

okanasl2afd56fb08dc
diff --git a/examples/22_framefields_launch/src/scenes/logo.ts b/examples/22_framefields_launch/src/scenes/logo.ts
index ddd0d275..b60842c5 100644
--- a/examples/22_framefields_launch/src/scenes/logo.ts
+++ b/examples/22_framefields_launch/src/scenes/logo.ts
@@ -99,6 +99,7 @@ export function logoScene() {
inAt: land + 6,
color: FG,
size: 26,
+ until: len,
}),
// The flood from the hook drains away as the camera swings in.
plane("logo-flood", ACCENT).animate(
diff --git a/examples/22_framefields_launch/src/scenes/not.ts b/examples/22_framefields_launch/src/scenes/not.ts
index 19318fe6..7fd31a9c 100644
--- a/examples/22_framefields_launch/src/scenes/not.ts
+++ b/examples/22_framefields_launch/src/scenes/not.ts
@@ -143,6 +143,7 @@ export function notScene() {
inAt: answer[2].at - from + 8,
color: BG,
size: 24,
+ until: to - from,
}),
plane("not-drop", FG, "difference").animate(
flashes([{ at: 0, peak: 1 }], 8),
diff --git a/examples/22_framefields_launch/src/theme.ts b/examples/22_framefields_launch/src/theme.ts
index ac8cddfb..11d3f519 100644
--- a/examples/22_framefields_launch/src/theme.ts
+++ b/examples/22_framefields_launch/src/theme.ts
@@ -151,14 +151,27 @@ export interface LabelOptions {
size?: number;
inAt: number;
outAt?: number;
+ /** Frame (relative to container) the label's clip ends: entrance is shortened to finish by then. */
+ until?: number;
}
/** The machine voice: small tracked mono caps that decode in from scrambled glyphs. */
export function label(o: LabelOptions): Node {
const size = o.size ?? 22;
+ const until = o.until ?? o.outAt;
+ const clampSpan = (frames: number) =>
+ until === undefined
+ ? frames
+ : Math.max(1, Math.min(frames, until - 1 - o.inAt));
const anim = LayerAnimation.create()
- .fadeIn(o.inAt, o.inAt + 4, "power2.out")
- .letterSpacing(size * 0.7, size * 0.32, o.inAt, o.inAt + 24, EASE_OUT);
+ .fadeIn(o.inAt, o.inAt + Math.min(4, clampSpan(4)), "power2.out")
+ .letterSpacing(
+ size * 0.7,
+ size * 0.32,
+ o.inAt,
+ o.inAt + clampSpan(24),
+ EASE_OUT,
+ );
if (o.outAt !== undefined) anim.fadeOut(o.outAt, o.outAt + 6, "power2.in");
return Layer.text(o.text.toUpperCase(), {
id: o.id,
@@ -303,7 +316,7 @@ export function sungLine(o: SungLineOptions): Node {
const text = o.upper === false ? bare(w) : bare(w).toUpperCase();
const anim = LayerAnimation.create();
// A word sung just before the cut still lands at rest on its last frame.
- const fit = (frames: number) =>
+ const clampSpan = (frames: number) =>
o.until === undefined
? frames
: Math.max(1, Math.min(frames, o.until - 1 - at));
@@ -311,18 +324,26 @@ export function sungLine(o: SungLineOptions): Node {
anim
.fromTo("scale", 1.35, 1, {
start: at,
- end: at + fit(8),
+ end: at + clampSpan(8),
ease: EASE_OUT,
})
- .fromTo("opacity", 0, 1, { start: at, end: at + fit(2), ease: "none" });
+ .fromTo("opacity", 0, 1, {
+ start: at,
+ end: at + clampSpan(2),
+ ease: "none",
+ });
} else {
anim
.fromTo("y", size * 0.45, 0, {
start: at,
- end: at + fit(10),
+ end: at + clampSpan(10),
ease: EASE_OUT,
})
- .fromTo("opacity", 0, 1, { start: at, end: at + fit(3), ease: "none" });
+ .fromTo("opacity", 0, 1, {
+ start: at,
+ end: at + clampSpan(3),
+ ease: "none",
+ });
}
return Layer.text(text, {
id: `${o.id}-${i}`,