Production-ready animations, transitions, backgrounds, and scenes for Remotion
TypeScript ai-agentsclaude-codedemo-videomcpmcp-servermodel-context-protocolmotion-designproduct-demoreactremotionshadcnvideo
{
"type": "remotion-element",
"version": 1,
"element": {
"assets": [],
"dependencies": [
{
"name": "@remotion/google-fonts",
"version": null
}
],
"dimensions": null,
"displayName": "Uptime Strip",
"initialProps": null,
"slug": "uptime-strip",
"sourceCode": "import { loadFont as loadSans } from \"@remotion/google-fonts/InstrumentSans\";\nimport { loadFont as loadSerif } from \"@remotion/google-fonts/InstrumentSerif\";\nimport { forwardRef, useId, useImperativeHandle, useRef, type ComponentProps } from \"react\";\nimport { AbsoluteFill, Easing, Interactive, Sequence, interpolate, interpolateColors, useCurrentFrame, useVideoConfig, type InteractiveBaseProps, type InteractiveTransformProps, type InteractivitySchema, type SequenceControls } from \"remotion\";\n\nconst { fontFamily: sans } = loadSans(\"normal\", {\n weights: [\"400\", \"500\"],\n subsets: [\"latin\"],\n});\nconst { fontFamily: serif } = loadSerif(\"italic\", {\n weights: [\"400\"],\n subsets: [\"latin\"],\n});\n\ninterface UptimeStripProps {\n value?: string;\n days?: number;\n incidents?: number[];\n label?: string;\n accent?: string;\n theme?: \"dark\" | \"light\";\n speed?: number;\n}\n\nconst EASE_IO = Easing.bezier(0.65, 0, 0.35, 1);\nconst EASE_OUT = Easing.bezier(0.22, 1, 0.36, 1);\nconst CLAMP = {\n extrapolateLeft: \"clamp\",\n extrapolateRight: \"clamp\",\n} as const;\n\nconst THEMES = {\n dark: {\n bg: \"#0A0A0B\",\n fg: \"#F3F2EF\",\n muted: \"#8B8A90\",\n soft: \"#6A696F\",\n track: \"rgba(255,255,255,0.09)\",\n bar: \"#4A494F\",\n flash: \"#E9E8E4\",\n dim: \"#3A393F\",\n grain: 0.06,\n // gradients.sh \"aurora\": bg #03050b, [#a0f0c8, #3fb5a3, #5147b6, #b25c9c]\n aurora: [\"#5147b6\", \"#3fb5a3\", \"#a0f0c8\"],\n },\n light: {\n bg: \"#F5F4F0\",\n fg: \"#121214\",\n muted: \"#6E6C67\",\n soft: \"#9A9893\",\n track: \"rgba(18,18,20,0.09)\",\n bar: \"#C4C2BC\",\n flash: \"#2A2927\",\n dim: \"#D9D7D1\",\n grain: 0.045,\n aurora: [\"#5147b6\", \"#2f9c8c\", \"#3fb5a3\"],\n },\n} as const;\n\nconst SWEEP_START = 6;\nconst SWEEP_LEN = 34;\nconst GROW = 12;\nconst SETTLE = 54;\nconst SETTLE_SPREAD = 16;\nconst LAND = 60;\n\nfunction Grain({ opacity }: { opacity: number }) {\n const id = `g${useId().replace(/[^a-zA-Z0-9_-]/g, \"\")}`;\n return (\n <svg\n width=\"100%\"\n height=\"100%\"\n style={{ position: \"absolute\", inset: 0, opacity }}\n aria-hidden\n >\n <filter id={id}>\n <feTurbulence\n type=\"fractalNoise\"\n baseFrequency=\"0.9\"\n numOctaves={2}\n seed={17}\n stitchTiles=\"stitch\"\n />\n <feColorMatrix values=\"0 0 0 0 0.5 0 0 0 0 0.5 0 0 0 0 0.5 0 0 0 0.9 0\" />\n </filter>\n <rect width=\"100%\" height=\"100%\" filter={`url(#${id})`} />\n </svg>\n );\n}\n\nfunction RisingText({\n text,\n t,\n start,\n stagger,\n fontSize,\n color,\n family,\n italic = false,\n}: {\n text: string;\n t: number;\n start: number;\n stagger: number;\n fontSize: number;\n color: string;\n family: string;\n italic?: boolean;\n}) {\n const side = fontSize * (italic ? 0.12 : 0.06);\n return (\n <span\n style={{\n display: \"inline-flex\",\n color,\n fontFamily: family,\n fontStyle: italic ? \"italic\" : \"normal\",\n }}\n >\n {Array.from(text).map((ch, i) => {\n const k = interpolate(\n t,\n [start + i * stagger, start + i * stagger + 22],\n [0, 1],\n { ...CLAMP, easing: EASE_OUT },\n );\n return (\n <span\n key={i}\n style={{\n display: \"inline-block\",\n overflow: \"hidden\",\n paddingBottom: fontSize * 0.08,\n marginBottom: -fontSize * 0.08,\n paddingLeft: side,\n paddingRight: side,\n marginLeft: -side,\n marginRight: -side,\n }}\n >\n <span\n style={{\n display: \"inline-block\",\n whiteSpace: \"pre\",\n transform: `translateY(${(1 - k) * 0.7 * fontSize}px)`,\n opacity: interpolate(k, [0, 0.45], [0, 1], CLAMP),\n }}\n >\n {ch}\n </span>\n </span>\n );\n })}\n </span>\n );\n}\n\nfunction UptimeStripBase({\n value = \"99.99%\",\n days = 90,\n incidents = [27, 63],\n label = \"uptime\",\n accent = \"#3B5BFD\",\n theme = \"dark\",\n speed = 1,\n}: UptimeStripProps) {\n const t = useCurrentFrame() * speed;\n const { width, height } = useVideoConfig();\n const u = Math.min(width / 1280, height / 720);\n const p = THEMES[theme];\n const n = Math.max(7, Math.min(180, Math.round(days)));\n const down = new Set(incidents.map((i) => Math.round(i)));\n\n const stripW = width * 0.72;\n const pitch = stripW / n;\n const barW = Math.max(2 * u, pitch * 0.56);\n const barH = 74 * u;\n const left = (width - stripW) / 2 + (pitch - barW) / 2;\n\n const glide = interpolate(t, [SETTLE - 6, SETTLE + 26], [0, 1], {\n ...CLAMP,\n easing: EASE_IO,\n });\n const stripY = height / 2 + glide * 64 * u;\n const push = interpolate(t, [0, 130], [0.965, 1.005], {\n ...CLAMP,\n easing: EASE_IO,\n });\n const stage = interpolate(t, [0, 8], [0.45, 1], CLAMP);\n\n const gid = `up${useId().replace(/[^a-zA-Z0-9_-]/g, \"\")}`;\n const drift = interpolate(t, [SETTLE, 130], [0, 1], {\n ...CLAMP,\n easing: EASE_IO,\n });\n\n const frontAt = (i: number) =>\n SWEEP_START + (n > 1 ? (i / (n - 1)) * SWEEP_LEN : 0);\n const settleAt = (i: number) =>\n SETTLE + (n > 1 ? (i / (n - 1)) * SETTLE_SPREAD : 0);\n\n const front = interpolate(\n t,\n [SWEEP_START, SWEEP_START + SWEEP_LEN],\n [0, 1],\n CLAMP,\n );\n const frontX = left + front * (n - 1) * pitch + barW / 2;\n const scanO =\n interpolate(t, [SWEEP_START, SWEEP_START + 4], [0, 1], CLAMP) *\n interpolate(\n t,\n [SWEEP_START + SWEEP_LEN, SWEEP_START + SWEEP_LEN + 10],\n [1, 0],\n CLAMP,\n );\n\n const headSize = 132 * u;\n const headTop = stripY - barH / 2 - 44 * u - headSize * 0.92;\n const valueChars = Array.from(value).length;\n const wordStart = LAND + valueChars * 2 + 4;\n\n const capA = interpolate(t, [4, 18], [0, 1], { ...CLAMP, easing: EASE_OUT });\n const capB = interpolate(\n t,\n [SWEEP_START + SWEEP_LEN - 4, SWEEP_START + SWEEP_LEN + 10],\n [0, 1],\n { ...CLAMP, easing: EASE_OUT },\n );\n\n return (\n <AbsoluteFill style={{ background: p.bg, overflow: \"hidden\" }}>\n <AbsoluteFill\n style={{\n transform: `scale(${push})`,\n transformOrigin: \"50% 55%\",\n opacity: stage,\n }}\n >\n <svg\n width={width}\n height={height}\n style={{ position: \"absolute\", inset: 0 }}\n aria-hidden\n >\n <defs>\n <linearGradient\n id={gid}\n gradientUnits=\"userSpaceOnUse\"\n x1={left - stripW * 0.06 * drift}\n y1={stripY + barH}\n x2={left + stripW * (1.02 - 0.04 * drift)}\n y2={stripY - barH}\n >\n <stop offset={0} stopColor={p.aurora[0]} />\n <stop offset={0.55} stopColor={p.aurora[1]} />\n <stop offset={1} stopColor={p.aurora[2]} />\n </linearGradient>\n </defs>\n {Array.from({ length: n }, (_, i) => {\n const x = left + i * pitch;\n const isDown = down.has(i);\n const g = interpolate(t, [frontAt(i), frontAt(i) + GROW], [0, 1], {\n ...CLAMP,\n easing: EASE_OUT,\n });\n const flash = interpolate(\n t,\n [frontAt(i), frontAt(i) + 2, frontAt(i) + 16],\n [0, 1, 0],\n CLAMP,\n );\n const s = interpolate(t, [settleAt(i), settleAt(i) + 10], [0, 1], {\n ...CLAMP,\n easing: EASE_IO,\n });\n const bump = Math.sin(Math.PI * s) * 0.09;\n const full = isDown ? barH * 0.4 : barH;\n const h = (barW + (full - barW) * g) * (1 + bump);\n const base = isDown ? p.dim : p.bar;\n const neutral = interpolateColors(\n flash,\n [0, 1],\n [base, isDown ? p.soft : p.flash],\n );\n const opacity = isDown ? 1 - 0.35 * s : 1;\n return (\n <g key={i}>\n <rect\n x={x}\n y={stripY - barH / 2}\n width={barW}\n height={barH}\n rx={barW / 2}\n fill={p.track}\n opacity={1 - g}\n />\n <rect\n x={x}\n y={stripY - h / 2}\n width={barW}\n height={h}\n rx={barW / 2}\n fill={neutral}\n opacity={g > 0 ? opacity : 0}\n />\n {!isDown && s > 0 ? (\n <rect\n x={x}\n y={stripY - h / 2}\n width={barW}\n height={h}\n rx={barW / 2}\n fill={`url(#${gid})`}\n opacity={s}\n />\n ) : null}\n </g>\n );\n })}\n <line\n x1={frontX + pitch * 0.9}\n y1={stripY - barH * 0.78}\n x2={frontX + pitch * 0.9}\n y2={stripY + barH * 0.78}\n stroke={accent}\n strokeWidth={Math.max(1, 1.5 * u)}\n opacity={scanO * 0.8}\n />\n </svg>\n\n <div\n style={{\n position: \"absolute\",\n left: 0,\n right: 0,\n top: headTop,\n display: \"flex\",\n justifyContent: \"center\",\n alignItems: \"baseline\",\n gap: headSize * 0.2,\n fontWeight: 400,\n fontSize: headSize,\n lineHeight: 0.92,\n letterSpacing: \"-0.04em\",\n fontVariantNumeric: \"tabular-nums\",\n whiteSpace: \"nowrap\",\n }}\n >\n <RisingText\n text={value}\n t={t}\n start={LAND}\n stagger={2}\n fontSize={headSize}\n color={p.fg}\n family={sans}\n />\n <span\n style={{ fontSize: headSize * 1.12, letterSpacing: \"-0.015em\" }}\n >\n <RisingText\n text={label}\n t={t}\n start={wordStart}\n stagger={1}\n fontSize={headSize * 1.12}\n color={p.muted}\n family={serif}\n italic\n />\n </span>\n </div>\n\n <div\n style={{\n position: \"absolute\",\n left: (width - stripW) / 2 + (pitch - barW) / 2,\n width: stripW - (pitch - barW),\n top: stripY + barH / 2 + 20 * u,\n display: \"flex\",\n justifyContent: \"space-between\",\n fontFamily: sans,\n fontWeight: 400,\n fontSize: 17 * u,\n letterSpacing: \"0\",\n color: p.muted,\n fontVariantNumeric: \"tabular-nums\",\n whiteSpace: \"nowrap\",\n }}\n >\n <span\n style={{\n opacity: capA,\n transform: `translateY(${(1 - capA) * 8 * u}px)`,\n }}\n >\n {n} days ago\n </span>\n <span\n style={{\n opacity: capB,\n transform: `translateY(${(1 - capB) * 8 * u}px)`,\n }}\n >\n Today\n </span>\n </div>\n </AbsoluteFill>\n\n <AbsoluteFill\n style={{\n background: `radial-gradient(ellipse 80% 80% at 50% 50%, transparent 62%, ${p.bg} 100%)`,\n opacity: 0.6,\n }}\n />\n <Grain opacity={p.grain} />\n </AbsoluteFill>\n );\n}\n\nconst elementSchema = {\n ...Interactive.baseSchema,\n theme: {\n type: \"enum\",\n default: \"dark\",\n variants: {\n dark: {},\n light: {},\n },\n description: \"Theme\",\n },\n accent: {\n type: \"color\",\n default: \"#3B5BFD\",\n description: \"Accent\",\n },\n value: {\n type: \"text-content\",\n default: \"99.99%\",\n description: \"Value\",\n },\n label: {\n type: \"text-content\",\n default: \"uptime\",\n description: \"Label\",\n },\n days: {\n type: \"number\",\n default: 90,\n min: 0,\n max: 270,\n step: 1,\n description: \"Days\",\n hiddenFromList: false,\n },\n speed: {\n type: \"number\",\n default: 1,\n min: 0.25,\n max: 4,\n step: 0.25,\n description: \"Speed\",\n hiddenFromList: false,\n },\n ...Interactive.transformSchema,\n} as const satisfies InteractivitySchema;\n\nconst ELEMENT_PROP_KEYS = new Set([\"theme\",\"accent\",\"value\",\"label\",\"days\",\"speed\"]);\n\nconst ELEMENT_PROP_DEFAULTS: Record<string, unknown> = {\n theme: \"dark\",\n accent: \"#3B5BFD\",\n value: \"99.99%\",\n label: \"uptime\",\n days: 90,\n speed: 1,\n};\n\ntype UptimeStripElementProps = InteractiveBaseProps &\n InteractiveTransformProps &\n ComponentProps<typeof UptimeStripBase>;\n\nconst UptimeStripInner = forwardRef<\n HTMLDivElement,\n UptimeStripElementProps & { readonly controls: SequenceControls | undefined }\n>(({ controls, name, style, ...rest }, ref) => {\n const outlineRef = useRef<HTMLDivElement>(null);\n useImperativeHandle(ref, () => outlineRef.current as HTMLDivElement, []);\n const componentProps: Record<string, unknown> = { ...ELEMENT_PROP_DEFAULTS };\n const sequenceProps: Record<string, unknown> = {};\n for (const [key, value] of Object.entries(rest)) {\n if (ELEMENT_PROP_KEYS.has(key)) {\n if (value !== undefined) componentProps[key] = value;\n } else {\n sequenceProps[key] = value;\n }\n }\n return (\n <Sequence\n layout=\"none\"\n {...sequenceProps}\n controls={controls}\n name={name ?? \"<UptimeStrip>\"}\n outlineRef={outlineRef}\n >\n <div\n ref={outlineRef}\n style={{\n position: \"relative\",\n width: \"100%\",\n height: \"100%\",\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n ...style,\n }}\n >\n <UptimeStripBase\n {...(componentProps as unknown as ComponentProps<typeof UptimeStripBase>)}\n />\n </div>\n </Sequence>\n );\n});\n\nexport const UptimeStrip = Interactive.withSchema({\n Component: UptimeStripInner,\n componentName: \"<UptimeStrip>\",\n componentIdentity: null,\n schema: elementSchema,\n supportsEffects: false,\n});\n",
"durationInFrames": 103,
"installationMode": "component-owned-sequence"
},
"durationInFrames": 103
}