UI · code-diff-highlight
Code diff highlight
A code-review window with a file-name header: removed lines in red and added lines in green sweep in one by one with old/new line-number gutters, a +/- column and light syntax colouring, then a +N/−M badge pops and unchanged context dims.
A free, MIT-licensed UI animation from the Opus Motion Library — 616 motions for Remotion, React and plain HTML.

What Code diff highlight is for
Pull-request and code-review explainers, "what changed" beats, refactor / bug-fix walkthroughs, changelog and developer-tool promos, AI-coding demos.
Details
- Category
- UI & product mockup animations
- Length
- 7.0 s (210 frames at 30 fps)
- Formats
- 16:9, 1:1, 9:16
- Weight
- light
- Transparent overlay
- yes
- Seamless loop
- no
- Text props
linescaption- Colour props
backgroundpanelinkaddColordelColoraccent- Mood
- ui
- Roles
- accent, subject
Use Code diff highlight in Remotion, React or HTML
Remotion project
# copy this motion into your Remotion project
node cli/mgl.mjs add code-diff-highlight --to ../my-app/src
# render an mp4 (run in the library folder)
node cli/mgl.mjs render code-diff-highlight --props '{"lines":[{"type":"ctx","text":"export function isValid(session: Session) {"},{"type":"del","text":" return session.token !== null;"},{"type":"add","text":" if (!session.token) return false;"},{"type":"add","text":" const expired = Date.now() > session.expiresAt;"},{"type":"add","text":" return !expired;"},{"type":"ctx","text":"}"},{"type":"ctx","text":""},{"type":"del","text":"const TTL = 60 * 60;"},{"type":"add","text":"const TTL = 15 * 60; // shorter sessions"}],"caption":"Reject expired sessions","background":"#0B0E14","panel":"#12161F","ink":"#E6EAF2","addColor":"#2EA043","delColor":"#F85149","accent":"#79B8FF"}'
# or export for apps / editors: mp4 | webm-alpha | prores-alpha | gif | png | poster
node cli/mgl.mjs export code-diff-highlight --as webm-alpha --props '{"lines":[{"type":"ctx","text":"export function isValid(session: Session) {"},{"type":"del","text":" return session.token !== null;"},{"type":"add","text":" if (!session.token) return false;"},{"type":"add","text":" const expired = Date.now() > session.expiresAt;"},{"type":"add","text":" return !expired;"},{"type":"ctx","text":"}"},{"type":"ctx","text":""},{"type":"del","text":"const TTL = 60 * 60;"},{"type":"add","text":"const TTL = 15 * 60; // shorter sessions"}],"caption":"Reject expired sessions","background":"#0B0E14","panel":"#12161F","ink":"#E6EAF2","addColor":"#2EA043","delColor":"#F85149","accent":"#79B8FF"}'React / Next.js
import {MotionPlayer} from 'opus-motion-library/web';
<MotionPlayer
motion="code-diff-highlight"
props={{
lines: [
{type: 'ctx', text: 'export function isValid(session: Session) {'},
{type: 'del', text: ' return session.token !== null;'},
{type: 'add', text: ' if (!session.token) return false;'},
{
type: 'add',
text: ' const expired = Date.now() > session.expiresAt;',
},
{type: 'add', text: ' return !expired;'},
{type: 'ctx', text: '}'},
{type: 'ctx', text: ''},
{type: 'del', text: 'const TTL = 60 * 60;'},
{type: 'add', text: 'const TTL = 15 * 60; // shorter sessions'},
],
caption: 'Reject expired sessions',
background: '#0B0E14',
panel: '#12161F',
ink: '#E6EAF2',
addColor: '#2EA043',
delColor: '#F85149',
accent: '#79B8FF',
}}
playOnView
loop="auto"
/>Plain HTML / WordPress
<script src="opus-motion.element.js" defer></script>
<opus-motion motion="code-diff-highlight"
props='{"lines":[{"type":"ctx","text":"export function isValid(session: Session) {"},{"type":"del","text":" return session.token !== null;"},{"type":"add","text":" if (!session.token) return false;"},{"type":"add","text":" const expired = Date.now() > session.expiresAt;"},{"type":"add","text":" return !expired;"},{"type":"ctx","text":"}"},{"type":"ctx","text":""},{"type":"del","text":"const TTL = 60 * 60;"},{"type":"add","text":"const TTL = 15 * 60; // shorter sessions"}],"caption":"Reject expired sessions","background":"#0B0E14","panel":"#12161F","ink":"#E6EAF2","addColor":"#2EA043","delColor":"#F85149","accent":"#79B8FF"}'>
</opus-motion>Compose spec (multi-scene video)
{
"width": 1920,
"height": 1080,
"fps": 30,
"scenes": [
{
"motion": "code-diff-highlight",
"props": {
"lines": [
{
"type": "ctx",
"text": "export function isValid(session: Session) {"
},
{
"type": "del",
"text": " return session.token !== null;"
},
{
"type": "add",
"text": " if (!session.token) return false;"
},
{
"type": "add",
"text": " const expired = Date.now() > session.expiresAt;"
},
{
"type": "add",
"text": " return !expired;"
},
{
"type": "ctx",
"text": "}"
},
{
"type": "ctx",
"text": ""
},
{
"type": "del",
"text": "const TTL = 60 * 60;"
},
{
"type": "add",
"text": "const TTL = 15 * 60; // shorter sessions"
}
],
"caption": "Reject expired sessions",
"background": "#0B0E14",
"panel": "#12161F",
"ink": "#E6EAF2",
"addColor": "#2EA043",
"delColor": "#F85149",
"accent": "#79B8FF"
}
}
]
}Code diff highlight props
15 parameters — change any of them to make the motion yours.
| Prop | Default | What it does |
|---|---|---|
fileName | "src/auth/session.ts" | file path shown in the window header |
hunkHeader | "" | hunk line above the code, e.g. '@@ -12,7 +12,9 @@' (empty = computed from the lines) |
lines | [{"type":"ctx","text":"export function isValid(session: Session) {"},{"type":"del","tex… | diff lines [{type: 'add' | 'del' | 'ctx', text}] — text is plain code, no +/- prefix |
startLine | 12 | first line number in the gutters |
caption | "Reject expired sessions" | one-line takeaway under the window (empty = none) |
every | 9 | frames between lines |
speed | 1 | timing multiplier |
startAt | 0 | frame the window starts |
background | "#0B0E14" | page colour or 'transparent' |
panel | "#12161F" | window colour (dark or light — syntax colours adapt) |
ink | "#E6EAF2" | text colour |
addColor | "#2EA043" | added-line colour |
delColor | "#F85149" | removed-line colour |
accent | "#79B8FF" | hunk-header colour |
fontFamily | "" | monospace font override (empty = JetBrains Mono) |
Related motions

Git branch graph
Explaining branching and merging, release flow, pull-request workflows, version-control tutorials, "how our team ships" and developer-tool…
git-branch-graph
Terminal install progress
Install / setup / "get started in one command" beats, CLI and package-manager promos, developer onboarding, build or deploy output,…
terminal-install-progress
Agent log panel
Showing agent reasoning or chat history next to the action; multi-agent demos, customer-support and simulation promos; overlay-capable.
agent-log-panel
Glass lesson cards
Lesson, step and definition overlays for educational explainers, product tours and course trailers; the card system of an "interactive…
glass-lesson-card
Hero gradient orbs
A full-bleed website hero or section backdrop behind HTML headlines, a landing-page "mesh gradient" that moves, or a soft ambient layer…
hero-gradient-orbs
Hotel rating card
Hotel, rental and resort promos, travel-booking app demos, "top-rated stay" reels, property / venue / restaurant rating cards — set the…
hotel-rating-card
Notes & credits
Technique sources:
- original (generic developer explainer)