Motion & effects / Animated graphics
Dotted Analytics Chart Panel
Glassy raised panel with a title, dashed gridlines, stepped red and grey lines and clusters of tiny teal scatter dots, paired with a Gantt timeline of date headers and milestone bars on the left.
Rebuilt from linear.app in the Obsidian Precision style.
npx shadcn@latest add https://justyoink.it/r/obsidian-precision-5cbef2/blocks/scatter-chart-panel.json
Looks exactly like linear.app: brings its fonts and colours, namespaced so your own theme stays untouched.
npx shadcn@latest add https://justyoink.it/r/obsidian-precision-5cbef2/mine/scatter-chart-panel.json
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: title, description, chartTitle, linkLabel, features (string list). Scatter dots scale 0.4→1 and fade in with a 25ms stagger once the panel scrolls into view.
components/scatter-chart-panel.tsx
"use client"; import { useLayoutEffect, type CSSProperties, type ElementType, type ReactNode, type RefObject } from "react"; import { useEffect, useRef, useState } from "react"; type Props = { title?: string; description?: string; chartTitle?: string; linkLabel?: string; features?: string[]; }; function seeded(n: number) { const x = Math.sin(n * 9301 + 49297) * 233280; return x - Math.floor(x); } const clusters = [ { cx: 83, n: 60, top: 100, h: 200 }, { cx: 247, n: 28, top: 190, h: 120 }, { cx: 412, n: 10, top: 230, h: 70 }, ]; const dates = ["2", "9", "16", "23", "6", "13", "20", "27", "4", "11", "18", "25", "1", "8", "15", "22"]; export default function DottedAnalyticsChartPanel({ title = "Roadmaps and tracking", description = "Map work from first sketch to release. Keep every squad aligned with shared goals, timelines and living specs.", chartTitle = "Throughput by squad", linkLabel = "Read more", features = ["Boards", "Pulse", "Timelines", "Specs", "Goals", "Reports"], }: Props) { const ref = useRef<HTMLDivElement>(null); const [on, setOn] = useState(false); useEffect(() => { const el = ref.current; if (!el) return; const io = new IntersectionObserver(([e]) => { if (e.isIntersecting) { setOn(true); io.disconnect(); } }, { threshold: 0.2 }); io.observe(el); return () => io.disconnect(); }, []); let idx = 0; const dots = clusters.flatMap((c, ci) => Array.from({ length: c.n }, (_, i) => { const s = ci * 100 + i; return { x: c.cx + (seeded(s) - 0.5) * 40 * (ci === 0 ? 1 : 1.4), y: c.top + seeded(s + 7) * c.h, r: 1 + seeded(s + 3) * 1.6, k: idx++, }; }) ); return ( <section className="relative overflow-hidden bg-canvas px-5 py-16 font-sans text-primary md:px-20 md:py-24"> <div className="grid gap-10 md:grid-cols-2"> <h2 className="text-h1 text-primary">{title}</h2> <div> <p className="max-w-[34rem] text-lead text-secondary">{description}</p> <a href="#" className="mt-8 inline-block text-ui text-tertiary transition-colors duration-link-color hover:text-primary focus-visible:outline focus-visible:outline-accent-indigo">{linkLabel} →</a> </div> </div> <Reveal from="up" className="relative mt-16"> <div ref={ref} className="relative h-[600px] overflow-hidden rounded-xl border border-hairline-subtle bg-surface"> <div className="absolute inset-0 bg-[radial-gradient(circle_at_20%_20%,rgba(255,255,255,0.04),transparent_50%)]" /> {/* gantt */} <div className="absolute inset-y-0 left-0 w-[60%] opacity-70" aria-hidden="true"> <div className="flex justify-between px-6 pt-10 text-micro text-quaternary"> {dates.map((d, i) => <span key={i}>{d}</span>)} </div> <div className="absolute left-[35%] top-6 flex gap-24 text-micro text-tertiary"><span>MAR</span><span>APR</span></div> <div className="absolute inset-y-16 left-[30%] border-l border-dashed border-hairline" /> <div className="absolute inset-y-16 left-[60%] border-l border-dashed border-hairline" /> <div className="absolute left-[18%] top-[120px] text-ui text-tertiary">UI Polish <span className="text-warning">●</span></div> <div className="absolute left-[18%] top-[148px] flex h-6 w-[60%] overflow-hidden rounded-xs border border-hairline bg-surface-raised/50"> <span className="ml-[45%] text-micro text-quaternary">◆</span> <span className="ml-auto w-[30%] bg-danger/20" /> </div> <div className="absolute left-[30%] top-[220px] text-ui text-tertiary">Split fares <span className="text-success">●</span></div> <div className="absolute left-[30%] top-[246px] h-6 w-[70%] rounded-xs border border-hairline bg-surface-raised/50" /> <div className="absolute left-[3%] top-[440px] text-ui text-quaternary">Telemetry reliability</div> <div className="absolute left-[3%] top-[468px] h-6 w-[55%] rounded-xs border border-hairline bg-surface-raised/40" /> </div> {/* chart panel */} <div className="absolute inset-y-0 right-0 w-full overflow-hidden border-l border-t border-hairline bg-surface bg-panel-sheen shadow-high md:left-[50%] md:w-auto md:rounded-tl-xl"> <div className="p-8 text-ui text-secondary">{chartTitle}</div> <svg viewBox="0 0 560 420" className="absolute inset-x-8 top-16 w-[calc(100%-4rem)]" role="img" aria-label="Scatter chart with stepped lines"> {[10, 90, 170, 250, 330, 410].map((y) => ( <line key={y} x1="0" x2="560" y1={y} y2={y} stroke="var(--color-hairline)" strokeDasharray="2 4" /> ))} <path d="M0 140 H150 L175 115 H320 L345 150 H480 L510 142 H560" fill="none" stroke="var(--color-danger)" strokeOpacity="0.5" /> <path d="M0 200 H175 L190 220 H320 L345 205 H480 L510 245 H560" fill="none" stroke="var(--color-danger)" strokeOpacity="0.6" /> <path d="M0 228 H150 L175 270 H320 L345 300 H480 L510 280 H560" fill="none" stroke="var(--color-tertiary)" strokeOpacity="0.5" /> {dots.map((d) => ( <circle key={d.k} cx={d.x} cy={d.y} r={d.r} fill="#1fa5b8" style={{ transformBox: "fill-box", transformOrigin: "center", transform: on ? "scale(1)" : "scale(0.4)", opacity: on ? 1 : 0, transition: "transform 420ms linear, opacity 420ms linear", transitionDelay: `${d.k * 25}ms`, }} /> ))} </svg> <div className="absolute inset-x-8 bottom-6 flex justify-between text-micro text-quaternary"> <span>Oct 2025</span><span>Nov 2025</span><span>Dec 2025</span> </div> </div> <div className="pointer-events-none absolute inset-x-0 bottom-0 h-40 bg-gradient-to-t from-canvas to-transparent" /> </div> </Reveal> <div className="mt-16 grid gap-8 md:grid-cols-2"> <span className="text-ui text-quaternary">Features</span> <ul className="grid grid-cols-2 gap-y-3 text-ui text-tertiary"> {features.map((f) => ( <li key={f}><button className="transition-colors duration-link-color hover:text-primary focus-visible:outline focus-visible:outline-accent-indigo">{f} +</button></li> ))} </ul> </div> </section> ); } // ---- 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, type CSSProperties, type ElementType, type ReactNode, type RefObject } from "react"; import { useEffect, useRef, useState } from "react"; type Props = { title?: string; description?: string; chartTitle?: string; linkLabel?: string; features?: string[]; }; function seeded(n: number) { const x = Math.sin(n * 9301 + 49297) * 233280; return x - Math.floor(x); } const clusters = [ { cx: 83, n: 60, top: 100, h: 200 }, { cx: 247, n: 28, top: 190, h: 120 }, { cx: 412, n: 10, top: 230, h: 70 }, ]; const dates = ["2", "9", "16", "23", "6", "13", "20", "27", "4", "11", "18", "25", "1", "8", "15", "22"]; export default function DottedAnalyticsChartPanel({ title = "Roadmaps and tracking", description = "Map work from first sketch to release. Keep every squad aligned with shared goals, timelines and living specs.", chartTitle = "Throughput by squad", linkLabel = "Read more", features = ["Boards", "Pulse", "Timelines", "Specs", "Goals", "Reports"], }: Props) { const ref = useRef<HTMLDivElement>(null); const [on, setOn] = useState(false); useEffect(() => { const el = ref.current; if (!el) return; const io = new IntersectionObserver(([e]) => { if (e.isIntersecting) { setOn(true); io.disconnect(); } }, { threshold: 0.2 }); io.observe(el); return () => io.disconnect(); }, []); let idx = 0; const dots = clusters.flatMap((c, ci) => Array.from({ length: c.n }, (_, i) => { const s = ci * 100 + i; return { x: c.cx + (seeded(s) - 0.5) * 40 * (ci === 0 ? 1 : 1.4), y: c.top + seeded(s + 7) * c.h, r: 1 + seeded(s + 3) * 1.6, k: idx++, }; }) ); return ( <section className="relative overflow-hidden bg-background px-5 py-16 font-sans text-foreground md:px-20 md:py-24"> <div className="grid gap-10 md:grid-cols-2"> <h2 className="text-obsidian-h1 text-foreground">{title}</h2> <div> <p className="max-w-[34rem] text-obsidian-lead text-muted-foreground">{description}</p> <a href="#" className="mt-8 inline-block text-obsidian-ui text-muted-foreground transition-colors duration-obsidian-link-color hover:text-foreground focus-visible:outline focus-visible:outline-primary">{linkLabel} →</a> </div> </div> <Reveal from="up" className="relative mt-16"> <div ref={ref} className="relative h-[600px] overflow-hidden rounded-2xl border border-border bg-card"> <div className="absolute inset-0 bg-[radial-gradient(circle_at_20%_20%,rgba(255,255,255,0.04),transparent_50%)]" /> {/* gantt */} <div className="absolute inset-y-0 left-0 w-[60%] opacity-70" aria-hidden="true"> <div className="flex justify-between px-6 pt-10 text-obsidian-micro text-muted-foreground"> {dates.map((d, i) => <span key={i}>{d}</span>)} </div> <div className="absolute left-[35%] top-6 flex gap-24 text-obsidian-micro text-muted-foreground"><span>MAR</span><span>APR</span></div> <div className="absolute inset-y-16 left-[30%] border-l border-dashed border-border" /> <div className="absolute inset-y-16 left-[60%] border-l border-dashed border-border" /> <div className="absolute left-[18%] top-[120px] text-obsidian-ui text-muted-foreground">UI Polish <span className="text-obsidian-warning">●</span></div> <div className="absolute left-[18%] top-[148px] flex h-6 w-[60%] overflow-hidden rounded-sm border border-border bg-secondary/50"> <span className="ml-[45%] text-obsidian-micro text-muted-foreground">◆</span> <span className="ml-auto w-[30%] bg-destructive/20" /> </div> <div className="absolute left-[30%] top-[220px] text-obsidian-ui text-muted-foreground">Split fares <span className="text-obsidian-success">●</span></div> <div className="absolute left-[30%] top-[246px] h-6 w-[70%] rounded-sm border border-border bg-secondary/50" /> <div className="absolute left-[3%] top-[440px] text-obsidian-ui text-muted-foreground">Telemetry reliability</div> <div className="absolute left-[3%] top-[468px] h-6 w-[55%] rounded-sm border border-border bg-secondary/40" /> </div> {/* chart panel */} <div className="absolute inset-y-0 right-0 w-full overflow-hidden border-l border-t border-border bg-card shadow-obsidian-high md:left-[50%] md:w-auto md:rounded-tl-2xl"> <div className="p-8 text-obsidian-ui text-muted-foreground">{chartTitle}</div> <svg viewBox="0 0 560 420" className="absolute inset-x-8 top-16 w-[calc(100%-4rem)]" role="img" aria-label="Scatter chart with stepped lines"> {[10, 90, 170, 250, 330, 410].map((y) => ( <line key={y} x1="0" x2="560" y1={y} y2={y} stroke="var(--color-border)" strokeDasharray="2 4" /> ))} <path d="M0 140 H150 L175 115 H320 L345 150 H480 L510 142 H560" fill="none" stroke="var(--color-destructive)" strokeOpacity="0.5" /> <path d="M0 200 H175 L190 220 H320 L345 205 H480 L510 245 H560" fill="none" stroke="var(--color-destructive)" strokeOpacity="0.6" /> <path d="M0 228 H150 L175 270 H320 L345 300 H480 L510 280 H560" fill="none" stroke="var(--color-muted-foreground)" strokeOpacity="0.5" /> {dots.map((d) => ( <circle key={d.k} cx={d.x} cy={d.y} r={d.r} fill="#1fa5b8" style={{ transformBox: "fill-box", transformOrigin: "center", transform: on ? "scale(1)" : "scale(0.4)", opacity: on ? 1 : 0, transition: "transform 420ms linear, opacity 420ms linear", transitionDelay: `${d.k * 25}ms`, }} /> ))} </svg> <div className="absolute inset-x-8 bottom-6 flex justify-between text-obsidian-micro text-muted-foreground"> <span>Oct 2025</span><span>Nov 2025</span><span>Dec 2025</span> </div> </div> <div className="pointer-events-none absolute inset-x-0 bottom-0 h-40 bg-gradient-to-t from-background to-transparent" /> </div> </Reveal> <div className="mt-16 grid gap-8 md:grid-cols-2"> <span className="text-obsidian-ui text-muted-foreground">Features</span> <ul className="grid grid-cols-2 gap-y-3 text-obsidian-ui text-muted-foreground"> {features.map((f) => ( <li key={f}><button className="transition-colors duration-obsidian-link-color hover:text-foreground focus-visible:outline focus-visible:outline-primary">{f} +</button></li> ))} </ul> </div> </section> ); } // ---- 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: not passedElements must meet minimum color contrast ratio thresholds (1 element)
- Responsive: passedRenders at phone (390px), tablet (768px) and desktop width without sideways scrolling.
- Dark mode: not passedElements must meet minimum color contrast ratio thresholds (2 elements)
- Themeable: not passed1 hard-coded colour (#1fa5b8). These ignore the theme and break dark mode.
- Animates cleanly: not passedKeeps animating when reduced motion is turned on