feat: KolayTercih lansman videosu (Remotion, v3)

64 saniyelik, kesintisiz döngü lansman filmi; 9:16 ve 16:9.
- remocn.dev bileşenleri (sheen-slide-in, tracking-in, gradient-scale-cut-text,
  outline-fill-track-text, perspective-marquee, path-ride, zoom-blur, lens-zoom)
  KolayTercih piksel diline uyarlandı (src/kinetik.tsx)
- Sahne içi imleç + imleci takip eden kamera, piksel iz ve tık patlaması
- Sessizlik → BAM kurgusu (lensZoom), punch zoom ve hareket bulanıklığı
- Müzik ve efektler numpy ile sentezlendi (ses/uret.py), zaman.json tek kaynak
- Örnek taban sıralamaları gerçek YÖK Atlas 2026 kayıtları

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
bilalgursen
2026-09-30 20:22:38 +03:00
commit dc5c87b6aa
61 changed files with 11111 additions and 0 deletions

View File

@@ -0,0 +1,215 @@
"use client";
import { Easing, interpolate, useCurrentFrame } from "remotion";
export interface GradientScaleCutTextProps {
text?: string;
giantFontSize?: number;
compactFontSize?: number;
fontWeight?: number;
gradientStart?: string;
gradientEnd?: string;
ghostColor?: string;
backgroundColor?: string;
anchorOffsetX?: number;
giantTravel?: number;
settleTravel?: number;
cutFrame?: number;
revealSoftness?: number;
compactBlur?: number;
speed?: number;
className?: string;
}
export const gradientScaleCutTextLength = 36;
const REVEAL_END = 33;
const SETTLE_FRAMES = 8;
const GIANT_Y = -28;
const GIANT_X_CORRECTION = -48;
const COMPACT_Y = 5;
const COMPACT_X_SCALE = 0.87;
const COMPACT_START_X_CORRECTION = 28;
const FONT_FAMILY = "Arial, Helvetica, sans-serif";
const clamp = {
extrapolateLeft: "clamp" as const,
extrapolateRight: "clamp" as const,
};
interface TextLayerProps {
text: string;
fontSize: number;
fontWeight: number;
gradientStart: string;
gradientEnd: string;
ghostColor: string;
maskImage: string;
}
function TextLayer({
text,
fontSize,
fontWeight,
gradientStart,
gradientEnd,
ghostColor,
maskImage,
}: TextLayerProps) {
const textStyle = {
display: "block",
fontFamily: FONT_FAMILY,
fontSize,
fontWeight,
letterSpacing: 0,
lineHeight: 1.12,
whiteSpace: "nowrap" as const,
};
return (
<div style={{ position: "relative" }}>
<span style={{ ...textStyle, color: ghostColor }}>{text}</span>
<span
style={{
...textStyle,
position: "absolute",
inset: 0,
color: "transparent",
backgroundImage: `linear-gradient(90deg, ${gradientStart} 0%, ${gradientStart} 4%, ${gradientEnd} 26%, ${gradientEnd} 100%)`,
backgroundClip: "text",
maskImage,
maskRepeat: "no-repeat",
opacity: 1,
WebkitBackgroundClip: "text",
WebkitMaskImage: maskImage,
WebkitMaskRepeat: "no-repeat",
}}
>
{text}
</span>
</div>
);
}
export function GradientScaleCutText({
text = "Introducing",
giantFontSize = 520,
compactFontSize = 132,
fontWeight = 700,
gradientStart = "#f04a14",
gradientEnd = "#f3f1f1",
ghostColor = "#170b0a",
backgroundColor = "#000000",
anchorOffsetX = -16,
giantTravel = 400,
settleTravel = 160,
cutFrame = 13,
revealSoftness = 14,
compactBlur = 12,
speed = 1,
className,
}: GradientScaleCutTextProps) {
const frame = useCurrentFrame() * Math.max(speed, 0);
const safeCutFrame = Math.max(cutFrame, 1);
const safeGiantFontSize = Math.max(giantFontSize, 1);
const safeCompactFontSize = Math.max(compactFontSize, 1);
const safeSoftness = Math.max(revealSoftness, 0);
const safeBlur = Math.max(compactBlur, 0);
const revealProgress = interpolate(frame, [0, REVEAL_END], [0.02, 1], {
...clamp,
easing: Easing.bezier(0.22, 0.74, 0.24, 1),
});
const revealEdge = revealProgress * (100 + safeSoftness / 2);
const revealSolid = Math.max(0, revealEdge - safeSoftness / 2);
const revealFade = revealEdge + safeSoftness / 2;
const maskImage = `linear-gradient(90deg, #000 0%, #000 ${revealSolid}%, transparent ${revealFade}%, transparent ${revealFade}%)`;
const giantProgress = interpolate(
frame,
[0, Math.max(safeCutFrame - 1, 1)],
[0, 1],
{
...clamp,
easing: Easing.out(Easing.cubic),
},
);
const settleProgress = interpolate(
frame,
[safeCutFrame, safeCutFrame + SETTLE_FRAMES],
[0, 1],
{
...clamp,
easing: Easing.out(Easing.cubic),
},
);
const moveProgress = interpolate(
frame,
[
safeCutFrame + 1,
safeCutFrame + 2,
safeCutFrame + 4,
safeCutFrame + SETTLE_FRAMES,
],
[0, 0.58, 0.875, 1],
clamp,
);
const showGiant = frame < safeCutFrame;
const compactX =
interpolate(moveProgress, [0, 1], [settleTravel, 0], clamp) +
COMPACT_START_X_CORRECTION * (1 - moveProgress);
const compactBlurValue = safeBlur * (1 - settleProgress);
return (
<div
className={className}
style={{
position: "absolute",
inset: 0,
overflow: "hidden",
backgroundColor,
}}
>
{showGiant ? (
<div
style={{
position: "absolute",
top: `calc(50% + ${GIANT_Y}px)`,
left: `calc(50% + ${anchorOffsetX + GIANT_X_CORRECTION - giantTravel * giantProgress}px)`,
opacity: 1,
transform: "translate3d(0, -50%, 0)",
}}
>
<TextLayer
text={text}
fontSize={safeGiantFontSize}
fontWeight={fontWeight}
gradientStart={gradientStart}
gradientEnd={gradientEnd}
ghostColor={ghostColor}
maskImage={maskImage}
/>
</div>
) : (
<div
style={{
position: "absolute",
top: `calc(50% + ${COMPACT_Y}px)`,
left: `calc(50% + ${anchorOffsetX + compactX}px)`,
filter: `blur(${compactBlurValue}px)`,
opacity: 1,
transform: `translate3d(-50%, -50%, 0) scaleX(${COMPACT_X_SCALE})`,
transformOrigin: "center",
}}
>
<TextLayer
text={text}
fontSize={safeCompactFontSize}
fontWeight={fontWeight}
gradientStart={gradientStart}
gradientEnd={gradientEnd}
ghostColor={ghostColor}
maskImage={maskImage}
/>
</div>
)}
</div>
);
}

