AI video skill for Claude Code & Codex — cinematic, editable product promos with Remotion: 124 shot recipe cards, 150 motion previews, beat sync, sound design, Motion Workbench & JianYing (CapCut CN) export.
TypeScript agent-skillsai-agentsai-videoclaude-codeclaude-code-skillsclaude-skillscodexmotion-designmotion-graphicsproduct-videopromo-videoremotionvideo-generationvideo-production
demos: 补 shot-transitions 卡 B/C/D 三式转场参考实现 (#41)
SKY ZHAO8b560059fbbc
diff --git a/demos/transition/shot-transitions/BlackCardTransition.tsx b/demos/transition/shot-transitions/BlackCardTransition.tsxnew file mode 100644index 0000000..d25146b--- /dev/null+++ b/demos/transition/shot-transitions/BlackCardTransition.tsx@@ -0,0 +1,137 @@+// D 式 黑场字卡(black-card)——前镜收尾淡入黑场,字卡逐词压印出现(paper-title-card+// 的暗场变体),再交棒后镜。章节级分段 + 呼吸位二合一;一支 30s 片 D 式 ≤2 次。+// 参考实现(真实纹理):A 景 = projects-full 项目板(前镜收尾 **8f** 淡入黑场,+// 符合定义 6–10 帧);暗底字卡 = "weekly brief, every project linked" 逐词 letterpress+// (暗底 + 页面底色浅色字,不用强调色当正文字——浅底字卡才不像报错弹窗),等宽小字+// 副行;完整标题落定后 **hold ~15 帧** 再退场,避免"最后一个字刚出现就淡出";+// 后镜 = wbr-full 周报页从黑场淡入 8f 交棒。+// 节拍:0–8 A 淡出 → 8–20 黑场静 → 20–47 字卡逐词压印 → 47–62 完整标题 hold →+// 62–70 字卡退场 → 70–78 淡入 B 景 → 78–120 B hold。+import { AbsoluteFill, Img, interpolate, staticFile, useCurrentFrame, Easing } from 'remotion';++export const BLACKCARD_DUR = 120;++const A_VIEW_Y = -180;+const SERIF = 'ui-serif, Georgia, "Times New Roman", serif';+const MONO = 'ui-monospace, SFMono-Regular, Menlo, monospace';++// 暗底字卡的正文用页面底色(浅色),强调色只给重点词+const PAPER_LIGHT = 'oklch(92% 0.01 82)';+const AMBER = 'oklch(68% 0.12 65)';+const DIM = 'oklch(72% 0.01 82)';++const WORDS: { text: string; accent?: boolean }[] = [+ { text: 'Every' },+ { text: 'project,' },+ { text: 'linked' },+ { text: 'to' },+ { text: 'your', accent: true },+ { text: 'weekly' },+ { text: 'report.' },+];++const Scene: React.FC = () => {+ const frame = useCurrentFrame();++ // A 景收尾:0→8 淡出到黑场(定义要求 6–10 帧,此处 8)+ const aOut = interpolate(frame, [0, 8], [1, 0], {+ extrapolateLeft: 'clamp', extrapolateRight: 'clamp', easing: Easing.bezier(0.5, 0, 0.4, 1),+ });++ // 字卡:20 起逐词压印(delay=20+i·3,最后词 i=6 delay=38 完成 47)+ const cardOpacity = interpolate(frame, [18, 26], [0, 1], {+ extrapolateLeft: 'clamp', extrapolateRight: 'clamp', easing: Easing.bezier(0.2, 0.7, 0.3, 1),+ });+ // 完整标题 47f 落定,hold 到 62 再退场(保留 ~15 帧完整展示)+ const cardOut = interpolate(frame, [62, 70], [0, 1], {+ extrapolateLeft: 'clamp', extrapolateRight: 'clamp', easing: Easing.bezier(0.4, 0, 0.5, 1),+ });++ // 后镜 B 淡入:70→78(字卡 62→70 完全淡出后再交棒)+ const bIn = interpolate(frame, [70, 78], [0, 1], {+ extrapolateLeft: 'clamp', extrapolateRight: 'clamp', easing: Easing.bezier(0.3, 0, 0.2, 1),+ });++ return (+ <AbsoluteFill style={{ backgroundColor: '#0c0c10', overflow: 'hidden' }}>+ {/* A 景 */}+ {frame < 14 ? (+ <div style={{ position: 'absolute', opacity: aOut }}>+ <Img+ src={staticFile('textures/live/projects-full.png')}+ style={{ position: 'absolute', left: 0, top: A_VIEW_Y, width: 1920 }}+ />+ </div>+ ) : null}++ {/* 黑场字卡(18–74) */}+ {frame >= 18 && frame < 74 ? (+ <AbsoluteFill+ style={{+ justifyContent: 'center', alignItems: 'center',+ opacity: cardOpacity * (1 - cardOut), pointerEvents: 'none',+ }}+ >+ <div style={{ textAlign: 'center', maxWidth: 1500 }}>+ <div+ style={{+ fontFamily: SERIF, fontSize: 96, fontWeight: 600, lineHeight: 1.16,+ color: PAPER_LIGHT, letterSpacing: '-0.012em',+ display: 'flex', flexWrap: 'wrap', justifyContent: 'center', columnGap: '0.26em',+ }}+ >+ {WORDS.map((w, i) => {+ const delay = 20 + i * 3;+ const t = interpolate(frame, [delay, delay + 9], [0, 1], {+ extrapolateLeft: 'clamp', extrapolateRight: 'clamp', easing: Easing.bezier(0.2, 0.75, 0.3, 1),+ });+ return (+ <span+ key={i}+ style={{+ opacity: t, transform: `scale(${1.3 - 0.3 * t})`,+ filter: `blur(${(1 - t) * 7}px)`, display: 'inline-block',+ fontStyle: w.accent ? 'italic' : 'normal',+ color: w.accent ? AMBER : undefined,+ }}+ >+ {w.text}+ </span>+ );+ })}+ </div>+ <div+ style={{+ height: 4, width: 180, margin: '30px auto 0', borderRadius: 2,+ background: AMBER, transform: `scaleX(${interpolate(frame, [32, 44], [0, 1], { extrapolateLeft: 'clamp', extrapolateRight: 'clamp', easing: Easing.bezier(0.3, 0, 0.2, 1) })})`,+ }}+ />+ <div+ style={{+ fontFamily: MONO, fontSize: 20, letterSpacing: '0.14em', color: DIM,+ marginTop: 26, textTransform: 'uppercase',+ opacity: interpolate(frame, [26, 36], [0, 1], { extrapolateLeft: 'clamp', extrapolateRight: 'clamp' }),+ }}+ >+ Weekly Brief · 2026-W28+ </div>+ </div>+ </AbsoluteFill>+ ) : null}++ {/* B 景(70 起淡入) */}+ {frame >= 70 ? (+ <div style={{ position: 'absolute', opacity: bIn }}>+ <Img+ src={staticFile('textures/live/wbr-full.png')}+ style={{ position: 'absolute', left: 0, top: 0, width: 1920, height: 1080 }}+ />+ </div>+ ) : null}+ </AbsoluteFill>+ );+};++export const BlackCardTransition: React.FC = () => (+ <Scene />+);diff --git a/demos/transition/shot-transitions/DarkTunnelTransition.tsx b/demos/transition/shot-transitions/DarkTunnelTransition.tsxnew file mode 100644index 0000000..f7aa1c5--- /dev/null+++ b/demos/transition/shot-transitions/DarkTunnelTransition.tsx@@ -0,0 +1,104 @@+// B 式 穿暗场直航(dark-tunnel)——相机顺运动方向推出前景 → 纯暗场滑行几帧 →+// 后景从景深迎面放大而来,一条 take 不切。高能量→高能量的场景跳转主力转场。+// 参考实现(真实纹理):A 景 = projects-full 全满项目板(前镜收尾段),+// 推出 10f 向右(相机追着出方向滑出前景);暗场 6f(保留微渐变尘点让+// "still moving" 可感,不纯黑死场);B 景 = wbr-full 周报页从 scale ~0.6 + blur+// 起步、10f 放大收焦入场。出与入同向(向右推出 → B 景从右迎来),速度曲线连续。+// 节拍:0–26 A hold → 26–36 推出(前景右移出画)→ 36–42 暗场 → 42–52 B 放大入场+// → 52–120 B hold(真静止)。+import { AbsoluteFill, Img, interpolate, staticFile, useCurrentFrame, Easing } from 'remotion';++export const DARKTUNNEL_DUR = 120;++// 两景都以 cards 网格区为观察窗;A 景顶对 y=180,B 景(wbr)顶对 y=0+const A_VIEW_Y = -180;+const A_W = 1920;++const Scene: React.FC = () => {+ const frame = useCurrentFrame();++ // A 景推出:26→36,整个前景向右平移出画(顺运动方向)+ const pushX = interpolate(frame, [26, 36], [0, A_W], {+ extrapolateLeft: 'clamp', extrapolateRight: 'clamp', easing: Easing.bezier(0.45, 0, 0.2, 1),+ });++ // 暗场:36→42 从 0→1(进入暗场),42→50 1→0(让 B 景迎入可见)。+ // 不纯黑——保留微渐变 + 两粒尘点,让"still moving"可感+ const tunnelVis = interpolate(frame, [36, 42, 50], [0, 1, 0], {+ extrapolateLeft: 'clamp', extrapolateRight: 'clamp', easing: Easing.bezier(0.4, 0, 0.6, 1),+ });++ // B 景迎面放大入场:42→52,从 scale 0.6 + blur 起步收焦,同时沿+ // 与 A 相同的运动轴(X 向右)从右缘滑入——出与入同向、速度连续,+ // 读作"穿过暗场直航"而不是两景各自动自己的。+ const bIn = interpolate(frame, [42, 52], [0, 1], {+ extrapolateLeft: 'clamp', extrapolateRight: 'clamp', easing: Easing.bezier(0.3, 0, 0.2, 1),+ });+ const bScale = 0.6 + 0.4 * bIn;+ const bBlur = (1 - bIn) * 12;+ // 从右侧滑入(约半屏起步),随收焦归位到中心——与 A 向右推出同向接续+ const bShiftX = (1 - bIn) * 960;++ // 尘点:确定性 index 派生(渲染必须可复现)+ const DUST = Array.from({ length: 4 }, (_, i) => ({+ x: 480 + i * 320,+ y: 300 + ((i * 137) % 480),+ drift: 6 + (i % 3) * 4, // px/frame,缓慢漂移表示"still moving"+ }));++ return (+ <AbsoluteFill style={{ backgroundColor: '#0d0d10', overflow: 'hidden' }}>+ {/* A 景(推出段) */}+ {frame < 42 ? (+ <div style={{ position: 'absolute', transform: `translateX(${pushX}px)` }}>+ <Img+ src={staticFile('textures/live/projects-full.png')}+ style={{ position: 'absolute', left: 0, top: A_VIEW_Y, width: A_W }}+ />+ </div>+ ) : null}++ {/* 暗场:微渐变 + 尘点,非纯黑死场 */}+ {frame >= 36 && frame < 50 ? (+ <AbsoluteFill style={{ opacity: tunnelVis, pointerEvents: 'none' }}>+ <div+ style={{+ position: 'absolute', inset: 0,+ background: 'radial-gradient(900px 500px at 50% 45%, rgba(40,42,50,0.9), rgba(12,12,16,1) 70%)',+ }}+ />+ {DUST.map((d, i) => (+ <div+ key={i}+ style={{+ position: 'absolute', left: d.x + frame * d.drift, top: d.y,+ width: 2, height: 2, borderRadius: '50%',+ background: 'rgba(120,125,140,0.35)',+ }}+ />+ ))}+ </AbsoluteFill>+ ) : null}++ {/* B 景:沿 A 的运动轴从右缘滑入 + 迎面放大 + 收焦 */}+ {frame >= 42 ? (+ <div+ style={{+ position: 'absolute', left: 0, top: 0, width: 1920, height: 1080,+ transform: `translateX(${bShiftX}px) scale(${bScale})`, filter: `blur(${bBlur}px)`,+ transformOrigin: '50% 45%',+ }}+ >+ <Img+ src={staticFile('textures/live/wbr-full.png')}+ style={{ position: 'absolute', left: 0, top: 0, width: 1920, height: 1080 }}+ />+ </div>+ ) : null}+ </AbsoluteFill>+ );+};++export const DarkTunnelTransition: React.FC = () => (+ <Scene />+);diff --git a/demos/transition/shot-transitions/FocusHandoffTransition.tsx b/demos/transition/shot-transitions/FocusHandoffTransition.tsxnew file mode 100644index 0000000..e0c0cf2--- /dev/null+++ b/demos/transition/shot-transitions/FocusHandoffTransition.tsx@@ -0,0 +1,60 @@+// C 式 虚焦接力(focus-handoff)——前景滑出焦平面(blur 渐深)同时后景反向+// 收焦入场,焦点当剪辑点。同页面内区块→区块 / 文档长页游览的分段转场。+// 参考实现(真实纹理):A/B 都取自**同一张** projects-full 长页——A 景对准+// 上部网格区(cards,y≈180 起),B 景对准**同一页的下半部**(Perception &+// Sensing / Research Infra 区块,y≈900 起),模拟"游览同一长页、区块接力"。+// 节拍:0–24 A hold → 24–40 A 淡出 + blur 0→8px 推出,同时 26–42 B 从 8px→0+// 收焦 + 淡入 + 反向滑入(错开 2f 起跑——同帧起跑读作整屏糊掉);两景在交叉+// 窗口内互为焦点交换 → 42–120 B hold(真静止)。浅景深语言先立后用。+import { AbsoluteFill, Img, interpolate, staticFile, useCurrentFrame, Easing } from 'remotion';++export const FOCUSHANDOFF_DUR = 120;++const PAGE_H = 1746; // projects-full 的 CSS 高(layout.projects.pageH)+// A 景观察窗:对准上部网格区(viewport 顶对页面 y=180)+const A_VIEW_Y = -180;+// B 景观察窗:同一页面的下半部(viewport 顶对页面 y=900,显示+// Perception & Sensing / Research Infra 区块),viewport 底不超页底+const B_VIEW_Y = -900;++const Scene: React.FC = () => {+ const frame = useCurrentFrame();++ // A 景:24→40 淡出 + blur 加深 + 略推出(前景滑出焦平面)+ const aOut = interpolate(frame, [24, 40], [0, 1], {+ extrapolateLeft: 'clamp', extrapolateRight: 'clamp', easing: Easing.bezier(0.45, 0, 0.3, 1),+ });+ const aBlur = aOut * 8;+ const aDrift = aOut * 60; // 轻微左移,读作"滑出"而非原地淡++ // B 景:26→42 收焦入场(错开 2f 起跑),8px→0 + 淡入 + 反向滑入+ const bIn = interpolate(frame, [26, 42], [0, 1], {+ extrapolateLeft: 'clamp', extrapolateRight: 'clamp', easing: Easing.bezier(0.3, 0, 0.2, 1),+ });+ const bBlur = (1 - bIn) * 8;+ const bDrift = (1 - bIn) * -50; // 反向(从右滑入)++ return (+ <AbsoluteFill style={{ backgroundColor: '#faf7f2', overflow: 'hidden' }}>+ {/* A 景:同一页的上半部(网格区) */}+ <div style={{ position: 'absolute', opacity: 1 - aOut, filter: `blur(${aBlur}px)`, transform: `translateX(${-aDrift}px)` }}>+ <Img+ src={staticFile('textures/live/projects-full.png')}+ style={{ position: 'absolute', left: 0, top: A_VIEW_Y, width: 1920, height: PAGE_H }}+ />+ </div>++ {/* B 景(上层):同一页的下半部(sections 区),交叉窗口内收焦 */}+ <div style={{ position: 'absolute', opacity: bIn, filter: `blur(${bBlur}px)`, transform: `translateX(${bDrift}px)` }}>+ <Img+ src={staticFile('textures/live/projects-full.png')}+ style={{ position: 'absolute', left: 0, top: B_VIEW_Y, width: 1920, height: PAGE_H }}+ />+ </div>+ </AbsoluteFill>+ );+};++export const FocusHandoffTransition: React.FC = () => (+ <Scene />+);diff --git a/gallery/source/shot-transitions.md b/gallery/source/shot-transitions.mdindex fbaaf15..9848b5e 100644--- a/gallery/source/shot-transitions.md+++ b/gallery/source/shot-transitions.md@@ -54,7 +54,9 @@ name: shot-transitions参考实现 demos/transition/shot-transitions/PortalWipeV2.tsx## 参考实现-A 式:template/src/aifl/Main.tsx flash-cut 层;+A 式:template/src/aifl/Main.tsx flash-cut 层(组件 `assets/lib/FlashCut.tsx`);+B 式(穿暗场直航):demos/transition/shot-transitions/DarkTunnelTransition.tsx;+C 式(虚焦接力):demos/transition/shot-transitions/FocusHandoffTransition.tsx;+D 式(黑场字卡):demos/transition/shot-transitions/BlackCardTransition.tsx;E 式(whip 甩镜):demos/transition/shot-transitions/WhipPanReal.tsx / WhipBrakeReal.tsx;-F 式(遮罩擦除):demos/transition/shot-transitions/MaskWipeReal.tsx(纵深款 PortalWipeV2.tsx 同目录);-B/C/D 式暂无库内实现,按参数表自行实现。+F 式(遮罩擦除):demos/transition/shot-transitions/MaskWipeReal.tsx(纵深款 PortalWipeV2.tsx 同目录)。diff --git a/references/shots/transition/shot-transitions.md b/references/shots/transition/shot-transitions.mdindex fbaaf15..9848b5e 100644--- a/references/shots/transition/shot-transitions.md+++ b/references/shots/transition/shot-transitions.md@@ -54,7 +54,9 @@ name: shot-transitions参考实现 demos/transition/shot-transitions/PortalWipeV2.tsx## 参考实现-A 式:template/src/aifl/Main.tsx flash-cut 层;+A 式:template/src/aifl/Main.tsx flash-cut 层(组件 `assets/lib/FlashCut.tsx`);+B 式(穿暗场直航):demos/transition/shot-transitions/DarkTunnelTransition.tsx;+C 式(虚焦接力):demos/transition/shot-transitions/FocusHandoffTransition.tsx;+D 式(黑场字卡):demos/transition/shot-transitions/BlackCardTransition.tsx;E 式(whip 甩镜):demos/transition/shot-transitions/WhipPanReal.tsx / WhipBrakeReal.tsx;-F 式(遮罩擦除):demos/transition/shot-transitions/MaskWipeReal.tsx(纵深款 PortalWipeV2.tsx 同目录);-B/C/D 式暂无库内实现,按参数表自行实现。+F 式(遮罩擦除):demos/transition/shot-transitions/MaskWipeReal.tsx(纵深款 PortalWipeV2.tsx 同目录)。