0.1.5 update video and Chinese changelog

Real footage of the installed 0.1.5 apps, composited in Remotion with
shape morphs between sections; synthesized score and UI sounds. Logs
P3-17 (ElyTable keyboard zoom leaves the grid half-scrolled).

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
ZacharyZhang-NYandClaude Opus 5.5 committed 2026-10-15 09:24:06 -04:00
1 parent 2e1ba5eded
commit 8f31e53cfc
57 files changed
+8051

No files matched your search

+7
View File
@@ -0,0 +1,7 @@
import { Composition } from 'remotion';
import { FPS, HEIGHT, TOTAL, WIDTH } from './theme';
import { Video } from './Video';
export const Root: React.FC = () => (
<Composition id="Update" component={Video} durationInFrames={TOTAL} fps={FPS} width={WIDTH} height={HEIGHT} />
);
+53
View File
@@ -0,0 +1,53 @@
import { AbsoluteFill, Audio, Sequence, getStaticFiles, staticFile } from 'remotion';
import './design/fonts';
import { Background } from './design/Background';
import { Intro } from './scenes/Intro';
import { Outro } from './scenes/Outro';
import { Menus } from './scenes/Menus';
import { Cells } from './scenes/Cells';
import { RightClick } from './scenes/RightClick';
import { More } from './scenes/More';
import { SECTION } from './theme';
// Set false to render without the score.
const MUSIC = true;
const MUSIC_FILE = 'audio/music.wav';
const hasMusic = () => getStaticFiles().some((file) => file.name.split('\\').join('/') === MUSIC_FILE);
// Whooshes at each morph, impact on the outro downbeat.
const MORPHS = [300, 840, 1440, 2340, 3090];
const at = (section: { from: number; duration: number }) => ({ from: section.from, durationInFrames: section.duration });
export const Video: React.FC = () => (
<AbsoluteFill>
<Background />
<Sequence {...at(SECTION.intro)} name="Intro">
<Intro />
</Sequence>
<Sequence {...at(SECTION.menus)} name="Menus">
<Menus />
</Sequence>
<Sequence {...at(SECTION.cells)} name="Cells">
<Cells />
</Sequence>
<Sequence {...at(SECTION.rightClick)} name="RightClick">
<RightClick />
</Sequence>
<Sequence {...at(SECTION.more)} name="More">
<More />
</Sequence>
<Sequence {...at(SECTION.outro)} name="Outro">
<Outro />
</Sequence>
{MORPHS.map((frame) => (
<Sequence key={frame} from={frame} durationInFrames={45} name="whoosh">
<Audio src={staticFile('audio/sfx/whoosh.wav')} volume={0.35} />
</Sequence>
))}
<Sequence from={3150} durationInFrames={90} name="impact">
<Audio src={staticFile('audio/sfx/impact.wav')} volume={0.4} />
</Sequence>
{MUSIC && hasMusic() ? <Audio src={staticFile(MUSIC_FILE)} /> : null}
</AbsoluteFill>
);
@@ -0,0 +1,24 @@
import { AbsoluteFill, useCurrentFrame } from 'remotion';
import { COLOR, HEIGHT, WIDTH } from '../theme';
// Near-black field with a faint lift at the centre and fine film grain. The grain
// changes every other frame (30 Hz) from a seed fixed by the frame number.
export const Background: React.FC = () => {
const frame = useCurrentFrame();
const seed = Math.floor(frame / 2) % 997;
return (
<AbsoluteFill style={{ background: COLOR.bgOuter }}>
<AbsoluteFill
style={{ background: `radial-gradient(ellipse 72% 66% at 50% 47%, ${COLOR.bgInner} 0%, ${COLOR.bgOuter} 100%)` }}
/>
<AbsoluteFill style={{ background: 'radial-gradient(ellipse 90% 90% at 50% 50%, rgba(0,0,0,0) 60%, rgba(0,0,0,0.28) 100%)' }} />
<svg width={WIDTH} height={HEIGHT} style={{ position: 'absolute', inset: 0, opacity: 0.055, mixBlendMode: 'screen' }}>
<filter id="grain" x="0" y="0" width="100%" height="100%">
<feTurbulence type="fractalNoise" baseFrequency="0.85" numOctaves="2" seed={seed} stitchTiles="stitch" />
<feColorMatrix type="saturate" values="0" />
</filter>
<rect width="100%" height="100%" filter="url(#grain)" />
</svg>
</AbsoluteFill>
);
};
@@ -0,0 +1,50 @@
import { interpolate, useCurrentFrame } from 'remotion';
import { COLOR, EASE, FONT, STAGE } from '../theme';
export type CaptionProps = {
text: string;
// Section-local frames: starts entering at `from`, gone by `to`.
from: number;
to: number;
// Centre of the pill in composition pixels (default: bottom centre of the stage).
x?: number;
y?: number;
};
const clamp = { extrapolateLeft: 'clamp', extrapolateRight: 'clamp' } as const;
// A glass pill with one line of explanation, over the stage.
export const Caption: React.FC<CaptionProps> = ({ text, from, to, x = STAGE.x + STAGE.w / 2, y = STAGE.y + STAGE.h - 64 }) => {
const frame = useCurrentFrame();
if (frame < from || frame >= to) return null;
const p = interpolate(frame, [from, from + 22], [0, 1], { ...clamp, easing: EASE.out });
const q = interpolate(frame, [to - 16, to], [0, 1], { ...clamp, easing: EASE.in });
const blur = (1 - p) * 6 + q * 5;
return (
<div
style={{
position: 'absolute',
left: x,
top: y,
transform: `translate(-50%, -50%) translateY(${((1 - p) * 14 - q * 8).toFixed(2)}px) scale(${(0.98 + 0.02 * p).toFixed(4)})`,
opacity: p * (1 - q),
filter: blur > 0.05 ? `blur(${blur.toFixed(2)}px)` : undefined,
padding: '13px 26px 14px',
borderRadius: 16,
background: 'rgba(22,22,24,0.66)',
backdropFilter: 'blur(18px) saturate(1.2)',
border: '1px solid rgba(255,255,255,0.09)',
boxShadow: '0 12px 40px rgba(0,0,0,0.42)',
fontFamily: FONT.sans,
fontWeight: 500,
fontSize: 26,
lineHeight: '34px',
letterSpacing: '0.03em',
color: COLOR.ink,
whiteSpace: 'nowrap',
}}
>
{text}
</div>
);
};
@@ -0,0 +1,203 @@
import { Img, interpolate, staticFile, useCurrentFrame } from 'remotion';
import { mix } from './Shape';
import { type AppId, COLOR, EASE, FONT, HEADING, STAGE, appOf } from '../theme';
export type HeadingSpec = {
title: string;
sub?: string;
// App chip at the right edge, above the stage.
app?: AppId;
// Section-local frame the title starts to enter (default: beat 1).
at?: number;
// Section-local frame it starts to leave (default: the next heading's
// entrance, or HEADING.out frames before the section ends).
until?: number;
};
const ENTER = 28;
const LEAVE = 22;
const clamp = { extrapolateLeft: 'clamp', extrapolateRight: 'clamp' } as const;
// Per-character rise, unblur and fade; leaving drifts on up and dissolves.
// The first `keepIn` characters are already on screen (shared with the previous
// heading); the first `keepOut` stay for the next one until `handoff`.
const Kinetic: React.FC<{
text: string;
local: number;
leave: number;
stagger: number;
rise: number;
keepIn?: number;
keepOut?: number;
handoff?: number;
}> = ({ text, local, leave, stagger, rise, keepIn = 0, keepOut = 0, handoff = Infinity }) => {
const chars = Array.from(text);
return (
<>
{chars.map((char, i) => {
const kept = i < keepOut;
if (kept && local >= handoff) return <span key={i} style={{ display: 'inline-block', whiteSpace: 'pre', opacity: 0 }}>{char}</span>;
const order = i - keepIn;
const p = i < keepIn ? 1 : interpolate(local - order * stagger, [0, ENTER], [0, 1], { ...clamp, easing: EASE.out });
const q = kept ? 0 : interpolate(local - leave - (i - keepOut) * stagger * 0.55, [0, LEAVE], [0, 1], { ...clamp, easing: EASE.in });
const y = (1 - p) * rise - q * rise * 0.6;
const blur = (1 - p) * 9 + q * 7;
return (
<span
key={i}
style={{
display: 'inline-block',
whiteSpace: 'pre',
opacity: p * (1 - q),
transform: `translateY(${y.toFixed(2)}px)`,
filter: blur > 0.05 ? `blur(${blur.toFixed(2)}px)` : undefined,
}}
>
{char}
</span>
);
})}
</>
);
};
// One section title above the stage's left edge, with an optional app chip.
export type HeadingTiming = {
spec: HeadingSpec;
enter: number;
leave: number;
// Characters shared with the previous / next heading of the section.
keepIn: number;
keepOut: number;
// Section-local frame the next heading takes over (null for the last).
handoff: number | null;
// Rule colour of the previous heading, which this one eases from.
fromColor: string | null;
};
export const Heading: React.FC<{ timing: HeadingTiming; color: string }> = ({ timing, color }) => {
const { spec, enter, leave, keepIn, keepOut, handoff, fromColor } = timing;
const frame = useCurrentFrame();
const local = frame - enter;
const until = handoff ?? leave + LEAVE + 40;
if (local < 0 || frame >= until) return null;
const stay = leave - enter;
const subAt = HEADING.sub;
const rule = fromColor === null ? interpolate(local, [-6, 22], [0, 1], { ...clamp, easing: EASE.out }) : 1;
const ruleOut = handoff === null ? interpolate(local - stay - 8, [0, 18], [0, 1], { ...clamp, easing: EASE.inOut }) : 0;
const ruleColor = fromColor === null ? color : mix(fromColor, color, interpolate(local, [0, 24], [0, 1], { ...clamp, easing: EASE.inOut }));
const chip = interpolate(local - 10, [0, 30], [0, 1], { ...clamp, easing: EASE.out });
const chipOut = interpolate(local - stay, [0, LEAVE], [0, 1], { ...clamp, easing: EASE.in });
const app = spec.app ? appOf(spec.app) : null;
return (
<div style={{ position: 'absolute', left: STAGE.x, top: 28, width: STAGE.w, height: 76 }}>
<div
style={{
position: 'absolute',
left: 0,
top: 6,
width: 4,
height: 64,
borderRadius: 2,
background: ruleColor,
transformOrigin: '50% 0%',
transform: `scaleY(${(rule * (1 - ruleOut)).toFixed(4)})`,
}}
/>
<div
style={{
position: 'absolute',
left: 22,
top: 0,
fontFamily: FONT.sans,
fontWeight: 600,
fontSize: 42,
lineHeight: '48px',
letterSpacing: '0.02em',
color: COLOR.ink,
whiteSpace: 'nowrap',
}}
>
<Kinetic
text={spec.title}
local={local}
leave={stay}
stagger={1.8}
rise={24}
keepIn={keepIn}
keepOut={keepOut}
handoff={handoff === null ? Infinity : handoff - enter}
/>
</div>
{spec.sub ? (
<div
style={{
position: 'absolute',
left: 23,
top: 52,
fontFamily: FONT.sans,
fontWeight: 400,
fontSize: 19,
lineHeight: '24px',
letterSpacing: '0.04em',
color: COLOR.muted,
whiteSpace: 'nowrap',
}}
>
<Kinetic text={spec.sub} local={local - subAt} leave={stay - subAt - 6} stagger={0.55} rise={12} />
</div>
) : null}
{app ? (
<div
style={{
position: 'absolute',
right: 0,
top: 18,
height: 40,
display: 'flex',
alignItems: 'center',
gap: 12,
opacity: chip * (1 - chipOut),
transform: `translateX(${((1 - chip) * 18 - chipOut * 10).toFixed(2)}px)`,
filter: chip < 1 || chipOut > 0 ? `blur(${((1 - chip) * 6 + chipOut * 5).toFixed(2)}px)` : undefined,
}}
>
<Img src={staticFile(`icons/${app.id}.svg`)} style={{ width: 40, height: 40 }} />
<span style={{ fontFamily: FONT.latin, fontWeight: 500, fontSize: 21, letterSpacing: '0.01em', color: COLOR.muted }}>
{app.name}
</span>
</div>
) : null}
</div>
);
};
const shared = (a: string, b: string) => {
const x = Array.from(a);
const y = Array.from(b);
let n = 0;
while (n < x.length && n < y.length && x[n] === y[n]) n++;
// Keep whole words only: stop after the last space of the shared run.
const cut = x.slice(0, n).lastIndexOf(' ');
return n === x.length || n === y.length ? n : cut + 1;
};
// Resolve each heading's frames within a section; `accent` colours the rule.
export const headingTimes = (specs: HeadingSpec[], duration: number, accent: (spec: HeadingSpec) => string): HeadingTiming[] =>
specs.map((spec, i) => {
const enter = spec.at ?? HEADING.in;
const prev = specs[i - 1];
const next = specs[i + 1];
const nextAt = next ? (next.at ?? HEADING.in) : null;
const leave = spec.until ?? (nextAt !== null ? nextAt - LEAVE - 6 : duration - HEADING.out);
return {
spec,
enter,
leave,
keepIn: prev ? shared(prev.title, spec.title) : 0,
keepOut: next ? shared(spec.title, next.title) : 0,
handoff: nextAt,
fromColor: prev ? accent(prev) : null,
};
});
@@ -0,0 +1,108 @@
import { Fragment } from 'react';
import { interpolate, spring, useCurrentFrame, useVideoConfig } from 'remotion';
import { COLOR, EASE, FONT, SPRING, STAGE } from '../theme';
export type KeyCapProps = {
// Keys of one chord, e.g. ['Ctrl', '1'], ['Tab'], ['右键'].
keys: string[];
// Section-local frames: pops in at `from`, gone by `to`.
from: number;
to: number;
// Section-local frames at which the chord is pressed.
press?: number[];
// Centre in composition pixels; default: bottom-right corner of the stage.
x?: number;
y?: number;
};
const MOUSE: Record<string, 'left' | 'right' | 'wheel'> = { 右键: 'right', 左键: 'left', 点击: 'left', 滚轮: 'wheel' };
const clamp = { extrapolateLeft: 'clamp', extrapolateRight: 'clamp' } as const;
const Mouse: React.FC<{ part: 'left' | 'right' | 'wheel'; lit: number }> = ({ part, lit }) => {
const on = `rgba(61,127,229,${(0.55 + 0.45 * lit).toFixed(3)})`;
return (
<svg width="18" height="26" viewBox="0 0 18 26">
<rect x="1" y="1" width="16" height="24" rx="8" fill="none" stroke={COLOR.ink} strokeOpacity="0.85" strokeWidth="1.6" />
{part === 'left' ? <path d="M9 1.8A7.2 7.2 0 0 0 1.8 9V11H9Z" fill={on} /> : null}
{part === 'right' ? <path d="M9 1.8A7.2 7.2 0 0 1 16.2 9V11H9Z" fill={on} /> : null}
<path d="M9 1.8V11M1.8 11H16.2" stroke={COLOR.ink} strokeOpacity="0.5" strokeWidth="1.2" />
<rect x="7.4" y="4.6" width="3.2" height="5" rx="1.6" fill={part === 'wheel' ? on : COLOR.ink} fillOpacity={part === 'wheel' ? 1 : 0.6} />
</svg>
);
};
// A keyboard chord or mouse button that pops in, presses on cue, and leaves.
export const KeyCap: React.FC<KeyCapProps> = ({ keys, from, to, press = [], x, y }) => {
const frame = useCurrentFrame();
const { fps } = useVideoConfig();
if (frame < from || frame >= to) return null;
const pop = spring({ frame: frame - from, fps, config: SPRING, durationInFrames: 24 });
const out = interpolate(frame, [to - 14, to], [0, 1], { ...clamp, easing: EASE.in });
// Down in 4 frames, back up over 12.
const down = press.reduce((acc, at) => {
const t = frame - at;
const v = t < 0 ? 0 : t < 4 ? EASE.out(t / 4) : 1 - EASE.inOut(Math.min(1, (t - 4) / 12));
return Math.max(acc, v);
}, 0);
const anchored = x === undefined || y === undefined;
const blur = (1 - pop) * 5 + out * 4;
return (
<div
style={{
position: 'absolute',
left: x ?? STAGE.x + STAGE.w - 36,
top: y ?? STAGE.y + STAGE.h - 36,
transform: `translate(${anchored ? '-100%, -100%' : '-50%, -50%'}) translateY(${((1 - pop) * 12 + out * 6).toFixed(2)}px) scale(${(0.88 + 0.12 * pop - 0.04 * out).toFixed(4)})`,
transformOrigin: anchored ? '100% 100%' : '50% 50%',
opacity: Math.min(1, pop * 1.4) * (1 - out),
filter: blur > 0.05 ? `blur(${blur.toFixed(2)}px)` : undefined,
display: 'flex',
alignItems: 'center',
gap: 10,
}}
>
{keys.map((key, i) => {
const mouse = MOUSE[key];
return (
<Fragment key={`${key}-${i}`}>
{i > 0 ? (
<span style={{ fontFamily: FONT.latin, fontSize: 22, fontWeight: 400, color: COLOR.faint }}>+</span>
) : null}
<div
style={{
height: 58,
minWidth: 58,
padding: '0 18px',
boxSizing: 'border-box',
borderRadius: 13,
display: 'flex',
alignItems: 'center',
justifyContent: 'center',
gap: 10,
transform: `translateY(${(down * 3).toFixed(2)}px)`,
background: 'linear-gradient(180deg, #3b3b3e 0%, #2d2d30 100%)',
border: '1px solid rgba(255,255,255,0.12)',
boxShadow: [
`0 ${(4 - down * 3).toFixed(2)}px 0 #161618`,
`0 ${(12 - down * 6).toFixed(2)}px 28px rgba(0,0,0,0.5)`,
'inset 0 1px 0 rgba(255,255,255,0.10)',
`0 0 0 ${(down * 2).toFixed(2)}px rgba(61,127,229,${(down * 0.7).toFixed(3)})`,
].join(', '),
fontFamily: FONT.latin,
fontWeight: 600,
fontSize: 23,
letterSpacing: '0.01em',
color: COLOR.ink,
whiteSpace: 'nowrap',
}}
>
{mouse ? <Mouse part={mouse} lit={down} /> : null}
<span style={{ fontFamily: mouse ? FONT.sans : FONT.latin, fontWeight: mouse ? 500 : 600 }}>{key}</span>
</div>
</Fragment>
);
})}
</div>
);
};
@@ -0,0 +1,185 @@
import type { ReactNode } from 'react';
import { AbsoluteFill, Img, staticFile } from 'remotion';
import { ICON, STAGE, STAGE_CENTER } from '../theme';
import type { ShapeId } from './morph';
const lerp = (a: number, b: number, t: number) => a + (b - a) * t;
export const rgba = (hex: string, alpha: number) => {
const n = parseInt(hex.slice(1), 16);
return `rgba(${(n >> 16) & 255},${(n >> 8) & 255},${n & 255},${alpha.toFixed(4)})`;
};
export const mix = (a: string, b: string, t: number) => {
const x = parseInt(a.slice(1), 16);
const y = parseInt(b.slice(1), 16);
const c = (shift: number) => Math.round(lerp((x >> shift) & 255, (y >> shift) & 255, t));
return `#${((c(16) << 16) | (c(8) << 8) | c(0)).toString(16).padStart(6, '0')}`;
};
// The highlighted table cell that the cell-editing section grows out of.
const CellArt: React.FC = () => (
<svg viewBox="0 0 192 192" width="100%" height="100%">
<rect x="16" y="51" width="160" height="90" rx="8" fill="#3E4A5C" />
<path d="M24 51H168A8 8 0 0 1 176 59V69H16V59A8 8 0 0 1 24 51Z" fill="#4E5B70" />
<g stroke="#FFFFFF" strokeOpacity="0.16" strokeWidth="1.2">
<path d="M69.3 51V141M122.7 51V141M16 69H176M16 93H176M16 117H176" />
</g>
<g fill="#FFFFFF" fillOpacity="0.55">
<rect x="24" y="57" width="26" height="6" rx="3" />
<rect x="77" y="57" width="30" height="6" rx="3" />
<rect x="130" y="57" width="22" height="6" rx="3" />
<rect x="24" y="78" width="32" height="6" rx="3" />
<rect x="130" y="78" width="28" height="6" rx="3" />
<rect x="24" y="102" width="22" height="6" rx="3" />
<rect x="130" y="102" width="34" height="6" rx="3" />
<rect x="24" y="126" width="30" height="6" rx="3" />
<rect x="77" y="126" width="24" height="6" rx="3" />
<rect x="130" y="126" width="26" height="6" rx="3" />
</g>
<rect x="77" y="78" width="26" height="6" rx="3" fill="#FFFFFF" fillOpacity="0.55" />
<rect x="68.5" y="92.5" width="55" height="25" rx="2.5" fill="#F2A900" />
<rect x="76" y="102" width="28" height="6" rx="3" fill="#FFFFFF" />
<rect x="107" y="99" width="2.4" height="12" rx="1.2" fill="#FFFFFF" />
</svg>
);
export type Details = { shape: ShapeId; opacity: number };
const Artwork: React.FC<{ details: Details; size: number; cx: number; cy: number }> = ({ details, size, cx, cy }) => {
if (details.shape === 'dot' || details.opacity <= 0.001) return null;
const style: React.CSSProperties = {
position: 'absolute',
left: cx - size / 2,
top: cy - size / 2,
width: size,
height: size,
opacity: details.opacity,
};
if (details.shape === 'cell') {
return (
<div style={style}>
<CellArt />
</div>
);
}
return <Img src={staticFile(`icons/${details.shape}.svg`)} style={style} />;
};
export type ShapeViewProps = {
d: string;
color: string;
// Ambient glow colour (default: `color`).
glowColor?: string;
cx: number;
cy: number;
k: number;
// App-colour wash over the content.
fill: number;
lift: number;
border?: number;
sweep?: number | null;
details?: Details[];
// Multiplier on shadow and glow, for shapes stacked on one another.
presence?: number;
content?: {
node: ReactNode;
opacity: number;
scale: number;
blur: number;
background: string;
};
};
// One morphing shape: glow, shadow, clipped content, colour wash, artwork, edge.
export const ShapeView: React.FC<ShapeViewProps> = ({
d,
color,
glowColor = color,
cx,
cy,
k,
fill,
lift,
border = 0,
sweep = null,
details = [],
presence = 1,
content,
}) => {
const glowW = 400 * k;
const glowH = glowW * lerp(1, 0.62, lift);
const glowAlpha = lerp(0.3, 0.09, lift) * presence;
const shadow = `drop-shadow(0 ${lerp(6, 34, lift).toFixed(2)}px ${lerp(10, 90, lift).toFixed(2)}px rgba(0,0,0,${(lerp(0.42, 0.6, lift) * presence).toFixed(3)}))`;
const size = 192 * ICON.unit * k;
const sweepX = sweep === null ? 0 : STAGE.x - 500 + sweep * (STAGE.w + 1000);
return (
<AbsoluteFill style={{ pointerEvents: 'none' }}>
<div
style={{
position: 'absolute',
left: cx - glowW / 2,
top: cy - glowH / 2 + 24 * lift,
width: glowW,
height: glowH,
background: `radial-gradient(closest-side, ${rgba(glowColor, glowAlpha)}, ${rgba(glowColor, 0)})`,
}}
/>
<AbsoluteFill style={{ filter: shadow }}>
<AbsoluteFill style={{ clipPath: `path('${d}')` }}>
{content && content.opacity > 0.001 ? (
<AbsoluteFill
style={{
opacity: content.opacity,
transform: `scale(${content.scale})`,
transformOrigin: `${STAGE_CENTER.x}px ${STAGE_CENTER.y}px`,
filter: content.blur > 0.05 ? `blur(${content.blur.toFixed(2)}px)` : undefined,
}}
>
<div
style={{
position: 'absolute',
left: STAGE.x,
top: STAGE.y,
width: STAGE.w,
height: STAGE.h,
background: content.background,
overflow: 'hidden',
}}
>
{content.node}
</div>
</AbsoluteFill>
) : null}
{fill > 0.001 ? (
<AbsoluteFill
style={{
// A soft top light that scales with the shape gives the flat colour depth.
background: `radial-gradient(circle at ${cx.toFixed(1)}px ${(cy - 80 * k).toFixed(1)}px, rgba(255,255,255,0.09), rgba(255,255,255,0) ${(230 * k).toFixed(1)}px), ${color}`,
opacity: fill,
}}
/>
) : null}
</AbsoluteFill>
</AbsoluteFill>
{details.map((detail, i) => (
<Artwork key={`${detail.shape}-${i}`} details={detail} size={size} cx={cx} cy={cy} />
))}
{border > 0.001 || sweep !== null ? (
<svg width={1920} height={1080} style={{ position: 'absolute', inset: 0 }}>
<defs>
<linearGradient id="edge-sweep" gradientUnits="userSpaceOnUse" x1={sweepX - 260} y1={0} x2={sweepX + 260} y2={0}>
<stop offset="0" stopColor="#FFFFFF" stopOpacity="0" />
<stop offset="0.5" stopColor="#FFFFFF" stopOpacity="1" />
<stop offset="1" stopColor="#FFFFFF" stopOpacity="0" />
</linearGradient>
</defs>
<path d={d} fill="none" stroke={`rgba(255,255,255,${(0.08 * border).toFixed(4)})`} strokeWidth={1} />
{sweep !== null ? (
<path d={d} fill="none" stroke="url(#edge-sweep)" strokeWidth={1.25} opacity={0.42 * Math.sin(Math.PI * sweep)} />
) : null}
</svg>
) : null}
</AbsoluteFill>
);
};
@@ -0,0 +1,75 @@
import type { ReactNode } from 'react';
import { AbsoluteFill, useCurrentFrame, useVideoConfig } from 'remotion';
import { COLOR, ENTER_END, EXIT_LEN, STAGE, STAGE_CENTER } from '../theme';
import { roundedRectPath } from './geometry';
import { Heading, type HeadingSpec, headingTimes } from './Heading';
import { type MorphState, SHAPES, STAGE_ZOOM, type ShapeId, enterState, exitState, shapePath } from './morph';
import { ShapeView, mix } from './Shape';
export type StageProps = {
// Icon the stage blooms out of on the section's downbeat.
enter?: { from: ShapeId };
// Icon the stage collapses into on the next section's downbeat.
exit?: { to: ShapeId };
heading?: HeadingSpec | HeadingSpec[];
// Panel colour behind the recording.
background?: string;
children?: ReactNode;
};
const OPEN: MorphState = {
s: 1,
k: STAGE_ZOOM,
cx: STAGE_CENTER.x,
cy: STAGE_CENTER.y,
details: 0,
fill: 0,
content: 1,
contentScale: 1,
blur: 0,
lift: 1,
border: 1,
sweep: null,
};
const OPEN_PATH = roundedRectPath(STAGE.x, STAGE.y, STAGE.w, STAGE.h, STAGE.r);
// The framed screen of a footage section. Children are laid out in stage
// coordinates (0..STAGE.w, 0..STAGE.h) and clipped to the stage's shape.
export const Stage: React.FC<StageProps> = ({ enter, exit, heading, background = COLOR.panel, children }) => {
const frame = useCurrentFrame();
const { durationInFrames } = useVideoConfig();
const entering = enter && frame < ENTER_END;
const exiting = exit && frame >= durationInFrames - EXIT_LEN;
const icon: ShapeId | null = entering ? enter.from : exiting ? exit.to : null;
const state = entering ? enterState(frame) : exiting ? exitState(frame, durationInFrames) : OPEN;
const d = icon === null ? OPEN_PATH : shapePath(icon, 'stage', state.s, state.k, state.cx, state.cy);
const openColor = SHAPES[enter?.from ?? exit?.to ?? 'dot'].color;
const color = icon === null ? openColor : SHAPES[icon].color;
// The open stage glows in its own app's colour; closing hands over gradually.
const glowColor = exiting ? mix(openColor, color, 1 - state.lift) : color;
const sectionAccent = SHAPES[enter?.from ?? exit?.to ?? 'dot'].accent;
const accent = (spec: HeadingSpec) => (spec.app ? SHAPES[spec.app].accent : sectionAccent);
const headings = heading === undefined ? [] : headingTimes(Array.isArray(heading) ? heading : [heading], durationInFrames, accent);
return (
<AbsoluteFill>
<ShapeView
d={d}
color={color}
glowColor={glowColor}
cx={state.cx}
cy={state.cy}
k={state.k}
fill={state.fill}
lift={state.lift}
border={state.border}
sweep={state.sweep}
details={icon === null ? [] : [{ shape: icon, opacity: state.details }]}
content={{ node: children, opacity: state.content, scale: state.contentScale, blur: state.blur, background }}
/>
{headings.map((timing) => (
<Heading key={`${timing.spec.title}-${timing.enter}`} timing={timing} color={accent(timing.spec)} />
))}
</AbsoluteFill>
);
};
@@ -0,0 +1,20 @@
import { cancelRender, continueRender, delayRender, staticFile } from 'remotion';
const FACES = [
{ family: 'Noto Sans SC', file: 'fonts/NotoSansSC.ttf', weight: '100 900' },
{ family: 'Inter', file: 'fonts/Inter.ttf', weight: '100 900' },
{ family: 'JetBrains Mono', file: 'fonts/JetBrainsMono.ttf', weight: '100 800' },
];
const handle = delayRender('Loading fonts', { timeoutInMilliseconds: 120000 });
Promise.all(
FACES.map(async ({ family, file, weight }) => {
const face = new FontFace(family, `url(${staticFile(file)}) format("truetype")`, { weight });
await face.load();
document.fonts.add(face);
}),
).then(
() => continueRender(handle),
(error: unknown) => cancelRender(error),
);
@@ -0,0 +1,186 @@
export type Point = [number, number];
const TAU = Math.PI * 2;
// Quarter (or any) arc sampled in y-down screen space; angles increase clockwise.
export const arc = (cx: number, cy: number, r: number, from: number, to: number, steps: number): Point[] => {
const out: Point[] = [];
for (let i = 0; i <= steps; i++) {
const a = from + ((to - from) * i) / steps;
out.push([cx + r * Math.cos(a), cy + r * Math.sin(a)]);
}
return out;
};
export const roundedRect = (x: number, y: number, w: number, h: number, r: number, steps = 10): Point[] => [
...arc(x + w - r, y + r, r, -TAU / 4, 0, steps),
...arc(x + w - r, y + h - r, r, 0, TAU / 4, steps),
...arc(x + r, y + h - r, r, TAU / 4, TAU / 2, steps),
...arc(x + r, y + r, r, TAU / 2, (TAU * 3) / 4, steps),
];
export const circle = (r: number, steps = 96): Point[] =>
Array.from({ length: steps }, (_, i): Point => [r * Math.cos((TAU * i) / steps - TAU / 4), r * Math.sin((TAU * i) / steps - TAU / 4)]);
// Exact rounded rectangle as an SVG path (arcs), for the open stage.
export const roundedRectPath = (x: number, y: number, w: number, h: number, r: number) =>
`M${x + r} ${y}H${x + w - r}A${r} ${r} 0 0 1 ${x + w} ${y + r}V${y + h - r}A${r} ${r} 0 0 1 ${x + w - r} ${y + h}` +
`H${x + r}A${r} ${r} 0 0 1 ${x} ${y + h - r}V${y + r}A${r} ${r} 0 0 1 ${x + r} ${y}Z`;
export const toPath = (points: Point[], scale: number, cx: number, cy: number) => {
let d = '';
for (let i = 0; i < points.length; i++) {
const [x, y] = points[i];
d += `${i === 0 ? 'M' : 'L'}${(cx + x * scale).toFixed(2)} ${(cy + y * scale).toFixed(2)}`;
}
return `${d}Z`;
};
// ---- Signed-distance silhouettes ------------------------------------------
export type Sdf = (x: number, y: number) => number;
export const sdfCircle = (cx: number, cy: number, r: number): Sdf => (x, y) => Math.hypot(x - cx, y - cy) - r;
export const sdfCapsule = (ax: number, ay: number, bx: number, by: number, r: number): Sdf => {
const dx = bx - ax;
const dy = by - ay;
const len2 = dx * dx + dy * dy;
return (x, y) => {
const t = Math.max(0, Math.min(1, ((x - ax) * dx + (y - ay) * dy) / len2));
return Math.hypot(x - ax - t * dx, y - ay - t * dy) - r;
};
};
export const sdfRoundedBox = (x: number, y: number, w: number, h: number, r: number): Sdf => {
const cx = x + w / 2;
const cy = y + h / 2;
return (px, py) => {
const qx = Math.abs(px - cx) - w / 2 + r;
const qy = Math.abs(py - cy) - h / 2 + r;
return Math.hypot(Math.max(qx, 0), Math.max(qy, 0)) + Math.min(Math.max(qx, qy), 0) - r;
};
};
// A cubic Bézier stroke as a chain of capsules.
export const sdfCubicStroke = (p: [Point, Point, Point, Point], r: number, segments = 32): Sdf => {
const at = (t: number): Point => {
const u = 1 - t;
return [
u * u * u * p[0][0] + 3 * u * u * t * p[1][0] + 3 * u * t * t * p[2][0] + t * t * t * p[3][0],
u * u * u * p[0][1] + 3 * u * u * t * p[1][1] + 3 * u * t * t * p[2][1] + t * t * t * p[3][1],
];
};
const parts: Sdf[] = [];
for (let i = 0; i < segments; i++) {
const a = at(i / segments);
const b = at((i + 1) / segments);
parts.push(sdfCapsule(a[0], a[1], b[0], b[1], r));
}
return union(parts);
};
export const union = (parts: Sdf[]): Sdf => (x, y) => {
let d = Infinity;
for (const part of parts) d = Math.min(d, part(x, y));
return d;
};
// Marching squares on the zero level set; returns the longest closed loop.
export const contour = (sdf: Sdf, x0: number, y0: number, x1: number, y1: number, step: number): Point[] => {
const nx = Math.ceil((x1 - x0) / step) + 1;
const ny = Math.ceil((y1 - y0) / step) + 1;
const v = new Float64Array(nx * ny);
for (let j = 0; j < ny; j++) for (let i = 0; i < nx; i++) v[j * nx + i] = sdf(x0 + i * step, y0 + j * step);
const at = (i: number, j: number) => v[j * nx + i];
const points = new Map<string, Point>();
const links = new Map<string, string[]>();
const edgePoint = (key: string, ax: number, ay: number, bx: number, by: number, va: number, vb: number) => {
if (!points.has(key)) {
const t = va / (va - vb);
points.set(key, [x0 + (ax + (bx - ax) * t) * step, y0 + (ay + (by - ay) * t) * step]);
}
return key;
};
const link = (a: string, b: string) => {
links.set(a, [...(links.get(a) ?? []), b]);
links.set(b, [...(links.get(b) ?? []), a]);
};
for (let j = 0; j < ny - 1; j++) {
for (let i = 0; i < nx - 1; i++) {
const a = at(i, j);
const b = at(i + 1, j);
const c = at(i + 1, j + 1);
const d = at(i, j + 1);
const top = a < 0 !== b < 0 ? edgePoint(`h${i},${j}`, i, j, i + 1, j, a, b) : null;
const right = b < 0 !== c < 0 ? edgePoint(`v${i + 1},${j}`, i + 1, j, i + 1, j + 1, b, c) : null;
const bottom = d < 0 !== c < 0 ? edgePoint(`h${i},${j + 1}`, i, j + 1, i + 1, j + 1, d, c) : null;
const left = a < 0 !== d < 0 ? edgePoint(`v${i},${j}`, i, j, i, j + 1, a, d) : null;
const crossed = [top, right, bottom, left].filter((e): e is string => e !== null);
if (crossed.length === 2) link(crossed[0], crossed[1]);
else if (crossed.length === 4) {
const centreInside = (a + b + c + d) / 4 < 0;
const aInside = a < 0;
if (aInside === centreInside) {
link(top!, right!);
link(bottom!, left!);
} else {
link(top!, left!);
link(right!, bottom!);
}
}
}
}
const seen = new Set<string>();
let best: Point[] = [];
for (const start of links.keys()) {
if (seen.has(start)) continue;
const loop: Point[] = [];
let prev = '';
let cur = start;
while (!seen.has(cur)) {
seen.add(cur);
loop.push(points.get(cur)!);
const next = links.get(cur)!.find((n) => n !== prev && !seen.has(n));
if (!next) break;
prev = cur;
cur = next;
}
if (loop.length > best.length) best = loop;
}
return simplify(best, step * 0.12);
};
// Ramer–Douglas–Peucker on a closed ring.
const simplify = (ring: Point[], tolerance: number): Point[] => {
const keep = new Uint8Array(ring.length);
const walk = (a: number, b: number) => {
let worst = -1;
let dist = tolerance;
const [ax, ay] = ring[a];
const [bx, by] = ring[b];
const len = Math.hypot(bx - ax, by - ay) || 1;
for (let i = a + 1; i < b; i++) {
const d = Math.abs((bx - ax) * (ay - ring[i][1]) - (ax - ring[i][0]) * (by - ay)) / len;
if (d > dist) {
dist = d;
worst = i;
}
}
if (worst >= 0) {
keep[worst] = 1;
walk(a, worst);
walk(worst, b);
}
};
const half = Math.floor(ring.length / 2);
keep[0] = 1;
keep[half] = 1;
walk(0, half);
walk(half, ring.length - 1);
keep[ring.length - 1] = 1;
return ring.filter((_, i) => keep[i] === 1);
};
+259
View File
@@ -0,0 +1,259 @@
import { interpolate as flubber } from 'flubber';
import { interpolate } from 'remotion';
import { type AppId, EASE, ICON, MORPH, STAGE, STAGE_CENTER } from '../theme';
import {
type Point,
circle,
contour,
roundedRect,
sdfCapsule,
sdfCircle,
sdfCubicStroke,
sdfRoundedBox,
toPath,
union,
arc,
} from './geometry';
export type ShapeId = AppId | 'dot' | 'cell';
// Silhouettes in Papirus grid units, centred on the grid centre (96, 96).
const centre = (points: Point[]): Point[] => points.map(([x, y]) => [x - 96, y - 96]);
const Q = Math.PI / 2;
const page = centre([
[40, 16],
[112, 16],
[160, 64],
...arc(152, 168, 8, 0, Q, 8),
...arc(40, 168, 8, Q, 2 * Q, 8),
...arc(40, 24, 8, 2 * Q, 3 * Q, 8),
]);
const board = centre(
contour(
union([sdfRoundedBox(16, 28, 160, 112, 10), sdfCapsule(96, 136, 64, 176, 6), sdfCapsule(96, 136, 128, 176, 6)]),
0,
0,
192,
192,
0.5,
),
);
const branch = centre(
contour(
union([
sdfCapsule(64, 44, 64, 148, 10),
sdfCubicStroke(
[
[64, 128],
[64, 92],
[128, 104],
[128, 72],
],
10,
),
sdfCircle(64, 40, 24),
sdfCircle(128, 64, 24),
sdfCircle(64, 152, 24),
]),
0,
0,
192,
192,
0.5,
),
);
// `color` fills the silhouette; `accent` marks the section heading.
export const SHAPES: Record<ShapeId, { points: Point[]; color: string; accent: string }> = {
'ely-doc': { points: page, color: '#3D7FE5', accent: '#3D7FE5' },
'ely-table': { points: page, color: '#2E9E5B', accent: '#2E9E5B' },
'ely-pdf': { points: page, color: '#E0344F', accent: '#E0344F' },
'ely-show': { points: board, color: '#F07B2A', accent: '#F07B2A' },
'ely-tree': { points: branch, color: '#7E57C2', accent: '#7E57C2' },
'ely-mark': { points: centre(roundedRect(28, 24, 136, 152, 10)), color: '#3E4A5C', accent: '#F2A900' },
cell: { points: centre(roundedRect(16, 51, 160, 90, 8)), color: '#3E4A5C', accent: '#F2A900' },
dot: { points: circle(15), color: '#3D7FE5', accent: '#3D7FE5' },
};
// The open stage, shrunk to icon size so shape and size can morph separately.
const PROXY_W = 168;
const PROXY_H = (PROXY_W * STAGE.h) / STAGE.w;
const PROXY_R = (STAGE.r * PROXY_W) / STAGE.w;
const proxy = roundedRect(-PROXY_W / 2, -PROXY_H / 2, PROXY_W, PROXY_H, PROXY_R, 10);
// Zoom at which the proxy is exactly the stage.
export const STAGE_ZOOM = STAGE.w / (PROXY_W * ICON.unit);
// Rings are resampled into four runs between corresponding anchors (the
// shape's outer corners), so corners travel to corners and nothing shears.
const RUN = 128;
const ANCHORS: Partial<Record<ShapeId, Point[]>> = {
// The board's corners, not the stand's feet.
'ely-show': centre([
[16, 28],
[176, 28],
[176, 140],
[16, 140],
]),
};
const resample = (line: Point[], count: number): Point[] => {
const lengths = [0];
for (let i = 1; i < line.length; i++) lengths.push(lengths[i - 1] + Math.hypot(line[i][0] - line[i - 1][0], line[i][1] - line[i - 1][1]));
const total = lengths[lengths.length - 1];
const out: Point[] = [];
let j = 1;
for (let i = 0; i < count; i++) {
const at = (total * i) / count;
while (j < line.length - 1 && lengths[j] < at) j++;
const span = lengths[j] - lengths[j - 1] || 1;
const u = (at - lengths[j - 1]) / span;
out.push([line[j - 1][0] + (line[j][0] - line[j - 1][0]) * u, line[j - 1][1] + (line[j][1] - line[j - 1][1]) * u]);
}
return out;
};
const prepared = new Map<string, Point[]>();
const prepare = (id: ShapeId | 'stage'): Point[] => {
const found = prepared.get(id);
if (found) return found;
let ring = id === 'stage' ? proxy : SHAPES[id].points;
let area = 0;
for (let i = 0; i < ring.length; i++) {
const [ax, ay] = ring[i];
const [bx, by] = ring[(i + 1) % ring.length];
area += ax * by - bx * ay;
}
// Clockwise on screen.
if (area < 0) ring = [...ring].reverse();
const xs = ring.map((p) => p[0]);
const ys = ring.map((p) => p[1]);
const [x0, x1, y0, y1] = [Math.min(...xs), Math.max(...xs), Math.min(...ys), Math.max(...ys)];
const anchors = (id !== 'stage' && ANCHORS[id]) || [
[x0, y0],
[x1, y0],
[x1, y1],
[x0, y1],
];
const nearest = ([ax, ay]: Point) => ring.reduce((best, p, i) => (Math.hypot(p[0] - ax, p[1] - ay) < Math.hypot(ring[best][0] - ax, ring[best][1] - ay) ? i : best), 0);
const first = nearest(anchors[0]);
ring = [...ring.slice(first), ...ring.slice(0, first)];
const cuts = [0, ...anchors.slice(1).map(nearest), ring.length];
if (!cuts.every((c, i) => i === 0 || c > cuts[i - 1])) throw new Error(`Anchors of ${id} are out of order`);
const out: Point[] = [];
for (let k = 0; k < 4; k++) out.push(...resample([...ring.slice(cuts[k], cuts[k + 1]), ring[cuts[k + 1] % ring.length]], RUN));
prepared.set(id, out);
return out;
};
type Ring = (t: number) => Point[];
const cache = new Map<string, Ring>();
const ring = (from: ShapeId | 'stage', to: ShapeId | 'stage'): Ring => {
const key = `${from}>${to}`;
let found = cache.get(key);
if (!found) {
// Equal, aligned rings: flubber neither bisects nor needs to rotate them.
found = flubber(prepare(from), prepare(to), { string: false, maxSegmentLength: 0 });
cache.set(key, found);
}
return found;
};
// Path of `from` turned `t` of the way into `to`, drawn at zoom `k` around (cx, cy).
export const shapePath = (from: ShapeId | 'stage', to: ShapeId | 'stage', t: number, k: number, cx: number, cy: number) => {
const points = from === to ? prepare(from) : ring(from, to)(t);
return toPath(points, ICON.unit * k, cx, cy);
};
// ---- Boundary choreography ------------------------------------------------
export type MorphState = {
// 0: icon silhouette, 1: stage rectangle.
s: number;
// Zoom of the shape (1 = icon size, STAGE_ZOOM = stage size).
k: number;
cx: number;
cy: number;
// Opacity of the full-colour icon artwork over the silhouette.
details: number;
// Opacity of the app-colour wash over the stage content.
fill: number;
content: number;
contentScale: number;
blur: number;
// 0: icon shadow, 1: stage shadow.
lift: number;
border: number;
// 0..1 travel of the light sweep along the stage edge; null when idle.
sweep: number | null;
};
const clamp = (v: number) => Math.min(1, Math.max(0, v));
const smooth = (v: number, a: number, b: number) => {
const x = clamp((v - a) / (b - a));
return x * x * (3 - 2 * x);
};
const lerp = (a: number, b: number, t: number) => a + (b - a) * t;
// The downbeat swell: the icon breathes in on the cut.
export const boundaryPulse = (d: number) => 0.04 * Math.exp(-((d / 6.5) ** 2));
// Icon resting on a cut, `d` frames from it (negative: before it).
export const restState = (d: number): MorphState => ({
s: 0,
k: 1 + boundaryPulse(d),
cx: ICON.x,
cy: ICON.y,
details: 1 - smooth(Math.abs(d), 10, MORPH.hold),
fill: 1,
content: 0,
contentScale: 0.72,
blur: 14,
lift: 0,
border: 0,
sweep: null,
});
// `o` is how open the stage is (0 icon, 1 stage), in each direction's own time.
const openState = (shape: number, zoom: number, o: number, sweep: number | null): MorphState => ({
s: shape,
k: Math.exp(Math.log(STAGE_ZOOM) * zoom),
cx: lerp(ICON.x, STAGE_CENTER.x, zoom),
cy: lerp(ICON.y, STAGE_CENTER.y, zoom),
details: 0,
fill: 1 - smooth(o, 0.32, 0.82),
content: smooth(o, 0.22, 0.7),
contentScale: lerp(0.72, 1, EASE.out(o)),
blur: 14 * (1 - o) ** 2,
lift: o,
border: smooth(o, 0.8, 1),
sweep,
});
// Section-local frame `f` of an entering stage.
export const enterState = (f: number): MorphState => {
if (f < MORPH.hold) return restState(f);
const o = clamp((f - MORPH.hold) / MORPH.morph);
const shape = EASE.inOut(clamp(o / 0.6));
const zoom = EASE.bloom(o);
const sweep = o > 0.55 ? clamp((o - 0.55) / 0.45) : null;
return openState(shape, zoom, zoom, sweep);
};
// Section-local frame `f` of a stage in a section `duration` frames long.
export const exitState = (f: number, duration: number): MorphState => {
const d = f - duration;
if (d >= -MORPH.hold) return restState(d);
const q = clamp((d + MORPH.hold + MORPH.morph) / MORPH.morph);
const zoom = 1 - EASE.land(q);
const shape = 1 - EASE.inOut(clamp((q - 0.22) / 0.78));
return openState(shape, zoom, zoom, null);
};
export const isOpen = (state: MorphState) => state.s >= 1 && state.k >= STAGE_ZOOM - 1e-6;
export const fade = (f: number, from: number, to: number, ease = EASE.out) =>
interpolate(f, [from, to], [0, 1], { extrapolateLeft: 'clamp', extrapolateRight: 'clamp', easing: ease });
+9
View File
@@ -0,0 +1,9 @@
declare module 'flubber' {
type Point = [number, number];
type Shape = string | Point[];
interface Options {
maxSegmentLength?: number;
}
export function interpolate(from: Shape, to: Shape, options: Options & { string: false }): (t: number) => Point[];
export function interpolate(from: Shape, to: Shape, options?: Options & { string?: true }): (t: number) => string;
}
@@ -0,0 +1,100 @@
import React from 'react';
import { AbsoluteFill, interpolate, OffthreadVideo, Sequence, staticFile, useCurrentFrame } from 'remotion';
import { EASE, FOOTAGE, FPS, STAGE } from '../theme';
import { Cursor } from './Cursor';
import type { TakeName } from './take';
/** A stretch of one take: footage seconds `from` to `to`. */
export type Cut = { take: TakeName; from: number; to: number; rate?: number; fade?: number };
/** A camera key at section frame `f`: zoom and the footage point in the middle. */
export type Shot = { f: number; z: number; x: number; y: number };
export type Placed = Cut & { start: number; length: number };
/** Each cut's section frames; a cut's fade overlaps the one before. */
export const lay = (cuts: Cut[], first = 0): Placed[] => {
let at = first;
return cuts.map((cut, i) => {
const length = Math.round(((cut.to - cut.from) * FPS) / (cut.rate ?? 1));
const start = i === 0 ? at : at - (cut.fade ?? 0);
at = start + length;
return { ...cut, start, length };
});
};
/** Footage time a placed cut shows at section frame `f`. */
export const sourceAt = (cut: Placed, f: number) => cut.from + ((f - cut.start) * (cut.rate ?? 1)) / FPS;
const camera = (shots: Shot[], f: number) => {
if (f <= shots[0].f) return shots[0];
const last = shots[shots.length - 1];
if (f >= last.f) return last;
const i = shots.findIndex((s, k) => k > 0 && s.f > f);
const a = shots[i - 1];
const b = shots[i];
const k = EASE.inOut((f - a.f) / (b.f - a.f));
return { f, z: a.z + (b.z - a.z) * k, x: a.x + (b.x - a.x) * k, y: a.y + (b.y - a.y) * k };
};
/** Footage pixels to stage pixels, under the camera at frame `f`. */
export const viewOf = (shots: Shot[], f: number) => {
const c = camera(shots, f);
const k = FOOTAGE.scale * c.z;
const vw = FOOTAGE.w / c.z;
const vh = FOOTAGE.h / c.z;
const left = Math.min(Math.max(c.x - vw / 2, 0), FOOTAGE.w - vw);
const top = Math.min(Math.max(c.y - vh / 2, 0), FOOTAGE.h - vh);
return { k, left, top, z: c.z };
};
type Props = {
cuts: Cut[];
shots: Shot[];
/** Footage-space overlays for a cut at footage time `t`. */
overlay?: (cut: Placed, t: number, f: number) => React.ReactNode;
};
/** Recorded takes on the stage, with the drawn pointer and a directed camera. */
export const Clip: React.FC<Props> = ({ cuts, shots, overlay }) => {
const f = useCurrentFrame();
const view = viewOf(shots, f);
const placed = lay(cuts);
return (
<AbsoluteFill style={{ width: STAGE.w, height: STAGE.h, overflow: 'hidden', background: '#202020' }}>
{placed.map((cut, i) => {
const fade = i === 0 ? 0 : cut.fade ?? 0;
const opacity = fade ? interpolate(f, [cut.start, cut.start + fade], [0, 1], { extrapolateLeft: 'clamp', extrapolateRight: 'clamp', easing: EASE.inOut }) : 1;
const next = placed[i + 1];
const end = next ? next.start + (next.fade ?? 0) : cut.start + cut.length;
if (f < cut.start || f >= end) return null;
const t = sourceAt(cut, f);
return (
<AbsoluteFill key={i} style={{ opacity }}>
<div
style={{
position: 'absolute',
width: FOOTAGE.w,
height: FOOTAGE.h,
transformOrigin: '0 0',
transform: `scale(${view.k}) translate(${-view.left}px, ${-view.top}px)`,
}}
>
<Sequence from={cut.start} durationInFrames={end - cut.start} layout="none">
<OffthreadVideo
src={staticFile(`footage/${cut.take}.mp4`)}
trimBefore={Math.round(cut.from * FPS)}
playbackRate={cut.rate ?? 1}
muted
style={{ width: FOOTAGE.w, height: FOOTAGE.h, display: 'block' }}
/>
</Sequence>
{overlay?.(cut, t, f)}
<Cursor take={cut.take} t={t} zoom={view.z} />
</div>
</AbsoluteFill>
);
})}
</AbsoluteFill>
);
};
@@ -0,0 +1,70 @@
import React from 'react';
import { interpolate } from 'remotion';
import { COLOR, EASE } from '../theme';
import { actions, pointerAt, type TakeName } from './take';
const RIPPLE = 0.55;
const RIGHT = '#F2A900';
/** The pointer, drawn from the input log; presses ripple. */
export const Cursor: React.FC<{ take: TakeName; t: number; zoom: number }> = ({ take, t, zoom }) => {
const p = pointerAt(take, t);
const downs = actions(take, 'down');
const ups = actions(take, 'up');
const held = downs.some((d) => {
const up = ups.find((u) => u.t >= d.t);
return t >= d.t && t <= (up ? up.t : d.t) + 0.06;
});
// Larger under zoom, but less than the footage grows.
const size = 44 / Math.sqrt(zoom);
const press = held ? 0.86 : 1;
return (
<>
{downs
.filter((d) => t >= d.t && t < d.t + RIPPLE)
.map((d) => {
const k = (t - d.t) / RIPPLE;
const r = interpolate(k, [0, 1], [8, 46], { easing: EASE.out }) / Math.sqrt(zoom);
const tint = d.right ? RIGHT : COLOR.accent;
return (
<div
key={d.t}
style={{
position: 'absolute',
left: d.x! - r,
top: d.y! - r,
width: r * 2,
height: r * 2,
borderRadius: '50%',
border: `${3 / Math.sqrt(zoom)}px solid ${tint}`,
background: `${tint}22`,
opacity: 1 - k,
}}
/>
);
})}
<svg
width={size}
height={size * 1.5}
viewBox="0 0 24 36"
style={{
position: 'absolute',
left: p.x - size * 0.06,
top: p.y - size * 0.04,
transformOrigin: '0 0',
transform: `scale(${press})`,
filter: 'drop-shadow(0 3px 5px rgba(0,0,0,0.45))',
overflow: 'visible',
}}
>
<path
d="M1.5 1.5 L1.5 27 L7.6 21.4 L11.6 30.6 L15.6 28.9 L11.7 19.9 L19.8 19.9 Z"
fill="#fff"
stroke="#111"
strokeWidth={1.6}
strokeLinejoin="round"
/>
</svg>
</>
);
};
@@ -0,0 +1,42 @@
import React from 'react';
import { Audio, Sequence, staticFile } from 'remotion';
import { FPS } from '../theme';
import { lay, type Cut } from './Clip';
import { TAKES } from './take';
const SOUND: Record<string, { file: string; volume: number } | undefined> = {
down: { file: 'click', volume: 0.55 },
right: { file: 'menu', volume: 0.6 },
key: { file: 'key', volume: 0.5 },
char: { file: 'key', volume: 0.45 },
wheel: { file: 'tick', volume: 0.18 },
};
/** UI sounds on the logged presses, keys and scrolls of `cuts`. */
export const Sounds: React.FC<{ cuts: Cut[] }> = ({ cuts }) => {
const hits: { frame: number; file: string; volume: number }[] = [];
for (const cut of lay(cuts)) {
for (const e of TAKES[cut.take].events) {
if (e.t < cut.from || e.t >= cut.to) continue;
const sound = SOUND[e.kind === 'down' && e.right ? 'right' : e.kind];
if (!sound) continue;
hits.push({ frame: Math.round(cut.start + ((e.t - cut.from) * FPS) / (cut.rate ?? 1)), ...sound });
}
}
return (
<>
{hits.map((hit, i) => (
<Sequence key={i} from={hit.frame} durationInFrames={60} layout="none">
<Audio src={staticFile(`audio/sfx/${hit.file}.wav`)} volume={hit.volume} />
</Sequence>
))}
</>
);
};
/** Section frame of footage time `t` in `cuts`, for timing overlays. */
export const frameOf = (cuts: Cut[], t: number) => {
const cut = lay(cuts).find((c) => t >= c.from && t < c.to);
if (!cut) throw new Error(`no cut shows footage time ${t}`);
return Math.round(cut.start + ((t - cut.from) * FPS) / (cut.rate ?? 1));
};
@@ -0,0 +1,84 @@
import React from 'react';
import { interpolate } from 'remotion';
import { COLOR, EASE, FONT } from '../theme';
import { pointerAt, TAKES, type TakeName } from './take';
type Props = {
take: TakeName;
t: number;
/** Footage seconds the pointer crosses toward the submenu. */
from: number;
to: number;
/** The row it crosses without opening, as y0..y1, and its note. */
passed: [number, number];
note: string;
};
const clamp = { extrapolateLeft: 'clamp', extrapolateRight: 'clamp' } as const;
/** The safe triangle: pointer to the submenu's near corners, live. */
export const Triangle: React.FC<Props> = ({ take, t, from, to, passed, note }) => {
const menu = TAKES[take].menus;
if (!menu) throw new Error(`${take} has no submenu rectangle`);
const show = interpolate(t, [from - 0.35, from, to + 0.25, to + 0.7], [0, 1, 1, 0], { ...clamp, easing: EASE.inOut });
if (show <= 0) return null;
const p = pointerAt(take, Math.min(t, to + 0.25));
const [x0, y0, , y1] = menu.panel;
const [px0, , px1] = menu.parent;
const drawn = interpolate(t, [from - 0.35, from + 0.1], [0, 1], { ...clamp, easing: EASE.out });
const near = { x: x0 + 2, top: y0 + 6, bottom: y0 + 6 + (y1 - y0 - 12) * drawn };
const row = interpolate(t, [from + 0.15, from + 0.45], [0, 1], { ...clamp, easing: EASE.out });
return (
<div style={{ position: 'absolute', inset: 0, opacity: show, pointerEvents: 'none' }}>
<svg width={2048} height={1152} style={{ position: 'absolute', inset: 0, overflow: 'visible' }}>
<defs>
<linearGradient id="safe" x1="0" x2="1" y1="0" y2="0">
<stop offset="0" stopColor={COLOR.accent} stopOpacity={0.05} />
<stop offset="1" stopColor={COLOR.accent} stopOpacity={0.3} />
</linearGradient>
</defs>
<path
d={`M ${p.x} ${p.y} L ${near.x} ${near.top} L ${near.x} ${near.bottom} Z`}
fill="url(#safe)"
stroke={COLOR.accent}
strokeWidth={2.5}
strokeLinejoin="round"
strokeDasharray="10 7"
/>
<circle cx={p.x} cy={p.y} r={7} fill={COLOR.accent} />
<rect
x={px0 + 6}
y={passed[0]}
width={(px1 - px0 - 12) * row}
height={passed[1] - passed[0]}
rx={8}
fill="none"
stroke="#F2A900"
strokeWidth={2.5}
opacity={0.9}
/>
</svg>
<div
style={{
position: 'absolute',
right: 2048 - px0 + 22,
top: (passed[0] + passed[1]) / 2 - 24,
opacity: row,
transform: `translateX(${(1 - row) * 16}px)`,
padding: '8px 16px',
borderRadius: 12,
background: 'rgba(28,28,30,0.92)',
border: '1.5px solid #F2A90088',
color: '#F7E2A6',
fontFamily: FONT.sans,
fontSize: 26,
fontWeight: 500,
whiteSpace: 'nowrap',
boxShadow: '0 10px 30px rgba(0,0,0,0.45)',
}}
>
{note}
</div>
</div>
);
};
@@ -0,0 +1,31 @@
// Test entry for the footage sections: `remotion still src/footage/preview.tsx <Section> …`.
import { AbsoluteFill, Composition, registerRoot } from 'remotion';
import '../design/fonts';
import { Background } from '../design/Background';
import { Cells } from '../scenes/Cells';
import { Menus } from '../scenes/Menus';
import { More } from '../scenes/More';
import { RightClick } from '../scenes/RightClick';
import { SECTION } from '../theme';
const framed = (Section: React.FC) => () => (
<AbsoluteFill>
<Background />
<Section />
</AbsoluteFill>
);
const ALL = [
['Menus', Menus, SECTION.menus],
['Cells', Cells, SECTION.cells],
['RightClick', RightClick, SECTION.rightClick],
['More', More, SECTION.more],
] as const;
registerRoot(() => (
<>
{ALL.map(([id, Section, at]) => (
<Composition key={id} id={id} component={framed(Section)} width={1920} height={1080} fps={60} durationInFrames={at.duration} />
))}
</>
));
@@ -0,0 +1,62 @@
import cells from '../../public/footage/cells.json';
import doc from '../../public/footage/doc.json';
import menus from '../../public/footage/menus.json';
import more from '../../public/footage/more.json';
import show from '../../public/footage/show.json';
import table from '../../public/footage/table.json';
// Times are footage seconds; positions are footage pixels (2048×1152).
export type Event = {
t: number;
kind: string;
x?: number;
y?: number;
right?: boolean;
key?: string;
ch?: string;
down?: boolean;
};
export type Box = [number, number, number, number];
export type Take = {
fps: number;
size: number[];
events: Event[];
menus: { parent: number[]; panel: number[] } | null;
};
export const TAKES = { menus, cells, doc, table, show, more } as Record<string, Take>;
export type TakeName = 'menus' | 'cells' | 'doc' | 'table' | 'show' | 'more';
const placed = new Map<string, Event[]>();
const pointed = (name: TakeName) => {
let list = placed.get(name);
if (!list) {
list = TAKES[name].events.filter((e) => e.x !== undefined && e.kind !== 'sync');
placed.set(name, list);
}
return list;
};
/** Where the pointer was at footage time `t`. */
export const pointerAt = (name: TakeName, t: number) => {
const list = pointed(name);
let lo = 0;
let hi = list.length - 1;
if (t <= list[0].t) return { x: list[0].x!, y: list[0].y! };
if (t >= list[hi].t) return { x: list[hi].x!, y: list[hi].y! };
while (hi - lo > 1) {
const mid = (lo + hi) >> 1;
if (list[mid].t <= t) lo = mid;
else hi = mid;
}
const a = list[lo];
const b = list[hi];
const f = b.t === a.t ? 1 : (t - a.t) / (b.t - a.t);
return { x: a.x! + (b.x! - a.x!) * f, y: a.y! + (b.y! - a.y!) * f };
};
/** Events of `kinds` in the take, in order. */
export const actions = (name: TakeName, ...kinds: string[]) =>
TAKES[name].events.filter((e) => kinds.includes(e.kind));
+4
View File
@@ -0,0 +1,4 @@
import { registerRoot } from 'remotion';
import { Root } from './Root';
registerRoot(Root);
@@ -0,0 +1,121 @@
import { cancelRender, continueRender, delayRender, interpolate, staticFile, useCurrentFrame } from 'remotion';
import { COLOR, EASE, FONT } from '../theme';
// The 'before' card mixes faces, as Windows did.
const serif = delayRender('Loading Noto Serif SC', { timeoutInMilliseconds: 120000 });
new FontFace('Noto Serif SC', `url(${staticFile('fonts/NotoSerifSC.ttf')}) format("truetype")`, { weight: '200 900' })
.load()
.then((face) => {
document.fonts.add(face);
continueRender(serif);
}, cancelRender);
const clamp = { extrapolateLeft: 'clamp', extrapolateRight: 'clamp' } as const;
const BEAT = 37.5;
const Card: React.FC<{ at: number; x: number; title: string; sub: string; children: React.ReactNode }> = ({ at, x, title, sub, children }) => {
const f = useCurrentFrame();
const p = interpolate(f, [at, at + 34], [0, 1], { ...clamp, easing: EASE.out });
return (
<div
style={{
position: 'absolute',
left: x,
top: 150,
width: 700,
height: 640,
borderRadius: 28,
background: 'linear-gradient(180deg, rgba(255,255,255,0.055), rgba(255,255,255,0.02))',
border: `1px solid ${COLOR.hairline}`,
boxShadow: '0 30px 80px rgba(0,0,0,0.35)',
opacity: p,
transform: `translateY(${(1 - p) * 40}px) scale(${0.96 + 0.04 * p})`,
overflow: 'hidden',
}}
>
<div style={{ position: 'absolute', inset: '0 0 190px 0' }}>{children}</div>
<div style={{ position: 'absolute', left: 48, right: 48, bottom: 56 }}>
<div style={{ fontFamily: FONT.sans, fontSize: 40, fontWeight: 600, color: COLOR.ink, letterSpacing: '0.02em' }}>{title}</div>
<div style={{ fontFamily: FONT.sans, fontSize: 24, fontWeight: 400, color: COLOR.muted, marginTop: 12, lineHeight: 1.5 }}>{sub}</div>
</div>
</div>
);
};
/** One word in two faces, settling into one. */
const Glyphs: React.FC<{ at: number }> = ({ at }) => {
const f = useCurrentFrame();
const fix = interpolate(f, [at + 2 * BEAT, at + 3.4 * BEAT], [0, 1], { ...clamp, easing: EASE.inOut });
const label = (text: string, on: number) => (
<span style={{ fontFamily: FONT.sans, fontSize: 22, fontWeight: 500, letterSpacing: '0.2em', color: COLOR.faint, opacity: on }}>{text}</span>
);
const word = (style: React.CSSProperties, text: string) => <span style={{ display: 'inline-block', ...style }}>{text}</span>;
return (
<div style={{ position: 'absolute', inset: 0, display: 'flex', flexDirection: 'column', alignItems: 'center', justifyContent: 'center', gap: 26 }}>
<div style={{ position: 'relative', height: 30, width: 200, textAlign: 'center' }}>
<div style={{ position: 'absolute', inset: 0 }}>{label('之前', 1 - fix)}</div>
<div style={{ position: 'absolute', inset: 0 }}>{label('现在', fix)}</div>
</div>
<div style={{ position: 'relative', fontSize: 120, color: COLOR.ink, lineHeight: 1, height: 130 }}>
{word({ fontFamily: FONT.sans, fontVariationSettings: `'wght' ${800 - 300 * fix}`, fontWeight: 800 - 300 * fix }, '打开')}
<span style={{ position: 'relative', display: 'inline-block' }}>
{word({ fontFamily: '"Noto Serif SC"', fontWeight: 300, opacity: 1 - fix, filter: `blur(${fix * 6}px)` }, '仓库')}
{word(
{ position: 'absolute', left: 0, top: 0, fontFamily: FONT.sans, fontWeight: 500, opacity: fix, filter: `blur(${(1 - fix) * 6}px)` },
'仓库',
)}
</span>
</div>
<div style={{ height: 6, width: 360 * fix, borderRadius: 3, background: COLOR.accent, opacity: 0.9 }} />
</div>
);
};
/** A shield draws itself, then a check. */
const Notarized: React.FC<{ at: number }> = ({ at }) => {
const f = useCurrentFrame();
const shield = interpolate(f, [at + 10, at + 10 + 2 * BEAT], [0, 1], { ...clamp, easing: EASE.inOut });
const check = interpolate(f, [at + 2.4 * BEAT, at + 3.4 * BEAT], [0, 1], { ...clamp, easing: EASE.out });
const glow = interpolate(f, [at + 3 * BEAT, at + 4.2 * BEAT], [0, 1], { ...clamp, easing: EASE.out });
const SHIELD = 'M120 20 L210 52 V128 C210 186 172 228 120 248 C68 228 30 186 30 128 V52 Z';
return (
<div style={{ position: 'absolute', inset: 0, display: 'flex', alignItems: 'center', justifyContent: 'center' }}>
<svg width={260} height={280} viewBox="0 0 240 270" style={{ overflow: 'visible' }}>
<path d={SHIELD} fill={COLOR.accent} opacity={0.14 * glow} />
<path
d={SHIELD}
fill="none"
stroke={COLOR.ink}
strokeWidth={7}
strokeLinejoin="round"
pathLength={1}
strokeDasharray="1 1"
strokeDashoffset={1 - shield}
/>
<path
d="M78 134 L108 164 L166 102"
fill="none"
stroke={COLOR.accent}
strokeWidth={14}
strokeLinecap="round"
strokeLinejoin="round"
pathLength={1}
strokeDasharray="1 1"
strokeDashoffset={1 - check}
/>
</svg>
</div>
);
};
/** The two cards after the footage, in stage coordinates. */
export const Cards: React.FC<{ at: number }> = ({ at }) => (
<>
<Card at={at} x={100} title="中文显示统一" sub="Windows 上同一个词不再一半粗一半细;界面残留的英文改为中文">
<Glyphs at={at} />
</Card>
<Card at={at + BEAT} x={880} title="macOS 已签名并公证" sub="Developer ID 签名、Apple 公证并钉票,打开时不再提示“无法验证开发者”">
<Notarized at={at + BEAT} />
</Card>
</>
);
@@ -0,0 +1,50 @@
import { AbsoluteFill } from 'remotion';
import { Caption } from '../design/Caption';
import { KeyCap } from '../design/KeyCap';
import { Stage } from '../design/Stage';
import { Clip, type Cut, type Shot } from '../footage/Clip';
import { frameOf, Sounds } from '../footage/Sounds';
const CUTS: Cut[] = [{ take: 'cells', from: 3.1, to: 13.1 }];
const SHOTS: Shot[] = [
{ f: 0, z: 1, x: 1024, y: 576 },
{ f: 60, z: 1.25, x: 1190, y: 440 },
{ f: 110, z: 1.75, x: 1190, y: 420 },
{ f: 470, z: 1.75, x: 1190, y: 420 },
{ f: 560, z: 1.2, x: 1200, y: 460 },
];
// One badge per key, held until the next one.
const KEYS: { t: number; keys: string[] }[] = [
{ t: 4.26, keys: ['点击'] },
{ t: 5.73, keys: ['Tab'] },
{ t: 6.88, keys: ['↓'] },
{ t: 7.94, keys: ['End'] },
{ t: 8.29, keys: ['⌫'] },
{ t: 10.63, keys: ['Enter'] },
];
export const Cells: React.FC = () => {
const at = (t: number) => frameOf(CUTS, t);
const backs = [8.29, 8.5, 8.71].map(at);
return (
<AbsoluteFill>
<Stage
enter={{ from: 'cell' }}
exit={{ to: 'ely-doc' }}
heading={{ title: '表格在格内编辑', sub: '点哪格开哪格,Tab 到下一格,回车写回', app: 'ely-mark' }}
>
<Clip cuts={CUTS} shots={SHOTS} />
</Stage>
{KEYS.map((k, i) => {
const from = at(k.t) - 12;
const to = i + 1 < KEYS.length ? at(KEYS[i + 1].t) - 12 : at(k.t) + 70;
return <KeyCap key={k.t} keys={k.keys} from={from} to={Math.min(to, from + 110)} press={k.keys[0] === '⌫' ? backs : [at(k.t)]} />;
})}
<Caption text="格内显示原文:**粗体** 带着记号" from={at(4.5)} to={at(5.6)} />
<Caption text="Tab、方向键在格间移动" from={at(5.9)} to={at(7.8)} />
<Caption text="回车写回,一步撤销" from={at(10.7)} to={at(12.2)} />
<Sounds cuts={CUTS} />
</AbsoluteFill>
);
};
@@ -0,0 +1,175 @@
import { AbsoluteFill, interpolate, useCurrentFrame } from 'remotion';
import { COLOR, EASE, FONT, ICON, SECTION } from '../theme';
import { type ShapeId, SHAPES, boundaryPulse, shapePath } from '../design/morph';
import { ShapeView, type Details, mix, rgba } from '../design/Shape';
// Each icon lands on a beat; the dot breathes for the first two beats.
const STEPS: { shape: ShapeId; land: number; dur: number }[] = [
{ shape: 'ely-doc', land: 75, dur: 30 },
{ shape: 'ely-show', land: 112.5, dur: 24 },
{ shape: 'ely-table', land: 150, dur: 24 },
{ shape: 'ely-tree', land: 187.5, dur: 24 },
{ shape: 'ely-pdf', land: 225, dur: 24 },
{ shape: 'ely-mark', land: 262.5, dur: 24 },
];
const END = SECTION.intro.duration;
const clamp = { extrapolateLeft: 'clamp', extrapolateRight: 'clamp' } as const;
const ramp = (f: number, a: number, b: number, ease = EASE.out) => interpolate(f, [a, b], [0, 1], { ...clamp, easing: ease });
const iconAt = (f: number) => {
// Before the wordmark the icon sits a little higher, at the frame's centre.
const cy = ICON.y - 40 * (1 - ramp(f, 150, 240, EASE.inOut));
const pulse = boundaryPulse(f - END);
const index = STEPS.findLastIndex((s) => f >= s.land - s.dur);
if (index < 0) {
const appear = ramp(f, 4, 38);
const breath = 0.16 * Math.exp(-(((f - 37.5) / 8) ** 2));
const k = Math.max(0.001, appear * (1 + breath));
return { d: shapePath('dot', 'stage', 0, k, ICON.x, cy), color: SHAPES.dot.color, k, cy, details: [] as Details[] };
}
const step = STEPS[index];
const from: ShapeId = index === 0 ? 'dot' : STEPS[index - 1].shape;
const start = step.land - step.dur;
const t = EASE.inOut(Math.min(1, (f - start) / step.dur));
const swell = STEPS.slice(0, -1).reduce((sum, s) => sum + 0.03 * Math.exp(-(((f - s.land) / 6) ** 2)), 0);
const k = (1 - 0.07 * Math.sin(Math.PI * t)) * (1 + swell + pulse);
const d = t >= 1 ? shapePath(step.shape, 'stage', 0, k, ICON.x, cy) : shapePath(from, step.shape, t, k, ICON.x, cy);
const details: Details[] = [
{ shape: from, opacity: 1 - ramp(f, start, start + 6, EASE.inOut) },
{ shape: step.shape, opacity: ramp(f, step.land - 3, step.land + 7, EASE.inOut) },
];
return { d, color: mix(SHAPES[from].color, SHAPES[step.shape].color, t), k, cy, details };
};
const Letters: React.FC<{ text: string; start: number; stagger: number; rise: number; blur: number }> = ({ text, start, stagger, rise, blur }) => {
const f = useCurrentFrame();
return (
<>
{Array.from(text).map((char, i) => {
const p = ramp(f, start + i * stagger, start + i * stagger + 32);
const b = (1 - p) * blur;
return (
<span
key={i}
style={{
display: 'inline-block',
whiteSpace: 'pre',
opacity: p,
transform: `translateY(${((1 - p) * rise).toFixed(2)}px)`,
filter: b > 0.05 ? `blur(${b.toFixed(2)}px)` : undefined,
}}
>
{char}
</span>
);
})}
</>
);
};
const WORD: React.CSSProperties = {
fontFamily: FONT.latin,
fontSize: 92,
lineHeight: '100px',
whiteSpace: 'nowrap',
display: 'flex',
alignItems: 'baseline',
gap: 30,
};
const Wordmark: React.FC<{ reveal: boolean; color?: string }> = ({ reveal, color }) => {
const word = (text: string, start: number) =>
reveal ? <Letters text={text} start={start} stagger={2.2} rise={30} blur={10} /> : text.split('').map((c, i) => <span key={i} style={{ display: 'inline-block', whiteSpace: 'pre' }}>{c}</span>);
return (
<div style={WORD}>
<span style={{ fontWeight: 600, letterSpacing: '-0.025em', color: color ?? '#ECEAE6' }}>{word('Ely Office', 150)}</span>
<span style={{ fontWeight: 300, letterSpacing: '0.01em', color: color ?? COLOR.muted }}>{word('0.1.5', 172)}</span>
</div>
);
};
export const Intro: React.FC = () => {
const f = useCurrentFrame();
const icon = iconAt(f);
const dawn = 1 - ramp(f, 0, 50, EASE.inOut);
const ripple = ramp(f, 37.5, 37.5 + 50);
const leaveWord = ramp(f, 272, 294, EASE.in);
const leaveLine = ramp(f, 264, 286, EASE.in);
const rule = ramp(f, 182, 210) * (1 - ramp(f, 258, 278, EASE.inOut));
const sweep = ramp(f, 216, 262, EASE.inOut);
return (
<AbsoluteFill>
{f < 92 ? (
<svg width={1920} height={1080} style={{ position: 'absolute', inset: 0 }}>
<circle
cx={ICON.x}
cy={icon.cy}
r={20 + 150 * ripple}
fill="none"
stroke={rgba(SHAPES.dot.color, 0.5 * (1 - ripple) * Math.min(1, ripple * 8))}
strokeWidth={1.5}
/>
</svg>
) : null}
<ShapeView d={icon.d} color={icon.color} cx={ICON.x} cy={icon.cy} k={icon.k} fill={1} lift={0} details={icon.details} />
<div
style={{
position: 'absolute',
left: 0,
width: 1920,
top: 232,
display: 'flex',
flexDirection: 'column',
alignItems: 'center',
opacity: 1 - leaveWord,
transform: `translateY(${(-20 * leaveWord).toFixed(2)}px)`,
filter: leaveWord > 0.01 ? `blur(${(8 * leaveWord).toFixed(2)}px)` : undefined,
}}
>
<div style={{ position: 'relative' }}>
<Wordmark reveal />
{sweep > 0 && sweep < 1 ? (
<div
style={{
position: 'absolute',
inset: 0,
opacity: 0.9,
maskImage: 'linear-gradient(100deg, transparent 0%, transparent 44%, black 50%, transparent 56%, transparent 100%)',
maskSize: '320% 100%',
maskRepeat: 'no-repeat',
maskPosition: `${(100 - sweep * 100).toFixed(2)}% 0%`,
}}
>
<Wordmark reveal={false} color="#FFFFFF" />
</div>
) : null}
</div>
</div>
<div style={{ position: 'absolute', left: 960 - 28, top: 354, width: 56, height: 2, borderRadius: 1, background: COLOR.accent, transform: `scaleX(${rule.toFixed(4)})` }} />
<div
style={{
position: 'absolute',
left: 0,
width: 1920,
top: 372,
textAlign: 'center',
fontFamily: FONT.sans,
fontWeight: 300,
fontSize: 31,
lineHeight: '40px',
letterSpacing: '0.34em',
paddingLeft: '0.34em',
boxSizing: 'border-box',
color: '#BDBAB5',
opacity: 1 - leaveLine,
transform: `translateY(${(-12 * leaveLine).toFixed(2)}px)`,
filter: leaveLine > 0.01 ? `blur(${(6 * leaveLine).toFixed(2)}px)` : undefined,
}}
>
<Letters text="更顺手的一次更新" start={192} stagger={3} rise={14} blur={8} />
</div>
{dawn > 0.001 ? <AbsoluteFill style={{ background: '#09090a', opacity: dawn }} /> : null}
</AbsoluteFill>
);
};
@@ -0,0 +1,46 @@
import { AbsoluteFill } from 'remotion';
import { Caption } from '../design/Caption';
import { KeyCap } from '../design/KeyCap';
import { Stage } from '../design/Stage';
import { Clip, type Cut, type Shot } from '../footage/Clip';
import { frameOf, Sounds } from '../footage/Sounds';
import { Triangle } from '../footage/Triangle';
// The crossing over 插入 plays at half speed.
const CROSS = { from: 7.09, to: 8.04 };
const CUTS: Cut[] = [
{ take: 'menus', from: 3.6, to: 7.0 },
{ take: 'menus', from: 7.0, to: 8.15, rate: 0.5 },
{ take: 'menus', from: 8.15, to: 12.45 },
];
const SHOTS: Shot[] = [
{ f: 0, z: 1, x: 1024, y: 576 },
{ f: 40, z: 1.15, x: 1120, y: 560 },
{ f: 115, z: 1.45, x: 1380, y: 720 },
{ f: 355, z: 1.45, x: 1380, y: 720 },
{ f: 420, z: 1.25, x: 1150, y: 600 },
{ f: 560, z: 1, x: 1024, y: 576 },
];
export const Menus: React.FC = () => {
const right = frameOf(CUTS, 4.43);
const cross = frameOf(CUTS, CROSS.from);
return (
<AbsoluteFill>
<Stage
enter={{ from: 'ely-mark' }}
exit={{ to: 'cell' }}
heading={{ title: '二级菜单更好选', sub: '斜着移向子菜单,路过的项不再抢先弹出', app: 'ely-mark' }}
>
<Clip
cuts={CUTS}
shots={SHOTS}
overlay={(_, t) => <Triangle take="menus" t={t} {...CROSS} passed={[654, 696]} note="路过「插入」,不抢走" />}
/>
</Stage>
<KeyCap keys={['右键']} from={right - 20} to={right + 75} press={[right]} />
<Caption text="0.5× · 安全三角:朝子菜单走,三角内的项不切换" from={cross - 30} to={frameOf(CUTS, 8.6)} />
<Sounds cuts={CUTS} />
</AbsoluteFill>
);
};
@@ -0,0 +1,49 @@
import { AbsoluteFill, interpolate, useCurrentFrame } from 'remotion';
import { Caption } from '../design/Caption';
import { KeyCap } from '../design/KeyCap';
import { Stage } from '../design/Stage';
import { Clip, type Cut, type Shot } from '../footage/Clip';
import { frameOf, Sounds } from '../footage/Sounds';
import { EASE } from '../theme';
import { Cards } from './Cards';
const CUTS: Cut[] = [{ take: 'more', from: 2.6, to: 9.0 }];
const SHOTS: Shot[] = [
{ f: 0, z: 1, x: 1024, y: 576 },
{ f: 40, z: 1.4, x: 731, y: 360 },
{ f: 190, z: 1.4, x: 731, y: 360 },
{ f: 240, z: 1.5, x: 683, y: 780 },
{ f: 296, z: 1.5, x: 683, y: 780 },
{ f: 336, z: 1.5, x: 683, y: 384 },
];
// The cards replace the footage from here.
const CARDS = 372;
export const More: React.FC = () => {
const f = useCurrentFrame();
const clear = frameOf(CUTS, 7.38);
const away = interpolate(f, [CARDS - 20, CARDS + 10], [1, 0], { extrapolateLeft: 'clamp', extrapolateRight: 'clamp', easing: EASE.inOut });
return (
<AbsoluteFill>
<Stage
enter={{ from: 'ely-show' }}
exit={{ to: 'dot' }}
heading={[
{ title: '再开文件,进同一个窗口', sub: '应用已开着时,文件直接开成新标签;侧栏可清除最近文件', app: 'ely-mark' },
{ title: '还有', sub: '中文显示统一 · macOS 安装包已公证', at: CARDS },
]}
>
{f < CARDS + 10 ? (
<AbsoluteFill style={{ opacity: away, transform: `scale(${0.97 + 0.03 * away})` }}>
<Clip cuts={CUTS} shots={SHOTS} />
</AbsoluteFill>
) : null}
{f >= CARDS - 20 ? <Cards at={CARDS} /> : null}
</Stage>
<Caption text="第二次打开:交给已开着的那份,开成新标签" from={frameOf(CUTS, 3.4)} to={frameOf(CUTS, 6.7)} />
<KeyCap keys={['点击']} from={clear - 20} to={clear + 60} press={[clear]} />
<Caption text="清除最近文件,重启后仍是空的" from={clear + 10} to={CARDS - 10} />
<Sounds cuts={CUTS} />
</AbsoluteFill>
);
};
@@ -0,0 +1,152 @@
import { AbsoluteFill, interpolate, useCurrentFrame } from 'remotion';
import { APPS, BEAT, COLOR, EASE, FONT, ICON } from '../theme';
import { SHAPES, boundaryPulse, shapePath } from '../design/morph';
import { ShapeView, mix, rgba } from '../design/Shape';
const clamp = { extrapolateLeft: 'clamp', extrapolateRight: 'clamp' } as const;
const ramp = (f: number, a: number, b: number, ease = EASE.out) => interpolate(f, [a, b], [0, 1], { ...clamp, easing: ease });
const lerp = (a: number, b: number, t: number) => a + (b - a) * t;
// Row after the bloom, and the tighter row it gathers into above the wordmark.
const ROW = { gap: 212, y: 470, k: 0.62 };
const GATHER = { gap: 128, y: 384, k: 0.38, at: 5 * BEAT };
const BLOOM = { at: BEAT, every: BEAT / 2, dur: 26 };
const SPLIT = { at: 16, dur: 40 };
const FADE = { from: 390, to: 446 };
const Ring: React.FC<{ start: number; reach: number; width: number }> = ({ start, reach, width }) => {
const f = useCurrentFrame();
const p = ramp(f, start, start + 64);
if (p <= 0 || p >= 1) return null;
return (
<circle
cx={ICON.x}
cy={ICON.y}
r={18 + reach * p}
fill="none"
stroke={rgba(SHAPES.dot.color, 0.55 * (1 - p) * Math.min(1, p * 10))}
strokeWidth={width}
/>
);
};
const AppIcon: React.FC<{ index: number }> = ({ index }) => {
const f = useCurrentFrame();
const app = APPS[index];
const offset = index - (APPS.length - 1) / 2;
const travel = Math.min(1, Math.max(0, (f - SPLIT.at) / SPLIT.dur));
const bloomAt = BLOOM.at + index * BLOOM.every;
const t = EASE.inOut(Math.min(1, Math.max(0, (f - bloomAt) / BLOOM.dur)));
const land = bloomAt + BLOOM.dur;
const gather = ramp(f, GATHER.at + index * 2, GATHER.at + index * 2 + 44, EASE.inOut);
// Split: the dots rise first, then fan out, like a fountain.
// Both start from rest; the rise leads the spread.
const splitX = lerp(ICON.x, ICON.x + offset * ROW.gap, EASE.inOut(Math.max(0, (travel - 0.15) / 0.85)));
const splitY = lerp(ICON.y, ROW.y, EASE.inOut(Math.min(1, travel / 0.7)));
const cx = lerp(splitX, ICON.x + offset * GATHER.gap, gather);
const cy = lerp(splitY, GATHER.y, gather);
const swell = 0.035 * Math.exp(-(((f - land) / 6) ** 2));
const base = lerp(lerp(1 + boundaryPulse(f), ROW.k, EASE.inOut(travel)), GATHER.k, gather);
const k = base * (1 - 0.08 * Math.sin(Math.PI * t)) * (1 + swell);
const d = t >= 1 ? shapePath(app.id, 'stage', 0, k, cx, cy) : shapePath('dot', app.id, t, k, cx, cy);
const color = mix(SHAPES.dot.color, app.color, Math.max(EASE.inOut(travel) * 0.6, t));
return (
<ShapeView
d={d}
color={color}
cx={cx}
cy={cy}
k={k}
fill={1}
lift={0}
presence={lerp(1 / APPS.length, 1, EASE.inOut(travel))}
details={[{ shape: app.id, opacity: ramp(f, land - 4, land + 8, EASE.inOut) }]}
/>
);
};
const Line: React.FC<{ text: string; start: number; stagger: number; style: React.CSSProperties }> = ({ text, start, stagger, style }) => {
const f = useCurrentFrame();
return (
<div style={{ display: 'flex', justifyContent: 'center', whiteSpace: 'nowrap', ...style }}>
{Array.from(text).map((char, i) => {
const p = ramp(f, start + i * stagger, start + i * stagger + 30);
const b = (1 - p) * 8;
return (
<span
key={i}
style={{
display: 'inline-block',
whiteSpace: 'pre',
opacity: p,
transform: `translateY(${((1 - p) * 18).toFixed(2)}px)`,
filter: b > 0.05 ? `blur(${b.toFixed(2)}px)` : undefined,
}}
>
{char}
</span>
);
})}
</div>
);
};
export const Outro: React.FC = () => {
const f = useCurrentFrame();
const fade = 1 - ramp(f, FADE.from, FADE.to, EASE.inOut);
const push = 1 + 0.022 * ramp(f, GATHER.at, FADE.to, EASE.inOut);
const glow = ramp(f, 0, 18) * (1 - ramp(f, 18, 80, EASE.inOut));
return (
<AbsoluteFill style={{ opacity: fade, transform: `scale(${push.toFixed(5)})`, transformOrigin: '960px 520px' }}>
<div
style={{
position: 'absolute',
left: ICON.x - 360,
top: ICON.y - 360,
width: 720,
height: 720,
background: `radial-gradient(closest-side, ${rgba(COLOR.accent, 0.22 * glow)}, ${rgba(COLOR.accent, 0)})`,
}}
/>
<svg width={1920} height={1080} style={{ position: 'absolute', inset: 0 }}>
<Ring start={0} reach={300} width={1.6} />
<Ring start={9} reach={460} width={1} />
</svg>
{f < SPLIT.at ? (
<ShapeView
d={shapePath('dot', 'stage', 0, 1 + boundaryPulse(f), ICON.x, ICON.y)}
color={SHAPES.dot.color}
cx={ICON.x}
cy={ICON.y}
k={1 + boundaryPulse(f)}
fill={1}
lift={0}
/>
) : (
APPS.map((app, i) => <AppIcon key={app.id} index={i} />)
)}
<div style={{ position: 'absolute', left: 0, width: 1920, top: 478 }}>
<Line
text="Ely Office 0.1.5"
start={6 * BEAT}
stagger={1.8}
style={{ fontFamily: FONT.latin, fontWeight: 600, fontSize: 84, lineHeight: '96px', letterSpacing: '-0.02em', color: '#ECEAE6' }}
/>
<Line
text="Windows · macOS · Linux"
start={7 * BEAT}
stagger={1}
style={{ marginTop: 22, fontFamily: FONT.latin, fontWeight: 400, fontSize: 26, lineHeight: '34px', letterSpacing: '0.06em', color: COLOR.muted }}
/>
<Line
text="git.zacharyzhang.com/ZacharyZhang-NY/ElyOffice"
start={8 * BEAT}
stagger={0.6}
style={{ marginTop: 18, fontFamily: FONT.mono, fontWeight: 400, fontSize: 22, lineHeight: '30px', letterSpacing: '0.01em', color: '#86A9E6' }}
/>
</div>
</AbsoluteFill>
);
};
@@ -0,0 +1,65 @@
import { AbsoluteFill } from 'remotion';
import { Caption } from '../design/Caption';
import { KeyCap } from '../design/KeyCap';
import { Stage } from '../design/Stage';
import { Clip, lay, type Cut, type Shot } from '../footage/Clip';
import { frameOf, Sounds } from '../footage/Sounds';
import { Triangle } from '../footage/Triangle';
const CUTS: Cut[] = [
{ take: 'doc', from: 3.9, to: 9.5 },
{ take: 'doc', from: 11.75, to: 13.85, fade: 12 },
{ take: 'table', from: 3.9, to: 7.4, fade: 14 },
{ take: 'show', from: 3.1, to: 7.57, fade: 14 },
];
const [, drag, table, show] = lay(CUTS);
const SHOTS: Shot[] = [
{ f: 0, z: 1, x: 1024, y: 576 },
{ f: 45, z: 1.2, x: 1100, y: 620 },
{ f: 120, z: 1.45, x: 1260, y: 800 },
{ f: 290, z: 1.45, x: 1260, y: 800 },
{ f: drag.start, z: 1.35, x: 920, y: 640 },
{ f: drag.start + 28, z: 1.65, x: 990, y: 620 },
{ f: table.start - 6, z: 1.65, x: 990, y: 620 },
{ f: table.start + 34, z: 1.45, x: 560, y: 380 },
{ f: show.start - 6, z: 1.45, x: 560, y: 380 },
{ f: show.start + 40, z: 1.5, x: 430, y: 620 },
{ f: show.start + 160, z: 1.5, x: 430, y: 620 },
{ f: show.start + 230, z: 1.15, x: 900, y: 560 },
];
export const RightClick: React.FC = () => {
const docRight = frameOf(CUTS.slice(0, 1), 4.95);
const tableRight = table.start + Math.round((4.25 - table.from) * 60);
const wheel = show.start + Math.round((3.42 - show.from) * 60);
return (
<AbsoluteFill>
<Stage
enter={{ from: 'ely-doc' }}
exit={{ to: 'ely-show' }}
heading={[
{ title: '右键照 Word', sub: '正文、表格、图片各有对应的菜单;拖动边线调列宽行高', app: 'ely-doc' },
{ title: '右键照 Excel', sub: '单元格、行列表头、图形各有对应的菜单', app: 'ely-table', at: table.start },
{ title: '右键照 PowerPoint', sub: '缩略图条可用滚轮滚动,表格边线可以拖动', app: 'ely-show', at: show.start },
]}
>
<Clip
cuts={CUTS}
shots={SHOTS}
overlay={(cut, t) =>
cut.take === 'doc' ? (
<Triangle take="doc" t={t} from={7.29} to={8.19} passed={[742, 784]} note="路过「删除」,不抢走" />
) : null
}
/>
</Stage>
<KeyCap keys={['右键']} from={docRight - 20} to={docRight + 75} press={[docRight]} />
<Caption text="拖动表格边线,调整列宽" from={drag.start + 10} to={table.start - 4} />
<KeyCap keys={['右键']} from={tableRight - 20} to={tableRight + 75} press={[tableRight]} />
<Caption text="表头右键:插入、删除、列宽、隐藏" from={tableRight + 30} to={show.start - 4} />
<KeyCap keys={['滚轮']} from={wheel - 16} to={wheel + 170} press={[wheel, wheel + 96]} />
<Caption text="缩略图条可以用滚轮滚动" from={wheel + 10} to={wheel + 190} />
<Sounds cuts={CUTS} />
</AbsoluteFill>
);
};
+84
View File
@@ -0,0 +1,84 @@
import { Easing } from 'remotion';
export const WIDTH = 1920;
export const HEIGHT = 1080;
export const FPS = 60;
export const TOTAL = 3600;
// 96 BPM, 4/4.
export const BEAT = 37.5;
export const BAR = 150;
export const beat = (n: number) => Math.round(n * BEAT);
export const bar = (n: number) => n * BAR;
// Section start frames (bars 1, 3, 7, 11, 17, 22) and lengths.
export const SECTION = {
intro: { from: 0, duration: 300 },
menus: { from: 300, duration: 600 },
cells: { from: 900, duration: 600 },
rightClick: { from: 1500, duration: 900 },
more: { from: 2400, duration: 750 },
outro: { from: 3150, duration: 450 },
} as const;
export const COLOR = {
bgInner: '#252525',
bgOuter: '#1c1c1e',
ink: '#F4F4F2',
muted: '#A8A6A3',
faint: '#6E6C6A',
accent: '#3D7FE5',
panel: '#1f1f21',
hairline: 'rgba(255,255,255,0.08)',
} as const;
export type AppId = 'ely-doc' | 'ely-table' | 'ely-show' | 'ely-pdf' | 'ely-tree' | 'ely-mark';
export const APPS: { id: AppId; name: string; color: string }[] = [
{ id: 'ely-doc', name: 'ElyDoc', color: '#3D7FE5' },
{ id: 'ely-table', name: 'ElyTable', color: '#2E9E5B' },
{ id: 'ely-show', name: 'ElyShow', color: '#F07B2A' },
{ id: 'ely-pdf', name: 'ElyPDF', color: '#E0344F' },
{ id: 'ely-tree', name: 'ElyTree', color: '#7E57C2' },
{ id: 'ely-mark', name: 'ElyMark', color: '#3E4A5C' },
];
export const appOf = (id: AppId) => APPS.find((a) => a.id === id)!;
export const STAGE = { x: 120, y: 118, w: 1680, h: 945, r: 18 } as const;
export const STAGE_CENTER = { x: STAGE.x + STAGE.w / 2, y: STAGE.y + STAGE.h / 2 };
// Recordings are 2048×1152; this maps them onto the stage width.
export const FOOTAGE = { w: 2048, h: 1152, scale: STAGE.w / 2048 } as const;
// Where boundary icons rest, and the size of one icon-grid unit (Papirus 192 grid).
export const ICON = { x: 960, y: 590, unit: 1.375 } as const;
// Section-local morph frames. Boundary icons rest for `hold` frames on each side
// of the cut (one beat in total, centred on the downbeat); the shape morph takes
// `morph` frames. The stage is fully open from `ENTER_END`, and starts closing at
// `duration - EXIT_LEN`.
export const MORPH = { hold: 18, morph: 42 } as const;
export const ENTER_END = MORPH.hold + MORPH.morph;
export const EXIT_LEN = MORPH.hold + MORPH.morph;
// Headings enter on beat 1 of a section, the sub line half a beat later, and
// start to leave `out` frames before the section ends (gone before it closes).
export const HEADING = { in: beat(1), sub: beat(0.5), out: 92 } as const;
export const EASE = {
out: Easing.bezier(0.22, 1, 0.36, 1),
inOut: Easing.bezier(0.65, 0, 0.35, 1),
in: Easing.bezier(0.55, 0, 0.75, 0.06),
// Starts from rest, decelerates long: for growth that should feel heavy.
bloom: Easing.bezier(0.5, 0, 0.1, 1),
// Gentle start, soft landing: for collapses that must come to rest.
land: Easing.bezier(0.6, 0, 0.2, 1),
} as const;
export const SPRING = { damping: 200 } as const;
export const FONT = {
sans: '"Noto Sans SC", "Inter", sans-serif',
latin: '"Inter", "Noto Sans SC", sans-serif',
mono: '"JetBrains Mono", monospace',
} as const;