535
src/remocn/lens-zoom.tsx Normal file
View File

@@ -0,0 +1,535 @@
"use client";
import type {
TransitionPresentation,
TransitionPresentationComponentProps,
} from "@remotion/transitions";
import type { ReactNode } from "react";
import { useId } from "react";
import { Easing, interpolate, useCurrentFrame, useVideoConfig } from "remotion";
export const LENS_ZOOM_DURATION_IN_FRAMES = 28;
export const SHAKE_STOPS = [-9 / 11, -3 / 11, 4 / 11, 8 / 11] as const;
export const LENS_ZOOM_EASE_IN = Easing.bezier(0.54, 0, 0.82, 0.8);
export const LENS_ZOOM_EASE_OUT = Easing.bezier(0.18, 0.2, 0.46, 1);
export type LensZoomProps = {
inScaleFrom?: number;
inScaleTo?: number;
inFovFrom?: number;
inFovTo?: number;
inBlurFrom?: number;
inBlurTo?: number;
inRotationFrom?: number;
inRotationTo?: number;
outScaleFrom?: number;
outScaleTo?: number;
outFovFrom?: number;
outFovTo?: number;
outBlurFrom?: number;
outBlurTo?: number;
outRotationFrom?: number;
outRotationTo?: number;
anticipateScale?: number;
anticipatePortion?: number;
lensSteps?: number;
blurSamples?: number;
blurScaleGain?: number;
blurFade?: number;
shakeAmount?: number;
shakeFrequency?: number;
shakeCyclesPerUnit?: number;
shakeTranslatePx?: number;
shakeRotateDeg?: number;
redScale?: number;
greenScale?: number;
blueScale?: number;
letterboxAspect?: number;
width?: number;
height?: number;
distortionCenterX?: number;
distortionCenterY?: number;
};
function hashed(seed: number, i: number): number {
let t = Math.imul(i ^ seed, 0x27d4eb2d);
t ^= t >>> 15;
t = Math.imul(t, 0x85ebca6b);
t ^= t >>> 13;
return ((t >>> 0) / 4294967296) * 2 - 1;
}
function valueNoise(seed: number, t: number): number {
const i = Math.floor(t);
const f = t - i;
const u = f * f * (3 - 2 * f);
return hashed(seed, i) * (1 - u) + hashed(seed, i + 1) * u;
}
function fovHalf(fov: number): number {
return (Math.min(fov, 178) / 2) * (Math.PI / 180);
}
function lensMagnification(r: number, fov: number): number {
if (fov < 0.01) return 1;
const theta = fovHalf(fov);
const peak = Math.tan(theta) / theta;
if (r <= 0) return peak;
const a = r * theta;
if (a >= Math.PI / 2 - 1e-3) return 1;
const rSource = Math.tan(a) / Math.tan(theta);
if (rSource <= 1e-6) return peak;
return Math.max(1, r / rSource);
}
function radiusForMagnification(target: number, fov: number): number {
let lo = 0;
let hi = 1;
for (let i = 0; i < 24; i++) {
const mid = (lo + hi) / 2;
if (lensMagnification(mid, fov) > target) lo = mid;
else hi = mid;
}
return (lo + hi) / 2;
}
function ringClip(
rInner: number,
rOuter: number | null,
w: number,
h: number,
cx: number,
cy: number,
): string {
const circle = (r: number, clockwise: boolean) => {
const s = clockwise ? 1 : 0;
return `M ${cx + r} ${cy} A ${r} ${r} 0 1 ${s} ${cx - r} ${cy} A ${r} ${r} 0 1 ${s} ${cx + r} ${cy} Z`;
};
const outer =
rOuter === null
? `M 0 0 L ${w} 0 L ${w} ${h} L 0 ${h} Z`
: circle(rOuter, true);
return rInner > 0 ? `${outer} ${circle(rInner, false)}` : outer;
}
type HalfProps = {
scene: ReactNode;
scale: number;
fov: number;
blur: number;
rotation: number;
centerX: number;
centerY: number;
width: number;
height: number;
lensSteps: number;
blurSamples: number;
blurScaleGain: number;
blurFade: number;
};
function TransitionHalf({
scene,
scale,
fov,
blur,
rotation,
centerX,
centerY,
width,
height,
lensSteps,
blurSamples,
blurScaleGain,
blurFade,
}: HalfProps) {
const origin = `${centerX}px ${centerY}px`;
const base = scale / 100;
const peak = lensMagnification(0, fov);
const steps = peak <= 1.001 ? 0 : lensSteps;
const rings = Array.from({ length: steps }, (_, i) => {
const s = 1 + ((peak - 1) * (i + 0.5)) / steps;
return { s, r: radiusForMagnification(s, fov) };
});
const samples =
blur <= 0.05 ? 1 : Math.max(2, Math.round((blurSamples * blur) / 60));
const weights = Array.from(
{ length: samples },
(_, j) => (1 - j / samples) ** blurFade,
);
const groups: {
key: number;
alpha: number;
copies: { key: string; clip: string; k: number }[];
}[] = [];
let running = 0;
for (let j = samples - 1; j >= 0; j--) {
running += weights[j];
const g =
samples === 1
? 1
: 1 + (blur / 100) * blurScaleGain * (j / (samples - 1));
const halfWidth = (width / 2) * g;
const copies: { key: string; clip: string; k: number }[] = [];
copies.push({
key: "base",
clip: ringClip(
rings.length ? rings[0].r * halfWidth : 0,
null,
width,
height,
centerX,
centerY,
),
k: g * base,
});
for (let i = 0; i < rings.length; i++) {
const inner = i + 1 < rings.length ? rings[i + 1].r * halfWidth : 0;
copies.push({
key: `${i}`,
clip: ringClip(
inner,
rings[i].r * halfWidth,
width,
height,
centerX,
centerY,
),
k: g * rings[i].s * base,
});
}
groups.push({ key: j, alpha: weights[j] / running, copies });
}
return (
<div style={{ position: "absolute", inset: 0 }}>
{groups.map(({ key, alpha, copies }) => (
<div
key={key}
style={{ position: "absolute", inset: 0, opacity: alpha }}
>
{copies.map(({ key: ck, clip, k }) => (
<div
key={ck}
style={{
position: "absolute",
inset: 0,
clipPath: `path("${clip}")`,
rotate: `${rotation}deg`,
scale: `${k}`,
transformOrigin: origin,
}}
>
{scene}
</div>
))}
</div>
))}
</div>
);
}
interface LensZoomStageProps extends HalfProps {
shakeEnvelope: number;
shakeFrequency: number;
shakeCyclesPerUnit: number;
shakeTranslatePx: number;
shakeRotateDeg: number;
redScale: number;
greenScale: number;
blueScale: number;
letterboxAspect: number;
}
function LensZoomStage({
shakeEnvelope,
shakeFrequency,
shakeCyclesPerUnit,
shakeTranslatePx,
shakeRotateDeg,
redScale,
greenScale,
blueScale,
letterboxAspect,
...half
}: LensZoomStageProps) {
const frame = useCurrentFrame();
const { fps } = useVideoConfig();
const filterId = useId();
const { width, height, centerX, centerY } = half;
const core = <TransitionHalf {...half} />;
const split = redScale !== greenScale || blueScale !== greenScale;
const channels: { id: string; scale: number; matrix: string }[] = [
{
id: "r",
scale: redScale,
matrix: "1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0",
},
{
id: "g",
scale: greenScale,
matrix: "0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 1 0",
},
{
id: "b",
scale: blueScale,
matrix: "0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 1 0",
},
];
const composited = split ? (
<div style={{ position: "absolute", inset: 0, backgroundColor: "#000000" }}>
{channels.map((c) => (
<div
key={c.id}
style={{
position: "absolute",
inset: 0,
mixBlendMode: "screen",
filter: `url(#${filterId}-${c.id})`,
scale: `${c.scale}`,
transformOrigin: `${centerX}px ${centerY}px`,
}}
>
{core}
</div>
))}
</div>
) : (
core
);
const t = (frame / fps) * shakeFrequency * shakeCyclesPerUnit;
const octave = (seed: number) =>
valueNoise(seed, t) + 0.45 * valueNoise(seed + 977, t * 2.6);
const shakeX = octave(11) * shakeTranslatePx * shakeEnvelope;
const shakeY = octave(23) * shakeTranslatePx * shakeEnvelope;
const shakeR = octave(41) * shakeRotateDeg * shakeEnvelope;
const barHeight =
letterboxAspect > 0
? Math.max(0, (height - width / letterboxAspect) / 2)
: 0;
return (
<div
style={{
position: "absolute",
inset: 0,
width,
height,
overflow: "hidden",
backgroundColor: "#000000",
}}
>
{split ? (
<svg width={0} height={0} style={{ position: "absolute" }} aria-hidden>
<defs>
{channels.map((c) => (
<filter
key={c.id}
id={`${filterId}-${c.id}`}
colorInterpolationFilters="sRGB"
>
<feColorMatrix type="matrix" values={c.matrix} />
</filter>
))}
</defs>
</svg>
) : null}
<div
style={{
position: "absolute",
inset: 0,
translate: `${shakeX}px ${shakeY}px`,
rotate: `${shakeR}deg`,
transformOrigin: `${centerX}px ${centerY}px`,
}}
>
{composited}
</div>
{barHeight > 0 ? (
<>
<div
style={{
position: "absolute",
left: 0,
right: 0,
top: 0,
height: barHeight,
backgroundColor: "#000000",
}}
/>
<div
style={{
position: "absolute",
left: 0,
right: 0,
bottom: 0,
height: barHeight,
backgroundColor: "#000000",
}}
/>
</>
) : null}
</div>
);
}
const LensZoomPresentation: React.FC<
TransitionPresentationComponentProps<LensZoomProps>
> = ({
children,
presentationDirection,
presentationProgress,
passedProps,
}) => {
const config = useVideoConfig();
const {
inScaleFrom = 100,
inScaleTo = 150,
inFovFrom = 0,
inFovTo = 160,
inBlurFrom = 0,
inBlurTo = 60,
inRotationFrom = 0,
inRotationTo = -15,
outScaleFrom = 135,
outScaleTo = 100,
outFovFrom = 135,
outFovTo = 0,
outBlurFrom = 45,
outBlurTo = 0,
outRotationFrom = 345,
outRotationTo = 360,
anticipateScale = 100,
anticipatePortion = 0.35,
lensSteps = 9,
blurSamples = 7,
blurScaleGain = 1,
blurFade = 1.5,
shakeAmount = 50,
shakeFrequency = 1.4,
shakeCyclesPerUnit = 8,
shakeTranslatePx = 73,
shakeRotateDeg = 1.1,
redScale = 1.01,
greenScale = 1.0,
blueScale = 0.99,
letterboxAspect = 0,
width = config.width,
height = config.height,
distortionCenterX = width / 2,
distortionCenterY = height / 2,
} = passedProps;
const exiting = presentationDirection === "exiting";
if (exiting ? presentationProgress >= 0.5 : presentationProgress < 0.5)
return null;
const p = exiting
? interpolate(presentationProgress, [0, 0.5], [0, 1], {
easing: LENS_ZOOM_EASE_IN,
extrapolateLeft: "clamp",
extrapolateRight: "clamp",
})
: interpolate(presentationProgress, [0.5, 1], [0, 1], {
easing: LENS_ZOOM_EASE_OUT,
extrapolateLeft: "clamp",
extrapolateRight: "clamp",
});
const anticipating =
exiting && anticipatePortion > 0 && anticipateScale < inScaleFrom;
const pFx =
anticipating && exiting
? interpolate(p, [anticipatePortion, 1], [0, 1], {
extrapolateLeft: "clamp",
extrapolateRight: "clamp",
})
: p;
const lerp = (from: number, to: number) => from + (to - from) * pFx;
const exitScale = anticipating
? interpolate(
p,
[0, anticipatePortion, 1],
[inScaleFrom, anticipateScale, inScaleTo],
{
easing: Easing.inOut(Easing.ease),
extrapolateLeft: "clamp",
extrapolateRight: "clamp",
},
)
: lerp(inScaleFrom, inScaleTo);
const shakeEnvelope =
interpolate(
presentationProgress,
SHAKE_STOPS.map((s) => 0.5 + s / 2),
[0, shakeAmount, shakeAmount, 0],
{ extrapolateLeft: "clamp", extrapolateRight: "clamp" },
) / 100;
return (
<LensZoomStage
scene={children}
scale={exiting ? exitScale : lerp(outScaleFrom, outScaleTo)}
fov={exiting ? lerp(inFovFrom, inFovTo) : lerp(outFovFrom, outFovTo)}
blur={exiting ? lerp(inBlurFrom, inBlurTo) : lerp(outBlurFrom, outBlurTo)}
rotation={
exiting
? lerp(inRotationFrom, inRotationTo)
: lerp(outRotationFrom, outRotationTo)
}
centerX={distortionCenterX}
centerY={distortionCenterY}
width={width}
height={height}
lensSteps={lensSteps}
blurSamples={blurSamples}
blurScaleGain={blurScaleGain}
blurFade={blurFade}
shakeEnvelope={shakeEnvelope}
shakeFrequency={shakeFrequency}
shakeCyclesPerUnit={shakeCyclesPerUnit}
shakeTranslatePx={shakeTranslatePx}
shakeRotateDeg={shakeRotateDeg}
redScale={redScale}
greenScale={greenScale}
blueScale={blueScale}
letterboxAspect={letterboxAspect}
/>
);
};
export function lensZoom(
props: LensZoomProps = {},
): TransitionPresentation<LensZoomProps> {
return {
component: LensZoomPresentation,
props,
};
}

