Motion · Transition

Gradient transition

The background smoothly transitions among linear, radial, and conic CSS gradients — angle, color stops, center, and radius each interpolate, with a cross-fade at type changes.

1920×108016:930 fps6.5s · 195 framesremotionLicense: Apache-2.0#shotcraft#remotion#transition

Source: video-shotcraft (Vincent Wei) ↗ · Apache-2.0 · Remotion composition (React/TSX) — preview video, no in-browser player

When to use

A continuous variation for the atmosphere / section background color; gives a static layout section a background layer that feels "alive".

Intention

A gradient isn't a static bitmap but an animatable parameter set: any parameter within the same gradient type can interpolate into a smooth change, with a short cross-fade bridging type changes. Used as a background layer, it gives a section with "no subject motion" a persistent low-speed energy.

Duration & energy

  • Duration: About 6.0s (180f@30fps; linear 0–2.4s · radial 2–4.2s · conic 4–6s)
  • Energy: Low (pure background motion, stays out of the foreground content's way)

Shot recipe (original Chinese — timing, easing, parameter table, known pitfalls)

意图

渐变不是静态贴图而是可动画的参数集:同类型渐变内部任何参数都能插值出丝滑变化,跨类型则用短交叉淡化衔接。作背景层用,给"没有主体运动"的段落一层持续的低速能量。

动效核心

  • 三层各持一种渐变类型,同一时刻只有一层主导,交叉淡化窗口很窄(0.08)
  • linear 段(t=0–0.4):角度 40°→230°,两组色标在 HSL 空间三通道插值(mixH 对 h/s/l 分别 lerp)——比 RGB 插值不发灰
  • radial 段(t=0.33–0.7):圆心 (28%,66%)→(72%,32%) 对角迁移 + 半径 45%→85% 扩张,暗色外圈近黑,光斑像在画面里游走
  • conic 段(t=0.66–1):七段彩虹色环 from 角 0→300° 旋转,首尾同色(hsl 0 出现两次)可无缝循环
  • 中央玻璃 pill 标签实时显示当前类型(LINEAR/RADIAL/CONIC),demo 用;实用时删掉

参数表

| 参数 | 典型值 | 调节手感 | |------|--------|----------| | 段窗口重叠 | 相邻段起点比前段终点早 0.07 | 重叠保证淡化时两层都在动;无重叠会看到"接管瞬间静止" | | 交叉淡化 | 0.30–0.38 / 0.63–0.71,各 0.08 | 拉宽会同屏看到两种渐变结构打架;窄淡化 + 参数同动是"换类型不换气"的关键 | | HSL 插值 | h/s/l 三通道独立 lerp | 色相差 >180° 时会绕远路(如 340→160),需要短路径时给起点 +360 | | radial 迁移 | 中心对角走位 + 半径近倍扩 | 中心不动只扩半径会读作"呼吸"不是"游走" | | conic 旋转 | from 0→300°(不满一圈) | 转满 360° 收尾与开头同帧,接循环时用;单次播放留 60° 缺口避免"回到原点"感 | | 色标组 | 每段两组 HSL 起止 | 换项目色时保持"亮色+暗色"配对结构,radial 外圈必须暗(光斑成立的前提) |

已知坑

  • 这是背景卡:前景放排版/UI 时把 label pill 删掉,并把整层 opacity 压到 0.6–0.8 或叠暗色 scrim,否则彩虹 conic 段会吃掉前景对比度
  • CSS 渐变字符串每帧重写触发 repaint 而非 composite——大画幅 + 低端设备需实测;Remotion 服务端渲染无此顾虑
  • conic 段的七段色环是"演出"性质,品牌化场景建议换成三色循环(A→B→C→A)
  • 三段各自独立可拆用:只要 linear 段(0–0.4 重归一化到 0–1)就是一张"角度扫过"的极简底

参考实现

demos/transition/gradient-transition/ (GradientTransition.tsx)

Reference implementation (Remotion)

  • demos/transition/gradient-transition/GradientTransition.tsx — https://raw.githubusercontent.com/Vincentwei1021/video-shotcraft/main/demos/transition/gradient-transition/GradientTransition.tsx

The component imports shared fixtures from demos/_fixtures and helpers from assets/lib in the repo; SKILL.md there documents the render workflow.

Everything on this page is also machine-readable. Point your agent at the JSON, or add the gimgs MCP server and ask it to search motion templates.

  1. Fetch the JSON — it holds the shot recipe (timing, easing, parameter table, pitfalls) and the full TSX source.
  2. Clone the video-shotcraft repo; the component imports shared fixtures from demos/_fixtures and helpers from assets/lib.
  3. Register the component as a <Composition> in a Remotion project and render with `npx remotion render`, or re-implement the recipe in your own engine.
curl -s https://gimgs.net/motion/gradient-transition.json
git clone https://github.com/Vincentwei1021/video-shotcraft
# component: demos/transition/gradient-transition/GradientTransition.tsx
npx remotion render <CompositionId> out.mp4
claude mcp add --transport http gimgs https://gimgs.net/mcp
# then: search_motion_templates / get_motion_template("gradient-transition")

Prompt

Use the video-shotcraft shot recipe "Gradient transition" (Remotion composition, Apache-2.0) published on gimgs.net.
Recipe JSON (prompt = timing/easing/parameter table/pitfalls, files = TSX source): https://gimgs.net/motion/gradient-transition.json
Raw TSX: https://gimgs.net/motion/gradient-transition/template.html
Repository: https://github.com/Vincentwei1021/video-shotcraft  (component: demos/transition/gradient-transition/GradientTransition.tsx; imports demos/_fixtures and assets/lib)
Spec: 1920x1080, 30 fps, 6.5s

1. Read the JSON and follow its "prompt" section (when to use, intention, parameter table, known pitfalls).
2. Adapt it for: <describe what you want>.
3. Either clone the repo, register the component as a <Composition> in a Remotion project and run npx remotion render <CompositionId> out.mp4 — or re-implement the recipe in your own engine (HTML/WAAPI works: keep the same timing and easing).

JSON · Markdown · llms.txt

2,825 chars · Apache-2.0Open raw template ↗
// ===== demos/transition/gradient-transition/GradientTransition.tsx =====
// gradient-transition — Gradient Transition 渐变过渡(motion-lab 定稿转原生 Remotion)
// 背景在三类 CSS 渐变之间平滑过渡:linear 段插值角度+色标,radial 段插值中心+半径,
// conic 段旋转彩虹;等价"解析 gradient 字符串逐参数插值"的配方,中央 pill 标注当前段。
// 设计坐标 480×270(DesignStage 等比放大),参数表数值以此坐标系标定。
import React from 'react';
import { DesignStage, E, lerp, seg, useT } from '../../_fixtures/Motion';

export const GRADIENT_TRANSITION_DURATION = 180; // 6000ms @30fps

const hsl = (h: number, s: number, l: number) => `hsl(${h},${s}%,${l}%)`;
type H3 = [number, number, number];
// hsl 三元组按分量插值
const mixH = (a: H3, b: H3, k: number): H3 => [lerp(k, a[0], b[0]), lerp(k, a[1], b[1]), lerp(k, a[2], b[2])];

const layerStyle = (background: string, opacity: number): React.CSSProperties => ({
  position: 'absolute',
  inset: 0,
  background,
  opacity,
});

export const GradientTransition: React.FC = () => {
  const t = useT();

  // Phase 1: linear —— 角度 40°→230°,两组色标 hsl 插值
  const p1 = seg(t, 0, 0.4, E.inOutQuad);
  const ang = lerp(p1, 40, 230);
  const l1c1 = mixH([340, 88, 60], [160, 78, 52], p1);
  const l1c2 = mixH([265, 80, 52], [205, 92, 58], p1);
  const bg1 = `linear-gradient(${ang}deg, ${hsl(...l1c1)}, ${hsl(...l1c2)})`;

  // Phase 2: radial —— 中心 (28%,66%)→(72%,32%),半径 45%→85%
  const p2 = seg(t, 0.33, 0.7, E.inOutQuad);
  const cx = lerp(p2, 28, 72), cy = lerp(p2, 66, 32), rr = lerp(p2, 45, 85);
  const l2c1 = mixH([45, 95, 62], [285, 85, 58], p2);
  const l2c2 = mixH([220, 60, 14], [230, 55, 10], p2);
  const bg2 = `radial-gradient(circle ${rr}% at ${cx}% ${cy}%, ${hsl(...l2c1)}, ${hsl(...l2c2)})`;

  // Phase 3: conic —— from 角度旋转的彩虹环(首尾同色可无缝循环)
  const p3 = seg(t, 0.66, 1, E.inOutQuad);
  const from = p3 * 300;
  const bg3 = `conic-gradient(from ${from}deg at 50% 50%,
    hsl(0,85%,60%), hsl(60,85%,60%), hsl(120,75%,55%), hsl(180,80%,55%),
    hsl(240,85%,62%), hsl(300,85%,60%), hsl(0,85%,60%))`;

  return (
    <DesignStage bg="#0a0b10">
      {/* 三层渐变依次交叉淡入淡出 */}
      <div style={layerStyle(bg1, 1 - seg(t, 0.3, 0.38))} />
      <div style={layerStyle(bg2, seg(t, 0.3, 0.38) - seg(t, 0.63, 0.71))} />
      <div style={layerStyle(bg3, seg(t, 0.63, 0.71))} />
      {/* 中央 pill:标注当前渐变类型 */}
      <div
        style={{
          position: 'absolute',
          left: '50%',
          top: '50%',
          transform: 'translate(-50%,-50%)',
          padding: '6px 18px',
          borderRadius: 999,
          background: 'rgba(8,9,14,.55)',
          color: '#fff',
          fontFamily: '-apple-system,system-ui,sans-serif',
          fontSize: 13,
          letterSpacing: 4,
          fontWeight: 700,
          backdropFilter: 'blur(4px)',
        }}
      >
        {t < 0.34 ? 'LINEAR' : t < 0.67 ? 'RADIAL' : 'CONIC'}
      </div>
    </DesignStage>
  );
};


  1. Read the recipe
    Prompt = when to use, intention, parameter table with typical values and how each one feels, known pitfalls. Treat values as calibrated starting points.
  2. Get the code
    tool: git
    git clone https://github.com/Vincentwei1021/video-shotcraft && cd video-shotcraft && npm install
  3. Register + render
    tool: remotion
    npx remotion render <CompositionId> out.mp4 # component: demos/transition/gradient-transition/GradientTransition.tsx
  4. Or re-implement
    Port the timing/easing from the recipe to HTML + WAAPI (gimgs motion contract) or any engine; keep the same segment windows and easing.
paramtypedefaultdescription
—

More in this category