Motion & effects / Text effects
Scroll Highlight Statement
Large paragraph where words progressively turn from dim grey to white with a soft blue glow on the active phrase, beside a layered red-ribbon notes app mockup in a glass card with a task list, and a small red icon chip with a link.
Rebuilt from raycast.com in the Obsidian Launcher style.
npx shadcn@latest add https://justyoink.it/r/obsidian-launcher/blocks/scroll-highlight-statement.json
Looks exactly like raycast.com: brings its fonts and colours, namespaced so your own theme stays untouched.
npx shadcn@latest add https://justyoink.it/r/obsidian-launcher/mine/scroll-highlight-statement.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: lead, active, rest (words that brighten on scroll), chipLabel, caption, linkLabel. Renders standalone with defaults; scroll the page to scrub word colors.
components/scroll-highlight-statement.tsx
"use client"; import { useLayoutEffect, type CSSProperties, type ElementType, type ReactNode, type RefObject } from "react"; import { useEffect, useRef, useState } from "react"; export default function ScrollHighlightStatement(props: { lead?: string; active?: string; rest?: string; chipLabel?: string; caption?: string; linkLabel?: string; }) { const { lead = "What more does Northwind handle?", active = "It can plan trips.", rest = "Sort receipts. Merge calendars. Rename batches of files. Draft replies. Summarize long pages. Pin favorite folders. Set quiet hours. Clean up downloads. Pause alerts. And plenty beyond that.", chipLabel = "Northwind Jots", caption = "A fast place to park ideas between tasks, always one shortcut away.", linkLabel = "See details", } = props; const ref = useRef<HTMLParagraphElement>(null); const [p, setP] = useState(0); const words = rest.split(" "); useEffect(() => { const on = () => { const el = ref.current; if (!el) return; const r = el.getBoundingClientRect(); const h = window.innerHeight; const v = (h * 0.85 - r.top) / (r.height + h * 0.3); setP(Math.min(1, Math.max(0, v))); }; on(); window.addEventListener("scroll", on, { passive: true }); window.addEventListener("resize", on); return () => { window.removeEventListener("scroll", on); window.removeEventListener("resize", on); }; }, []); const tasks = [ { t: "Gather replies and review them", done: true }, { t: "Add a preferences shortcut" }, { t: "Support several profiles" }, { t: "Fix avatar cropping" }, { t: "Investigate logout freeze" }, { t: "Flag the release toggle", caret: true }, ]; return ( <section className="relative overflow-hidden bg-canvas px-6 py-24 font-sans text-primary md:px-[142px]"> <div className="mx-auto grid max-w-6xl items-center gap-16 lg:grid-cols-2"> <div> <p ref={ref} className="max-w-[400px] text-[22px] font-medium leading-[1.75]"> <span className="text-primary">{lead}</span> <br /> <span className="text-primary [text-shadow:0_0_18px_color-mix(in_oklab,var(--color-accent-blue)_70%,transparent)]">{active}</span>{" "} {words.map((w, i) => ( <span key={i} className="transition-colors duration-300" style={{ color: i / words.length < p ? "var(--color-primary)" : "var(--color-tertiary)" }}> {w}{" "} </span> ))} </p> <div className="mt-24"> <span className="inline-flex items-center gap-2 rounded-md bg-overlay-subtle px-1.5 py-1 text-ui text-primary"> <span className="flex h-4 w-4 items-center justify-center rounded-xs bg-accent-red"> <span className="h-1.5 w-1.5 rounded-[1px] bg-canvas" /> </span> {chipLabel} </span> <p className="mt-4 max-w-[300px] text-ui text-secondary"> {caption}{" "} <a href="#" className="underline underline-offset-2 transition-colors duration-link-color hover:text-primary focus-visible:outline focus-visible:outline-accent-red">{linkLabel}</a> </p> </div> </div> <Reveal from="scale" duration={400}> <div className="relative mx-auto h-[420px] w-full max-w-[480px]"> <div className="absolute inset-0 overflow-hidden rounded-xl border border-hairline bg-surface [mask-image:radial-gradient(95%_100%_at_20%_22%,#000_30%,transparent)]"> <div className="absolute -left-10 top-0 h-[300px] w-[240px] -skew-x-[30deg] bg-[linear-gradient(90deg,#7a0d14,#e5333f,#5a0a10)] opacity-90" /> <div className="absolute left-16 top-0 h-[260px] w-10 -skew-x-[30deg] bg-accent-red/70 blur-[1px]" /> <div className="absolute left-32 top-0 h-[200px] w-6 -skew-x-[30deg] bg-accent-red/40" /> <div className="absolute inset-0 bg-glass-panel backdrop-blur-[2px]" /> </div> <div className="absolute bottom-6 right-0 h-[380px] w-[300px] overflow-hidden rounded-xl border border-hairline bg-[#111217]/95 p-5 shadow-soft-glow backdrop-blur-[30px]"> <div className="mb-4 flex items-center justify-between text-caption text-tertiary"> <span className="mx-auto">Jotted ideas</span> <span className="rounded-pill bg-overlay-subtle px-2 py-1 text-secondary">⌘ + </span> </div> <h3 className="text-[16px] font-semibold text-primary">Sync notes</h3> <p className="mt-2 text-[11px] leading-[1.5] text-secondary"> Review the <span className="text-accent-red underline">tester comments</span> before the call, then ship the polish behind a toggle. </p> <hr className="my-4 border-hairline" /> <h4 className="mb-2 text-[13px] font-medium text-primary">Checklist</h4> <ul className="space-y-2"> {tasks.map((k) => ( <li key={k.t} className="flex items-center gap-2 text-[11px] text-secondary"> <span className={"h-3 w-3 rounded-full border border-accent-red " + (k.done ? "bg-accent-red/70" : "")} /> {k.t} {k.caret && <span className="-ml-1 h-3 w-px animate-caret-blink bg-accent-red" />} </li> ))} </ul> </div> </div> </Reveal> </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"; export default function ScrollHighlightStatement(props: { lead?: string; active?: string; rest?: string; chipLabel?: string; caption?: string; linkLabel?: string; }) { const { lead = "What more does Northwind handle?", active = "It can plan trips.", rest = "Sort receipts. Merge calendars. Rename batches of files. Draft replies. Summarize long pages. Pin favorite folders. Set quiet hours. Clean up downloads. Pause alerts. And plenty beyond that.", chipLabel = "Northwind Jots", caption = "A fast place to park ideas between tasks, always one shortcut away.", linkLabel = "See details", } = props; const ref = useRef<HTMLParagraphElement>(null); const [p, setP] = useState(0); const words = rest.split(" "); useEffect(() => { const on = () => { const el = ref.current; if (!el) return; const r = el.getBoundingClientRect(); const h = window.innerHeight; const v = (h * 0.85 - r.top) / (r.height + h * 0.3); setP(Math.min(1, Math.max(0, v))); }; on(); window.addEventListener("scroll", on, { passive: true }); window.addEventListener("resize", on); return () => { window.removeEventListener("scroll", on); window.removeEventListener("resize", on); }; }, []); const tasks = [ { t: "Gather replies and review them", done: true }, { t: "Add a preferences shortcut" }, { t: "Support several profiles" }, { t: "Fix avatar cropping" }, { t: "Investigate logout freeze" }, { t: "Flag the release toggle", caret: true }, ]; return ( <section className="relative overflow-hidden bg-background px-6 py-24 font-sans text-foreground md:px-[142px]"> <div className="mx-auto grid max-w-6xl items-center gap-16 lg:grid-cols-2"> <div> <p ref={ref} className="max-w-[400px] text-[22px] font-medium leading-[1.75]"> <span className="text-foreground">{lead}</span> <br /> <span className="text-foreground [text-shadow:0_0_18px_color-mix(in_oklab,var(--color-obsidian-accent-blue)_70%,transparent)]">{active}</span>{" "} {words.map((w, i) => ( <span key={i} className="transition-colors duration-300" style={{ color: i / words.length < p ? "var(--color-foreground)" : "var(--color-muted-foreground)" }}> {w}{" "} </span> ))} </p> <div className="mt-24"> <span className="inline-flex items-center gap-2 rounded-lg bg-primary px-1.5 py-1 text-obsidian-ui text-primary-foreground"> <span className="flex h-4 w-4 items-center justify-center rounded-md bg-primary"> <span className="h-1.5 w-1.5 rounded-[1px] bg-background" /> </span> {chipLabel} </span> <p className="mt-4 max-w-[300px] text-obsidian-ui text-muted-foreground"> {caption}{" "} <a href="#" className="underline underline-offset-2 transition-colors duration-obsidian-link-color hover:text-foreground focus-visible:outline focus-visible:outline-primary">{linkLabel}</a> </p> </div> </div> <Reveal from="scale" duration={400}> <div className="relative mx-auto h-[420px] w-full max-w-[480px]"> <div className="absolute inset-0 overflow-hidden rounded-2xl border border-border bg-card [mask-image:radial-gradient(95%_100%_at_20%_22%,#000_30%,transparent)]"> <div className="absolute -left-10 top-0 h-[300px] w-[240px] -skew-x-[30deg] bg-[linear-gradient(90deg,#7a0d14,#e5333f,#5a0a10)] opacity-90" /> <div className="absolute left-16 top-0 h-[260px] w-10 -skew-x-[30deg] bg-primary/70 blur-[1px]" /> <div className="absolute left-32 top-0 h-[200px] w-6 -skew-x-[30deg] bg-primary/40" /> <div className="absolute inset-0 backdrop-blur-[2px]" /> </div> <div className="absolute bottom-6 right-0 h-[380px] w-[300px] overflow-hidden rounded-2xl border border-border bg-[#111217]/95 p-5 shadow-obsidian-soft-glow backdrop-blur-[30px]"> <div className="mb-4 flex items-center justify-between text-obsidian-caption text-muted-foreground"> <span className="mx-auto">Jotted ideas</span> <span className="rounded-full bg-foreground px-2 py-1 text-background">⌘ + </span> </div> <h3 className="text-[16px] font-semibold text-foreground">Sync notes</h3> <p className="mt-2 text-[11px] leading-[1.5] text-muted-foreground"> Review the <span className="text-primary underline">tester comments</span> before the call, then ship the polish behind a toggle. </p> <hr className="my-4 border-border" /> <h4 className="mb-2 text-[13px] font-medium text-foreground">Checklist</h4> <ul className="space-y-2"> {tasks.map((k) => ( <li key={k.t} className="flex items-center gap-2 text-[11px] text-muted-foreground"> <span className={"h-3 w-3 rounded-full border border-primary " + (k.done ? "bg-primary/70" : "")} /> {k.t} {k.caret && <span className="-ml-1 h-3 w-px animate-obsidian-caret-blink bg-primary" />} </li> ))} </ul> </div> </div> </Reveal> </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: 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: not passed1 hard-coded colour (bg-[#111217]/95). These ignore the theme and break dark mode.
- Animates cleanly: not passedKeeps animating when reduced motion is turned on