View File

@@ -0,0 +1,236 @@
"use client";
import { useMemo } from "react";
import { Easing, interpolate, useCurrentFrame, useVideoConfig } from "remotion";
export interface OutlineFillTrackTextProps {
leadText?: string;
valueText?: string;
fontSize?: number;
fontWeight?: number;
color?: string;
outlineColor?: string;
outlineWidth?: number;
backgroundColor?: string;
glowColor?: string;
enterOffset?: number;
anchorOffsetX?: number;
trackDistance?: number;
wordGap?: number;
endPadding?: number;
fillDuration?: number;
speed?: number;
className?: string;
}
export const outlineFillTrackTextLength = 80;
const ENTER_END = 16;
const TRACK_START = 16;
const TRACK_END = 72;
const FILL_START = 34;
const FILL_PREFILL = 10;
const FONT_FAMILY = "Arial, Helvetica, sans-serif";
const clamp = {
extrapolateLeft: "clamp" as const,
extrapolateRight: "clamp" as const,
};
function estimateTextWidth(
text: string,
fontSize: number,
fontWeight: number,
): number {
if (typeof document === "undefined") {
return text.length * fontSize * 0.56;
}
const context = document.createElement("canvas").getContext("2d");
if (!context) return text.length * fontSize * 0.56;
context.font = `${fontWeight} ${fontSize}px Arial`;
return context.measureText(text).width;
}
export function OutlineFillTrackText({
leadText = "Keep",
valueText = "1000000000%",
fontSize = 368,
fontWeight = 700,
color = "#f4f3f6",
outlineColor = "#e6e2ed",
outlineWidth = 3,
backgroundColor = "#030012",
glowColor = "#64109a",
enterOffset = 240,
anchorOffsetX = -84,
trackDistance = 0,
wordGap = 220,
endPadding = 96,
fillDuration = 38,
speed = 1,
className,
}: OutlineFillTrackTextProps) {
const frame = useCurrentFrame() * Math.max(speed, 0);
const { width: compositionWidth } = useVideoConfig();
const safeFontSize = Math.max(fontSize, 1);
const safeFontWeight = Math.max(fontWeight, 1);
const safeOutlineWidth = Math.max(outlineWidth, 0);
const safeGap = Math.max(wordGap, 0);
const safeEndPadding = Math.max(endPadding, 0);
const safeFillDuration = Math.max(fillDuration, 1);
const measurements = useMemo(() => {
const leadWidth = estimateTextWidth(leadText, safeFontSize, safeFontWeight);
const valueWidth = estimateTextWidth(
valueText,
safeFontSize,
safeFontWeight,
);
return {
valueWidth,
distance: leadWidth / 2 + safeGap + valueWidth / 2,
};
}, [leadText, safeFontSize, safeFontWeight, safeGap, valueText]);
const valueOffset = trackDistance > 0 ? trackDistance : measurements.distance;
const anchorX = compositionWidth / 2 + anchorOffsetX;
const trailingOverflow = Math.max(
0,
anchorX + measurements.valueWidth / 2 - (compositionWidth - safeEndPadding),
);
const travelDistance = valueOffset + trailingOverflow;
const enterProgress = interpolate(frame, [0, ENTER_END], [0, 1], {
...clamp,
easing: Easing.bezier(0.16, 0.84, 0.24, 1),
});
const trackProgress = interpolate(frame, [TRACK_START, TRACK_END], [0, 1], {
...clamp,
easing: Easing.bezier(0.42, 0, 0.58, 1),
});
const fillProgress = interpolate(
frame,
[FILL_START - FILL_PREFILL, FILL_START + safeFillDuration],
[0, 1],
clamp,
);
const leadY = enterOffset * (1 - enterProgress);
const revealEdge = enterProgress * 112 - 8;
const revealSolid = Math.max(0, Math.min(100, revealEdge - 10));
const revealFade = Math.max(0, Math.min(100, revealEdge + 10));
const leadMask = `linear-gradient(180deg, #000 0%, #000 ${revealSolid}%, transparent ${revealFade}%, transparent 100%)`;
const glowOpacity = interpolate(
enterProgress,
[0, 0.18, 0.72, 1],
[0.92, 1, 0.52, 0],
clamp,
);
const fieldY = interpolate(enterProgress, [0, 1], [-42, -210], clamp);
const textStyle = {
display: "block",
fontFamily: FONT_FAMILY,
fontSize: safeFontSize,
fontWeight: safeFontWeight,
letterSpacing: 0,
lineHeight: 0.86,
whiteSpace: "nowrap" as const,
};
return (
<div
className={className}
style={{
position: "absolute",
inset: 0,
overflow: "hidden",
backgroundColor,
}}
>
<div
style={{
position: "absolute",
inset: 0,
background: `radial-gradient(ellipse 118% 66% at 50% -12%, ${glowColor} 0%, ${glowColor} 14%, transparent 76%)`,
filter: `blur(${safeFontSize * 0.15}px)`,
opacity: glowOpacity,
pointerEvents: "none",
transform: "translateZ(0)",
}}
/>
<div
style={{
position: "absolute",
top: "50%",
left: `calc(50% + ${anchorOffsetX}px)`,
transform: `translate3d(${-travelDistance * trackProgress}px, -50%, 0)`,
}}
>
<div
style={{
position: "absolute",
top: 0,
left: 0,
color,
maskImage: leadMask,
maskRepeat: "no-repeat",
opacity: 1,
transform: `translate3d(-50%, calc(-50% + ${leadY}px), 0)`,
WebkitMaskImage: leadMask,
WebkitMaskRepeat: "no-repeat",
...textStyle,
}}
>
{leadText}
</div>
<div
style={{
position: "absolute",
top: 0,
left: valueOffset,
transform: "translate3d(-50%, -50%, 0)",
visibility: frame < FILL_START ? "hidden" : "visible",
}}
>
<span
style={{
...textStyle,
color: "transparent",
paintOrder: "stroke fill",
WebkitTextStroke: `${safeOutlineWidth}px ${outlineColor}`,
}}
>
{valueText}
</span>
<span
style={{
...textStyle,
position: "absolute",
inset: 0,
clipPath: `inset(0 ${100 - fillProgress * 100}% 0 0)`,
color,
opacity: 1,
}}
>
{valueText}
</span>
</div>
<div
style={{
position: "absolute",
top: fieldY,
left: 0,
width: safeFontSize * 2.8,
height: safeFontSize * 0.72,
background: `radial-gradient(ellipse at center, ${backgroundColor} 0%, ${backgroundColor} 18%, transparent 74%)`,
filter: `blur(${safeFontSize * 0.07}px)`,
opacity: glowOpacity,
pointerEvents: "none",
transform: "translate3d(-50%, -50%, 0)",
}}
/>
</div>
</div>
);
}

