Motion & effects / Animated backgrounds
Glowing Orb Media Frame
Black rounded frame containing a centered 3D or particle object (dotted blue sphere, chrome arrows) with a soft blue radial aura bleeding into black; blue neon outlined UI cards use the same glow treatment.
Rebuilt from framer.com/updates in the Obsidian Canvas style.
Looks exactly like framer.com: brings its fonts and colours, namespaced so your own theme stays untouched.
Restyled to your project: uses your shadcn colours, fonts and radius, so it matches the rest of your app. Layout, type sizes and motion stay as designed.
Usage
Props: caption, linkText, captionEnd, linkHref. The orb is a canvas-drawn rotating dotted sphere with a breathing blue aura, standing in for the looping muted video; it stops animating under reduced motion.
components/glow-orb-media.tsx
"use client"; import { useLayoutEffect, useState, type CSSProperties, type ElementType, type ReactNode, type RefObject } from "react"; import { useEffect, useRef } from "react"; export default function GlowingOrbMediaFrame({ caption = "We rebuilt our assistant's engine to handle entire projects in one pass. It reads your files, plans the work, and applies edits while the next steps are still being drafted, so progress shows up sooner. Early tests show far fewer steps per task, and the same tools now reach outside apps too. Read the", linkText = "engineering write-up", captionEnd = "for a closer look at the new engine.", linkHref = "#", }: { caption?: string; linkText?: string; captionEnd?: string; linkHref?: string; }) { const ref = useRef<HTMLCanvasElement>(null); useEffect(() => { const canvas = ref.current; if (!canvas) return; const ctx = canvas.getContext("2d"); if (!ctx) return; const W = 800, H = 450; canvas.width = W; canvas.height = H; const reduce = window.matchMedia("(prefers-reduced-motion: reduce)").matches; const pts: { x: number; y: number; z: number }[] = []; const N = 900; for (let i = 0; i < N; i++) { const y = 1 - (i / (N - 1)) * 2; const r = Math.sqrt(1 - y * y); const t = i * 2.399963; pts.push({ x: Math.cos(t) * r, y, z: Math.sin(t) * r }); } let raf = 0; const draw = (time: number) => { const a = time / 6000; ctx.clearRect(0, 0, W, H); const breathe = 0.85 + 0.15 * Math.sin(time / 1200); const g = ctx.createRadialGradient(W / 2, H / 2, 20, W / 2, H / 2, 210); g.addColorStop(0, `rgba(70,90,255,${0.55 * breathe})`); g.addColorStop(0.5, `rgba(30,40,220,${0.3 * breathe})`); g.addColorStop(1, "rgba(0,0,0,0)"); ctx.fillStyle = g; ctx.fillRect(0, 0, W, H); const ca = Math.cos(a), sa = Math.sin(a); for (const p of pts) { const x = p.x * ca + p.z * sa; const z = -p.x * sa + p.z * ca; if (z < -0.1) continue; const s = 135; const px = W / 2 + x * s; const py = H / 2 + p.y * s; const rad = 0.8 + z * 2.6; ctx.beginPath(); ctx.arc(px, py, rad, 0, Math.PI * 2); ctx.fillStyle = `rgba(${170 + z * 80},${190 + z * 60},255,${0.3 + z * 0.7})`; ctx.fill(); } if (!reduce) raf = requestAnimationFrame(draw); }; raf = requestAnimationFrame(draw); return () => cancelAnimationFrame(raf); }, []); return ( <figure className="w-full max-w-[800px] bg-canvas font-sans text-secondary"> <Reveal from="scale"> <div className="relative aspect-video overflow-hidden rounded-xl border border-hairline bg-canvas"> <canvas ref={ref} role="img" aria-label="Glowing dotted blue sphere slowly rotating" className="absolute inset-0 h-full w-full" /> </div> </Reveal> <figcaption className="mt-8 text-lead text-secondary"> {caption}{" "} <a href={linkHref} className="text-primary underline decoration-hairline underline-offset-4 transition-colors duration-link-brighten ease-link-brighten hover:decoration-primary focus-visible:outline focus-visible:outline-2 focus-visible:outline-accent-blue">{linkText}</a>{" "} {captionEnd} </figcaption> </figure> ); } // ---- Yoink motion (inlined, no dependencies): Reveal ---- const YK_EASE = "cubic-bezier(0.16, 1, 0.3, 1)"; const useYkLayoutEffect = typeof window === "undefined" ? useEffect : useLayoutEffect; function ykReducedMotion(): boolean { return typeof window !== "undefined" && !!window.matchMedia?.("(prefers-reduced-motion: reduce)").matches; } // "idle": untouched (visible) · "hidden": waiting below the fold · "shown": play the entrance. // Content is only hidden once we know we can show it again (IntersectionObserver exists, motion allowed, // and there is a box to watch), and a safety net reveals anything on screen that is still hidden. type YkRevealState = "idle" | "hidden" | "shown"; function useYkReveal(ref: RefObject<Element | null>, once = true): YkRevealState { const [state, setState] = useState<YkRevealState>("idle"); useYkLayoutEffect(() => { const el = ref.current; if (!el || ykReducedMotion() || typeof IntersectionObserver === "undefined") return; // watch the element's own box, or its children when it has none (display: contents) const boxes = () => (getComputedStyle(el).display === "contents" ? Array.from(el.children) : [el]); const onScreen = (t: Element) => { const r = t.getBoundingClientRect(); return (r.width > 0 || r.height > 0) && r.bottom > 0 && r.right > 0 && r.top < window.innerHeight && r.left < window.innerWidth; }; if (!boxes().some((t) => t.getBoundingClientRect().width > 0 || t.getBoundingClientRect().height > 0)) return; // e.g. hidden at mount: leave it visible let shown = false; const show = (v: boolean) => { if (v !== shown) (shown = v), setState(v ? "shown" : "hidden"); }; setState("hidden"); const inView = new Set<Element>(); const io = new IntersectionObserver((entries) => { for (const e of entries) { if (e.isIntersecting) inView.add(e.target); else inView.delete(e.target); } if (inView.size) { show(true); if (once) io.disconnect(); } else if (!once) show(false); }); const watched = new Set<Element>(); const watch = () => boxes().forEach((t) => !watched.has(t) && (watched.add(t), io.observe(t))); watch(); // safety net: styles that land after mount (display: contents) get watched too, and nothing // stays hidden for more than a moment while it is actually on screen const start = Date.now(); const net = setInterval(() => { if (shown) return once && clearInterval(net); watch(); if (Date.now() - start > 2400 && boxes().some(onScreen)) show(true); }, 600); return () => { io.disconnect(); clearInterval(net); }; }, [once]); return state; } type YkRevealFrom = "up" | "down" | "left" | "right" | "scale" | "blur" | "none"; /** Fades content in as it scrolls into view. */ function Reveal({ children, from = "up", delay = 0, duration = 700, distance = 24, once = true, as = "div", className, style, }: { children?: ReactNode; from?: YkRevealFrom; delay?: number; duration?: number; distance?: number; once?: boolean; as?: ElementType; className?: string; style?: CSSProperties; }) { const Tag = as; const ref = useRef<HTMLElement>(null); const state = useYkReveal(ref, once); const hidden = state === "hidden"; const offset = { up: `translate3d(0, ${distance}px, 0)`, down: `translate3d(0, ${-distance}px, 0)`, left: `translate3d(${-distance}px, 0, 0)`, right: `translate3d(${distance}px, 0, 0)`, scale: "scale(0.94)", blur: `translate3d(0, ${distance / 2}px, 0)`, none: "none", }[from]; const t = `${duration}ms ${YK_EASE} ${delay}ms`; return ( <Tag ref={ref} className={className} style={{ ...style, ...(hidden && { opacity: 0, transform: offset, filter: from === "blur" ? "blur(12px)" : undefined }), ...(state === "shown" && { transition: `opacity ${t}, transform ${t}, filter ${t}` }), }} > {children} </Tag> ); }"use client"; import { useLayoutEffect, useState, type CSSProperties, type ElementType, type ReactNode, type RefObject } from "react"; import { useEffect, useRef } from "react"; export default function GlowingOrbMediaFrame({ caption = "We rebuilt our assistant's engine to handle entire projects in one pass. It reads your files, plans the work, and applies edits while the next steps are still being drafted, so progress shows up sooner. Early tests show far fewer steps per task, and the same tools now reach outside apps too. Read the", linkText = "engineering write-up", captionEnd = "for a closer look at the new engine.", linkHref = "#", }: { caption?: string; linkText?: string; captionEnd?: string; linkHref?: string; }) { const ref = useRef<HTMLCanvasElement>(null); useEffect(() => { const canvas = ref.current; if (!canvas) return; const ctx = canvas.getContext("2d"); if (!ctx) return; const W = 800, H = 450; canvas.width = W; canvas.height = H; const reduce = window.matchMedia("(prefers-reduced-motion: reduce)").matches; const pts: { x: number; y: number; z: number }[] = []; const N = 900; for (let i = 0; i < N; i++) { const y = 1 - (i / (N - 1)) * 2; const r = Math.sqrt(1 - y * y); const t = i * 2.399963; pts.push({ x: Math.cos(t) * r, y, z: Math.sin(t) * r }); } let raf = 0; const draw = (time: number) => { const a = time / 6000; ctx.clearRect(0, 0, W, H); const breathe = 0.85 + 0.15 * Math.sin(time / 1200); const g = ctx.createRadialGradient(W / 2, H / 2, 20, W / 2, H / 2, 210); g.addColorStop(0, `rgba(70,90,255,${0.55 * breathe})`); g.addColorStop(0.5, `rgba(30,40,220,${0.3 * breathe})`); g.addColorStop(1, "rgba(0,0,0,0)"); ctx.fillStyle = g; ctx.fillRect(0, 0, W, H); const ca = Math.cos(a), sa = Math.sin(a); for (const p of pts) { const x = p.x * ca + p.z * sa; const z = -p.x * sa + p.z * ca; if (z < -0.1) continue; const s = 135; const px = W / 2 + x * s; const py = H / 2 + p.y * s; const rad = 0.8 + z * 2.6; ctx.beginPath(); ctx.arc(px, py, rad, 0, Math.PI * 2); ctx.fillStyle = `rgba(${170 + z * 80},${190 + z * 60},255,${0.3 + z * 0.7})`; ctx.fill(); } if (!reduce) raf = requestAnimationFrame(draw); }; raf = requestAnimationFrame(draw); return () => cancelAnimationFrame(raf); }, []); return ( <figure className="w-full max-w-[800px] bg-background font-sans text-muted-foreground"> <Reveal from="scale"> <div className="relative aspect-video overflow-hidden rounded-2xl border border-border bg-background"> <canvas ref={ref} role="img" aria-label="Glowing dotted blue sphere slowly rotating" className="absolute inset-0 h-full w-full" /> </div> </Reveal> <figcaption className="mt-8 text-obsidian-lead text-muted-foreground"> {caption}{" "} <a href={linkHref} className="text-foreground underline decoration-border underline-offset-4 transition-colors duration-obsidian-link-brighten ease-obsidian-link-brighten hover:decoration-foreground focus-visible:outline focus-visible:outline-2 focus-visible:outline-primary">{linkText}</a>{" "} {captionEnd} </figcaption> </figure> ); } // ---- Yoink motion (inlined, no dependencies): Reveal ---- const YK_EASE = "cubic-bezier(0.16, 1, 0.3, 1)"; const useYkLayoutEffect = typeof window === "undefined" ? useEffect : useLayoutEffect; function ykReducedMotion(): boolean { return typeof window !== "undefined" && !!window.matchMedia?.("(prefers-reduced-motion: reduce)").matches; } // "idle": untouched (visible) · "hidden": waiting below the fold · "shown": play the entrance. // Content is only hidden once we know we can show it again (IntersectionObserver exists, motion allowed, // and there is a box to watch), and a safety net reveals anything on screen that is still hidden. type YkRevealState = "idle" | "hidden" | "shown"; function useYkReveal(ref: RefObject<Element | null>, once = true): YkRevealState { const [state, setState] = useState<YkRevealState>("idle"); useYkLayoutEffect(() => { const el = ref.current; if (!el || ykReducedMotion() || typeof IntersectionObserver === "undefined") return; // watch the element's own box, or its children when it has none (display: contents) const boxes = () => (getComputedStyle(el).display === "contents" ? Array.from(el.children) : [el]); const onScreen = (t: Element) => { const r = t.getBoundingClientRect(); return (r.width > 0 || r.height > 0) && r.bottom > 0 && r.right > 0 && r.top < window.innerHeight && r.left < window.innerWidth; }; if (!boxes().some((t) => t.getBoundingClientRect().width > 0 || t.getBoundingClientRect().height > 0)) return; // e.g. hidden at mount: leave it visible let shown = false; const show = (v: boolean) => { if (v !== shown) (shown = v), setState(v ? "shown" : "hidden"); }; setState("hidden"); const inView = new Set<Element>(); const io = new IntersectionObserver((entries) => { for (const e of entries) { if (e.isIntersecting) inView.add(e.target); else inView.delete(e.target); } if (inView.size) { show(true); if (once) io.disconnect(); } else if (!once) show(false); }); const watched = new Set<Element>(); const watch = () => boxes().forEach((t) => !watched.has(t) && (watched.add(t), io.observe(t))); watch(); // safety net: styles that land after mount (display: contents) get watched too, and nothing // stays hidden for more than a moment while it is actually on screen const start = Date.now(); const net = setInterval(() => { if (shown) return once && clearInterval(net); watch(); if (Date.now() - start > 2400 && boxes().some(onScreen)) show(true); }, 600); return () => { io.disconnect(); clearInterval(net); }; }, [once]); return state; } type YkRevealFrom = "up" | "down" | "left" | "right" | "scale" | "blur" | "none"; /** Fades content in as it scrolls into view. */ function Reveal({ children, from = "up", delay = 0, duration = 700, distance = 24, once = true, as = "div", className, style, }: { children?: ReactNode; from?: YkRevealFrom; delay?: number; duration?: number; distance?: number; once?: boolean; as?: ElementType; className?: string; style?: CSSProperties; }) { const Tag = as; const ref = useRef<HTMLElement>(null); const state = useYkReveal(ref, once); const hidden = state === "hidden"; const offset = { up: `translate3d(0, ${distance}px, 0)`, down: `translate3d(0, ${-distance}px, 0)`, left: `translate3d(${-distance}px, 0, 0)`, right: `translate3d(${distance}px, 0, 0)`, scale: "scale(0.94)", blur: `translate3d(0, ${distance / 2}px, 0)`, none: "none", }[from]; const t = `${duration}ms ${YK_EASE} ${delay}ms`; return ( <Tag ref={ref} className={className} style={{ ...style, ...(hidden && { opacity: 0, transform: offset, filter: from === "blur" ? "blur(12px)" : undefined }), ...(state === "shown" && { transition: `opacity ${t}, transform ${t}, filter ${t}` }), }} > {children} </Tag> ); }
Quality checks
Automated, in a real browser · 4d ago- Accessible: passedNo serious accessibility problems (axe-core): readable contrast, labelled buttons and images.
- Responsive: passedRenders at phone (390px), tablet (768px) and desktop width without sideways scrolling.
- Dark mode: passedStill readable when installed in your theme and switched to dark mode.
- Themeable: passedUses design tokens rather than hard-coded colours, so it follows your theme cleanly.
- Animates cleanly: passedIts animation plays and finishes with everything visible, and it stays still for people who turn on reduced motion.