Spaces:
Runtime error
Runtime error
Download renderer/src/compositions/Starfield.tsx from firebird-technologies/NoteStack-Test: direct link, hf CLI and curl.
- Browser
- Download file 1.26 kB
-
https://huggingface.co/spaces/firebird-technologies/NoteStack-Test/resolve/main/renderer/src/compositions/Starfield.tsx
- Command line
-
hf download hf://spaces/firebird-technologies/NoteStack-Test/renderer/src/compositions/Starfield.tsx
-
curl -L -o Starfield.tsx https://huggingface.co/spaces/firebird-technologies/NoteStack-Test/resolve/main/renderer/src/compositions/Starfield.tsx
1.26 kB
| import { AbsoluteFill, random, useCurrentFrame, useVideoConfig } from "remotion"; | |
| import { theme } from "../theme"; | |
| /** Deterministic starfield (seeded with remotion's random) so every render frame is reproducible. */ | |
| export function Starfield({ count = 140, accent = theme.blue }: { count?: number; accent?: string }) { | |
| const frame = useCurrentFrame(); | |
| const { width, height, fps } = useVideoConfig(); | |
| const t = frame / fps; | |
| return ( | |
| <AbsoluteFill style={{ backgroundColor: theme.black }}> | |
| <AbsoluteFill | |
| style={{ | |
| background: `radial-gradient(60% 40% at 50% 105%, ${accent}33, transparent 70%), | |
| radial-gradient(40% 30% at 80% 15%, ${accent}1a, transparent 70%)`, | |
| }} | |
| /> | |
| <svg width={width} height={height}> | |
| {Array.from({ length: count }).map((_, i) => { | |
| const x = random(`x${i}`) * width; | |
| const y = (random(`y${i}`) * height + t * (4 + random(`s${i}`) * 10)) % height; | |
| const r = 0.6 + random(`r${i}`) * 1.6; | |
| const twinkle = 0.45 + 0.55 * Math.abs(Math.sin(t * (0.6 + random(`p${i}`)) + i)); | |
| return <circle key={i} cx={x} cy={y} r={r} fill={theme.white} opacity={twinkle} />; | |
| })} | |
| </svg> | |
| </AbsoluteFill> | |
| ); | |
| } | |