430
src/remocn/path-ride.tsx Normal file
View File

@@ -0,0 +1,430 @@
"use client";
import {
getLength,
getPointAtLength,
getTangentAtLength,
} from "@remotion/paths";
import { useEffect, useMemo, useState } from "react";
import {
continueRender,
delayRender,
Easing,
interpolate,
useCurrentFrame,
useVideoConfig,
} from "remotion";
// KolayTercih: Google Fonts yerine projenin kendi Cal Sans'ı (fontlar.ts)
const INTER = "'Cal Sans', sans-serif";
export interface PathRideProps {
text?: string;
path?: string;
fontSize?: number;
fontWeight?: number;
fontFamily?: string;
color?: string;
lineColor?: string;
lineWidth?: number;
speed?: number;
className?: string;
}
/** An S-curve across a 1280×720 frame. */
export const pathRideDefaultPath =
"M 120 560 C 360 120 560 120 640 360 S 920 600 1160 160";
export const pathRideDefaults = {
text: "Follow the line",
path: pathRideDefaultPath,
fontSize: 44,
fontWeight: 700,
fontFamily: INTER,
color: "#fafafa",
lineColor: "#D97757",
lineWidth: 3,
speed: 1,
} satisfies Required<Omit<PathRideProps, "className">>;
/** Beats on the 30 fps clock. */
export const pathRideTiming = {
draw: [0, 40],
straighten: [50, 68],
erase: [52, 70],
} as const;
/** Gap between the head and the last letter, in em. */
const LEAD = 0.3;
/** Letters fade in over this much arc length, in em. */
const FADE_IN = 0.5;
/** Extra lift of the baseline above the line, in em. */
const LIFT = 0.08;
/** Samples along the path; the line and the letters read positions from them. */
const SAMPLES = 400;
const MEASURE_SIZE = 100;
/** Inter's baseline and cap height in a `line-height: 1` box, until measured. */
const INTER_METRICS = { baseline: 0.8637, capHeight: 0.7275 };
const CLAMP = {
extrapolateLeft: "clamp",
extrapolateRight: "clamp",
} as const;
const easeInOutCubic = Easing.inOut(Easing.cubic);
function finite(value: number | undefined, fallback: number) {
return typeof value === "number" && Number.isFinite(value) ? value : fallback;
}
/** Maps a composition frame onto the 30 fps timeline, scaled by `speed`. */
export function getPathRideTime(
frame: number,
options: { fps?: number; speed?: number } = {},
) {
const fps = Math.max(1, finite(options.fps, 30));
const speed = Math.max(0, finite(options.speed, 1));
return (Math.max(0, finite(frame, 0)) * 30 * speed) / fps;
}
/** Arc length drawn so far. */
export function getPathRideHead(t: number, length: number) {
return interpolate(t, [...pathRideTiming.draw], [0, length], {
...CLAMP,
easing: easeInOutCubic,
});
}
/** Arc length erased from the start. */
export function getPathRideTail(t: number, length: number) {
return interpolate(t, [...pathRideTiming.erase], [0, length], {
...CLAMP,
easing: easeInOutCubic,
});
}
/** How far the curve has pulled straight, 0..1. */
export function getPathRideStraighten(t: number) {
return interpolate(t, [...pathRideTiming.straighten], [0, 1], {
...CLAMP,
easing: easeInOutCubic,
});
}
/** Frame where the line has erased and the text rests on its baseline. */
export const pathRideLength = Math.max(
pathRideTiming.straighten[1],
pathRideTiming.erase[1],
);
/** Letter centers from the text start, and the total width. */
export function getPathRideCenters(advances: readonly number[]) {
let x = 0;
const centers = advances.map((a) => {
const c = x + a / 2;
x += a;
return c;
});
return { centers, width: x };
}
/**
* Arc length of a letter's center: it trails the head by the lead plus the
* text after it, so the last letter follows the head most closely.
*/
export function getPathRideArc(
head: number,
center: number,
width: number,
fontSize: number,
) {
return head - LEAD * fontSize - (width - center);
}
/** Opacity of a letter from how far onto the curve it has come. */
export function getPathRideFade(arc: number, fontSize: number) {
return Math.min(1, Math.max(0, arc / (FADE_IN * fontSize)));
}
export interface Point {
x: number;
y: number;
}
export interface PathSamples {
length: number;
points: Point[];
tangents: Point[];
}
/** Points and unit tangents at evenly spaced arc lengths along `path`. */
export function samplePath(path: string, count = SAMPLES): PathSamples {
const length = getLength(path);
const n = Math.max(2, Math.round(count));
const points: Point[] = [];
const tangents: Point[] = [];
for (let i = 0; i < n; i++) {
const at = (length * i) / (n - 1);
// Both can come back null on a degenerate path; reuse the last sample.
const p = getPointAtLength(path, at) ?? points[i - 1] ?? { x: 0, y: 0 };
const tangent = getTangentAtLength(path, at) ??
tangents[i - 1] ?? { x: 1, y: 0 };
points.push({ x: p.x, y: p.y });
tangents.push({ x: tangent.x, y: tangent.y });
}
return { length, points, tangents };
}
/** Position and unit tangent at arc length `s`, clamped to the path. */
export function getPathSample(samples: PathSamples, s: number) {
const n = samples.points.length;
const u = samples.length > 0 ? (s / samples.length) * (n - 1) : 0;
const i = Math.min(n - 2, Math.max(0, Math.floor(u)));
const f = Math.min(1, Math.max(0, u - i));
const a = samples.points[i];
const b = samples.points[i + 1];
const ta = samples.tangents[i];
const tb = samples.tangents[i + 1];
const tx = ta.x + (tb.x - ta.x) * f;
const ty = ta.y + (tb.y - ta.y) * f;
const norm = Math.hypot(tx, ty) || 1;
return {
x: a.x + (b.x - a.x) * f,
y: a.y + (b.y - a.y) * f,
tx: tx / norm,
ty: ty / norm,
};
}
export interface PathRideStraight {
/** Arc length that lands on the text's left edge. */
start: number;
/** Reference x of the text's left edge on the straight baseline. */
left: number;
/** Reference y of the straight baseline. */
baseline: number;
}
export interface PathRidePose {
x: number;
y: number;
angle: number;
}
/**
* A point of the path pulled `k` of the way from the curve to the straight
* baseline, lifted `lift` along its normal. Arc length maps to x one to one,
* so the text keeps its spacing while the curve pulls taut.
*/
export function getPathRidePoint(
samples: PathSamples,
s: number,
k: number,
straight: PathRideStraight,
lift = 0,
): PathRidePose {
const p = getPathSample(samples, s);
const x = p.x + (straight.left + (s - straight.start) - p.x) * k;
const y = p.y + (straight.baseline - p.y) * k;
const tx = p.tx + (1 - p.tx) * k;
const ty = p.ty * (1 - k);
const norm = Math.hypot(tx, ty) || 1;
return {
x: x + (ty / norm) * lift,
y: y - (tx / norm) * lift,
angle: Math.atan2(ty, tx),
};
}
/** Polyline of the pulled path between two arc lengths. */
export function getPathRideLine(
samples: PathSamples,
from: number,
to: number,
k: number,
straight: PathRideStraight,
) {
if (to <= from) return "";
const step = samples.length / (samples.points.length - 1);
const stops = [from];
for (let s = Math.ceil(from / step) * step; s < to; s += step) {
if (s > from) stops.push(s);
}
stops.push(to);
return stops
.map((s, i) => {
const p = getPathRidePoint(samples, s, k, straight);
return `${i === 0 ? "M" : "L"}${p.x.toFixed(2)} ${p.y.toFixed(2)}`;
})
.join("");
}
function useMetrics(text: string, font: string, fallback: number) {
const chars = Array.from(text);
const key = chars.join("");
const [metrics, setMetrics] = useState<{
advances: number[];
baseline: number;
capHeight: number;
} | null>(null);
useEffect(() => {
const handle = delayRender("path-ride: measuring the text");
let released = false;
const release = () => {
if (released) return;
released = true;
continueRender(handle);
};
const measure = () => {
if (released) return;
const ctx = document.createElement("canvas").getContext("2d");
if (ctx) {
ctx.font = font;
const m = ctx.measureText("H");
const ascent = m.fontBoundingBoxAscent / MEASURE_SIZE;
const descent = m.fontBoundingBoxDescent / MEASURE_SIZE;
setMetrics({
advances: Array.from(key).map(
(c) => ctx.measureText(c).width / MEASURE_SIZE,
),
baseline:
ascent > 0
? (1 - (ascent + descent)) / 2 + ascent
: INTER_METRICS.baseline,
capHeight:
m.actualBoundingBoxAscent > 0
? m.actualBoundingBoxAscent / MEASURE_SIZE
: INTER_METRICS.capHeight,
});
}
release();
};
document.fonts.load(font, key).then(measure, measure);
return release;
}, [key, font]);
return (
metrics ?? {
advances: chars.map(() => fallback),
baseline: INTER_METRICS.baseline,
capHeight: INTER_METRICS.capHeight,
}
);
}
export function PathRide({
text = pathRideDefaults.text,
path = pathRideDefaults.path,
fontSize = pathRideDefaults.fontSize,
fontWeight = pathRideDefaults.fontWeight,
fontFamily = pathRideDefaults.fontFamily,
color = pathRideDefaults.color,
lineColor = pathRideDefaults.lineColor,
lineWidth = pathRideDefaults.lineWidth,
speed = pathRideDefaults.speed,
className,
}: PathRideProps) {
const frame = useCurrentFrame();
const { fps, width, height } = useVideoConfig();
const unit = height / 720;
const t = getPathRideTime(frame, { fps, speed });
const metrics = useMetrics(
text,
`${fontWeight} ${MEASURE_SIZE}px ${fontFamily}`,
0.55,
);
const samples = useMemo(() => samplePath(path), [path]);
const chars = Array.from(text);
const advances = metrics.advances.map((a) => a * fontSize);
const { centers, width: textWidth } = getPathRideCenters(advances);
const length = samples.length;
const head = getPathRideHead(t, length);
const tail = getPathRideTail(t, length);
const k = getPathRideStraighten(t);
const lift = lineWidth / 2 + LIFT * fontSize;
// The line settles `lift` below the text so the capitals center on the frame.
const straight: PathRideStraight = {
start: getPathRideArc(length, 0, textWidth, fontSize),
left: 640 - textWidth / 2,
baseline: 360 + (metrics.capHeight * fontSize) / 2 + lift,
};
const tip = getPathRidePoint(samples, head, k, straight);
const tipOpacity = interpolate(
head,
[0, length * 0.02, length * 0.98, length],
[0, 1, 1, 0],
CLAMP,
);
// Reference space (1280×720, y down) mapped onto the composition.
const toX = (x: number) => width / 2 + (x - 640) * unit;
const toY = (y: number) => height / 2 + (y - 360) * unit;
const size = fontSize * unit;
const line = getPathRideLine(samples, tail, head, k, straight);
return (
<div
className={className}
style={{ position: "absolute", inset: 0, overflow: "hidden" }}
>
<svg
width="100%"
height="100%"
viewBox={`0 0 ${width} ${height}`}
style={{ position: "absolute", inset: 0 }}
>
<g
transform={`translate(${toX(0)} ${toY(0)}) scale(${unit})`}
fill="none"
>
{line ? (
<path
d={line}
stroke={lineColor}
strokeWidth={lineWidth}
strokeLinecap="round"
strokeLinejoin="round"
/>
) : null}
{tipOpacity > 0 ? (
<circle
cx={tip.x}
cy={tip.y}
r={lineWidth * 1.6}
fill={lineColor}
opacity={tipOpacity}
/>
) : null}
</g>
</svg>
{chars.map((char, j) => {
const arc = getPathRideArc(head, centers[j], textWidth, fontSize);
const fade = getPathRideFade(arc, fontSize);
if (fade <= 0) return null;
const pose = getPathRidePoint(samples, arc, k, straight, lift);
return (
<span
key={j}
style={{
position: "absolute",
left: 0,
top: 0,
fontFamily,
fontSize: size,
lineHeight: 1,
fontWeight,
fontVariationSettings: `"wght" ${fontWeight}`,
color,
whiteSpace: "pre",
opacity: fade,
transformOrigin: "0 0",
transform: `translate(${toX(pose.x)}px, ${toY(pose.y)}px) rotate(${pose.angle}rad) translate(-50%, ${-metrics.baseline * size}px)`,
}}
>
{char}
</span>
);
})}
</div>
);
}

View File

@@ -0,0 +1,145 @@
"use client";
import { useCurrentFrame } from "remotion";
export interface PerspectiveMarqueeProps {
items?: string[];
fontSize?: number;
color?: string;
fontWeight?: number;
pixelsPerFrame?: number;
rotateY?: number;
rotateX?: number;
perspective?: number;
fadeColor?: string;
speed?: number;
className?: string;
}
const FONT_FAMILY =
"var(--font-geist-sans), -apple-system, BlinkMacSystemFont, sans-serif";
const DEFAULT_ITEMS = [
"Vercel",
"Linear",
"Stripe",
"Figma",
"Notion",
"Raycast",
"Arc",
"Cursor",
];
export function PerspectiveMarquee({
items = DEFAULT_ITEMS,
fontSize = 84,
color = "#fafafa",
fontWeight = 700,
pixelsPerFrame = 2,
rotateY = -28,
rotateX = 8,
perspective = 1200,
fadeColor = "#050505",
speed = 1,
className,
}: PerspectiveMarqueeProps) {
const frame = useCurrentFrame() * speed;
// Approximate width of one full item set so the modulo wraps cleanly.
const itemPadding = fontSize * 0.9;
const approxItemWidth = items.reduce(
(acc, item) => acc + item.length * fontSize * 0.6 + itemPadding,
0,
);
const offset = -((frame * pixelsPerFrame) % approxItemWidth);
// Render the row 3x so the loop is seamless even when rotated in 3D.
const rendered = [...items, ...items, ...items];
return (
<div
className={className}
style={{
position: "absolute",
inset: 0,
display: "flex",
alignItems: "center",
justifyContent: "center",
overflow: "hidden",
perspective: `${perspective}px`,
}}
>
<div
style={{
width: "100%",
display: "flex",
alignItems: "center",
justifyContent: "flex-start",
transform: `rotateX(${rotateX}deg) rotateY(${rotateY}deg)`,
transformStyle: "preserve-3d",
}}
>
<div
style={{
display: "flex",
whiteSpace: "nowrap",
translate: `${offset}px`,
}}
>
{rendered.map((item, i) => {
// Approximate this item's center X (relative to the marquee row,
// including the rolling offset). Used to dial in depth-of-field blur
// and opacity by horizontal position on screen.
const itemCenter =
i * (approxItemWidth / items.length) +
approxItemWidth / items.length / 2 +
offset;
// Normalize roughly to [-1, 1] across a 1280px viewport.
const norm = (itemCenter - 640) / 640;
const distance = Math.min(1, Math.abs(norm));
const blurPx = distance * 6;
const opacity = 1 - distance * 0.4;
return (
<span
key={i}
style={{
display: "inline-block",
fontFamily: FONT_FAMILY,
fontSize,
fontWeight,
color,
letterSpacing: "-0.03em",
paddingRight: itemPadding,
filter: `blur(${blurPx}px)`,
opacity,
}}
>
{item}
</span>
);
})}
</div>
</div>
{/* Vignette to fade marquee edges into background */}
<div
style={{
position: "absolute",
inset: 0,
pointerEvents: "none",
background: `linear-gradient(90deg, ${fadeColor} 0%, transparent 18%, transparent 82%, ${fadeColor} 100%)`,
}}
/>
<div
style={{
position: "absolute",
inset: 0,
pointerEvents: "none",
background: `linear-gradient(180deg, ${fadeColor} 0%, transparent 25%, transparent 75%, ${fadeColor} 100%)`,
}}
/>
</div>
);
}

View File

@@ -0,0 +1,145 @@
"use client";
import { Easing, interpolate, useCurrentFrame } from "remotion";
export interface SheenSlideInProps {
text: string;
exitAt?: number;
fontSize?: number;
baseColor?: string;
sheenColor?: string;
fontWeight?: number;
speed?: number;
className?: string;
}
const SETTLE_AMP_EM = 1.8;
const SETTLE_TAU = 2.5;
const CREEP_AMP_EM = 0.28;
const CREEP_TAU = 12;
const FADE_FRAMES = 4;
const SHEEN_IN_START = 0;
const SHEEN_IN_END = 4;
const SHEEN_SWEEP_END = 48;
const SHEEN_OUT_START = 48;
const SHEEN_OUT_END = 58;
const EXIT_FRAMES = 4;
const EXIT_SCALE = 0.9;
export function sheenSlideInLength(exitAt = 60): number {
return exitAt + EXIT_FRAMES;
}
function travelEm(frame: number): number {
return (
SETTLE_AMP_EM * Math.exp(-frame / SETTLE_TAU) +
CREEP_AMP_EM * Math.exp(-frame / CREEP_TAU)
);
}
const exitEasing = Easing.out(Easing.quad);
export function SheenSlideIn({
text,
exitAt = 60,
fontSize = 72,
baseColor = "#18181b",
sheenColor = "#4f8ef7",
fontWeight = 400,
speed = 1,
className,
}: SheenSlideInProps) {
const frame = useCurrentFrame() * speed;
const x = fontSize * travelEm(frame);
const exit = interpolate(frame, [exitAt, exitAt + EXIT_FRAMES], [0, 1], {
extrapolateLeft: "clamp",
extrapolateRight: "clamp",
easing: exitEasing,
});
const opacity = interpolate(frame, [0, FADE_FRAMES], [0, 1], {
extrapolateLeft: "clamp",
extrapolateRight: "clamp",
});
const sheenOpacity =
interpolate(frame, [SHEEN_IN_START, SHEEN_IN_END], [0, 1], {
extrapolateLeft: "clamp",
extrapolateRight: "clamp",
}) *
interpolate(frame, [SHEEN_OUT_START, SHEEN_OUT_END], [1, 0], {
extrapolateLeft: "clamp",
extrapolateRight: "clamp",
});
const sheenPosition = interpolate(frame, [0, SHEEN_SWEEP_END], [160, -60], {
extrapolateLeft: "clamp",
extrapolateRight: "clamp",
easing: Easing.bezier(0.42, 0, 0.58, 1),
});
const textStyle: React.CSSProperties = {
fontSize,
fontWeight,
letterSpacing: "-0.02em",
lineHeight: 1.1,
margin: 0,
fontFamily:
"var(--font-geist-sans, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif)",
};
if (exit >= 1) {
return (
<div
style={{ position: "absolute", inset: 0, background: "transparent" }}
/>
);
}
return (
<div
style={{
position: "absolute",
inset: 0,
display: "flex",
alignItems: "center",
justifyContent: "center",
whiteSpace: "nowrap",
background: "transparent",
}}
>
<div
style={{
position: "relative",
display: "inline-block",
opacity,
translate: `${x}px 0`,
scale: `${1 - (1 - EXIT_SCALE) * exit}`,
}}
>
<span className={className} style={{ ...textStyle, color: baseColor }}>
{text}
</span>
<span
aria-hidden
style={{
...textStyle,
position: "absolute",
inset: 0,
color: "transparent",
backgroundClip: "text",
WebkitBackgroundClip: "text",
backgroundImage: `linear-gradient(100deg, transparent 25%, ${sheenColor} 50%, transparent 75%)`,
backgroundSize: "250% 100%",
backgroundPosition: `${sheenPosition}% 50%`,
opacity: sheenOpacity,
}}
>
{text}
</span>
</div>
</div>
);
}

View File

@@ -0,0 +1,92 @@
"use client";
import { Easing, interpolate, useCurrentFrame } from "remotion";
export interface SoftBlurInProps {
text: string;
blur?: number;
fontSize?: number;
color?: string;
fontWeight?: number;
speed?: number;
className?: string;
}
export function SoftBlurIn({
text,
blur = 12,
fontSize = 72,
color = "#171717",
fontWeight = 600,
speed = 1,
className,
}: SoftBlurInProps) {
const frame = useCurrentFrame() * speed;
const chars = Array.from(text);
const charDurationFrames = 27;
const charTravelFrames = 9;
const staggerFrames = 1;
return (
<div
style={{
position: "absolute",
inset: 0,
display: "flex",
alignItems: "center",
justifyContent: "center",
background: "transparent",
}}
>
<span
className={className}
style={{
fontSize,
fontWeight,
color,
letterSpacing: "-0.05em",
fontFamily:
"var(--font-geist-sans), -apple-system, BlinkMacSystemFont, sans-serif",
}}
>
{chars.map((char, i) => {
const local = frame - i * staggerFrames;
const easing = Easing.bezier(0.22, 1, 0.36, 1);
const opacity = interpolate(local, [0, charDurationFrames], [0, 1], {
extrapolateLeft: "clamp",
extrapolateRight: "clamp",
easing,
});
const y = interpolate(local, [0, charTravelFrames], [16, 0], {
extrapolateLeft: "clamp",
extrapolateRight: "clamp",
easing,
});
const blurAmount = interpolate(
local,
[0, charDurationFrames],
[blur, 0],
{ extrapolateLeft: "clamp", extrapolateRight: "clamp", easing },
);
return (
<span
key={i}
style={{
display: "inline-block",
whiteSpace: "pre",
backfaceVisibility: "hidden",
transformOrigin: "50% 55%",
opacity,
translate: `0 ${y}px`,
filter: `blur(${blurAmount}px)`,
}}
>
{char}
</span>
);
})}
</span>
</div>
);
}

View File

@@ -0,0 +1,71 @@
"use client";
import { interpolate, spring, useCurrentFrame, useVideoConfig } from "remotion";
export interface TrackingInProps {
text: string;
startTracking?: number;
startBlur?: number;
fontSize?: number;
color?: string;
fontWeight?: number;
speed?: number;
className?: string;
}
export function TrackingIn({
text,
startTracking = 0.5,
startBlur = 12,
fontSize = 96,
color = "#171717",
fontWeight = 700,
speed = 1,
className,
}: TrackingInProps) {
const frame = useCurrentFrame() * speed;
const { fps } = useVideoConfig();
const t = spring({
frame,
fps,
config: { damping: 18, stiffness: 90 },
});
const letterSpacing = `${interpolate(t, [0, 1], [startTracking, -0.03])}em`;
const blurAmount = interpolate(t, [0, 1], [startBlur, 0]);
const opacity = interpolate(frame, [0, 15], [0, 1], {
extrapolateLeft: "clamp",
extrapolateRight: "clamp",
});
return (
<div
style={{
position: "absolute",
inset: 0,
display: "flex",
alignItems: "center",
justifyContent: "center",
background: "white",
}}
>
<span
className={className}
style={{
fontSize,
fontWeight,
color,
letterSpacing,
opacity,
filter: `blur(${blurAmount}px)`,
fontFamily:
"var(--font-geist-sans), -apple-system, BlinkMacSystemFont, sans-serif",
whiteSpace: "nowrap",
}}
>
{text}
</span>
</div>
);
}

53
src/remocn/zoom-blur.tsx Normal file
View File

@@ -0,0 +1,53 @@
"use client";
import type {
TransitionPresentation,
TransitionPresentationComponentProps,
} from "@remotion/transitions";
import type React from "react";
import { AbsoluteFill } from "remotion";
export type ZoomBlurProps = {
blur?: number;
rise?: number;
};
const ZoomBlurPresentation: React.FC<
TransitionPresentationComponentProps<ZoomBlurProps>
> = ({
children,
presentationProgress,
presentationDirection,
passedProps,
}) => {
const { blur = 16, rise = 0 } = passedProps;
const entering = presentationDirection === "entering";
const p = presentationProgress;
const style: React.CSSProperties = entering
? {
opacity: p,
transform: `scale(${0.9 + p * 0.1})${
rise > 0 ? ` translateY(${(1 - p) * rise}px)` : ""
}`,
filter: p < 1 ? `blur(${(1 - p) * blur}px)` : undefined,
}
: {
opacity: 1 - p,
transform: `scale(${1 + p * 0.12})${
rise > 0 ? ` translateY(${-p * rise}px)` : ""
}`,
filter: p > 0 ? `blur(${p * blur}px)` : undefined,
};
return <AbsoluteFill style={style}>{children}</AbsoluteFill>;
};
export function zoomBlur(
props: ZoomBlurProps = {},
): TransitionPresentation<ZoomBlurProps> {
return {
component: ZoomBlurPresentation,
props,
};
}