Motion & effects / Animated graphics

Line-Art Blueprint Illustration

Monochrome ink line drawing of a castle lifted by balloons over a faint square blueprint grid, ending with a dark circular rotating text seal at the bottom; fades into the grey canvas.

Rebuilt from epic.net in the Gallery Graphite Editorial style.

npx shadcn@latest add https://yoink-app.fly.dev/r/gallery-graphite-editorial/blocks/blueprint-illustration.json

Looks exactly like epic.net: brings its fonts and colours, namespaced so your own theme stays untouched.

Usage

Props: sealText (text looped around the seal) and centerLabel (word in the seal centre). Drop it into any grey canvas section; the illustration draws in and drifts with scroll while the seal spins.

components/blueprint-illustration.tsx
"use client";

import { useEffect, useLayoutEffect, useRef, useState, type CSSProperties, type ReactNode, type RefObject } from "react";
export default function LineArtBlueprint({
  sealText = "Crafted by hand \u2022 made to order \u2022 ",
  centerLabel = "Lift",
}: {
  sealText?: string;
  centerLabel?: string;
}) {
  const balloons = [
    { x: 120, y: 150, r: 34 },
    { x: 210, y: 70, r: 38 },
    { x: 300, y: 130, r: 34 },
    { x: 210, y: 170, r: 30 },
  ];
  return (
    <section className="relative isolate flex min-h-[640px] w-full items-center justify-center overflow-hidden bg-canvas py-16 text-ink">
      <div className="relative w-full max-w-[460px]">
        <div className="absolute inset-0 -z-10 text-ink">
          <GridPattern variant="grid" size={24} color="color-mix(in oklab, currentColor 10%, transparent)" fade="radial" />
        </div>
        <Parallax speed={0.1}>
          <DrawSvg duration={2200} stagger={150} fillAfter={false} className="block">
            <svg viewBox="0 0 420 620" fill="none" stroke="currentColor" strokeWidth="1.2" strokeLinecap="round" strokeLinejoin="round" role="img" aria-label="Line drawing of a castle carried by balloons" className="w-full">
              {balloons.map((b, i) => (
                <g key={i}>
                  <ellipse cx={b.x} cy={b.y} rx={b.r} ry={b.r * 1.15} />
                  <ellipse cx={b.x - 8} cy={b.y - 8} rx={b.r * 0.4} ry={b.r * 0.6} opacity="0.5" />
                  <path d={`M${b.x} ${b.y + b.r * 1.15} Q ${b.x + 10} 280 210 330`} opacity="0.7" />
                </g>
              ))}
              <path d="M210 270 Q 190 310 200 335 L 220 335 Q 230 310 210 270Z" />
              <path d="M150 400 L150 350 L270 350 L270 400" />
              <path d="M175 350 L175 325 L245 325 L245 350" />
              <path d="M60 430 L110 400 L330 400 L360 430 L360 480 L300 520 L120 520 L60 480Z" />
              <path d="M60 430 L120 460 L300 460 L360 430" />
              <path d="M120 460 L120 520 M300 460 L300 520" />
              <path d="M70 420 h20 v-12 h20 v12 M310 420 h20 v-12 h20 v12" />
              <path d="M210 520 L210 545 M190 545 L230 545 L210 560Z" />
            </svg>
          </DrawSvg>
        </Parallax>
        <div className="relative mx-auto -mt-8 flex h-[104px] w-[104px] items-center justify-center rounded-circle bg-ink text-on-ink">
          <svg viewBox="0 0 100 100" className="absolute inset-0 animate-badge-spin" aria-hidden="true">
            <defs>
              <path id="seal-circle" d="M50 50 m-38 0 a38 38 0 1 1 76 0 a38 38 0 1 1 -76 0" />
            </defs>
            <text fill="currentColor" fontSize="7.5" letterSpacing="2" className="font-sans uppercase">
              <textPath href="#seal-circle">{sealText}</textPath>
            </text>
          </svg>
          <span className="font-display text-[13px]">{centerLabel}</span>
        </div>
      </div>
      <div className="pointer-events-none absolute inset-x-0 bottom-0 h-32 bg-gradient-to-t from-canvas to-transparent" />
      <div className="pointer-events-none absolute inset-x-0 top-0 h-24 bg-gradient-to-b from-canvas to-transparent" />
    </section>
  );
}

// ---- Yoink motion (inlined, no dependencies): GridPattern, DrawSvg, Parallax ----

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;
}

// Background and overlay layers sit inside their parent: make sure it can hold them.
function ykPrepareParent(el: HTMLElement | null, isolate = false) {
  const p = el?.parentElement;
  if (!p) return;
  const cs = getComputedStyle(p);
  if (cs.position === "static") p.style.position = "relative";
  if (isolate && cs.isolation !== "isolate" && cs.zIndex === "auto") p.style.isolation = "isolate";
}

const YK_GRID_CSS = `@keyframes yk-grid-sweep{from{-webkit-mask-position:150% 0;mask-position:150% 0}to{-webkit-mask-position:-50% 0;mask-position:-50% 0}}
@media (prefers-reduced-motion:reduce){[data-yk-sweep]{display:none}}`;

/** A faint grid or dot pattern behind a section, fading out at the edges. */
function GridPattern({
  variant = "grid",
  size = 32,
  color = "color-mix(in oklab, currentColor 12%, transparent)",
  fade = "radial",
  shimmer = false,
  className,
  style,
}: {
  variant?: "grid" | "dots";
  size?: number;
  color?: string;
  fade?: "radial" | "top" | "bottom" | "none";
  shimmer?: boolean;
  className?: string;
  style?: CSSProperties;
}) {
  const ref = useRef<HTMLDivElement>(null);
  useYkLayoutEffect(() => ykPrepareParent(ref.current, true), []);
  const paint = (c: string) =>
    variant === "dots"
      ? { backgroundImage: `radial-gradient(circle at center, ${c} 1.2px, transparent 1.6px)`, backgroundSize: `${size}px ${size}px` }
      : { backgroundImage: `linear-gradient(to right, ${c} 1px, transparent 1px), linear-gradient(to bottom, ${c} 1px, transparent 1px)`, backgroundSize: `${size}px ${size}px` };
  const mask = {
    radial: "radial-gradient(ellipse at center, black 30%, transparent 75%)",
    top: "linear-gradient(to bottom, black, transparent 85%)",
    bottom: "linear-gradient(to top, black, transparent 85%)",
    none: undefined,
  }[fade];
  const sweep = "linear-gradient(110deg, transparent 40%, black 50%, transparent 60%)";
  return (
    <div
      ref={ref}
      aria-hidden="true"
      data-yk-grid=""
      className={className}
      style={{ position: "absolute", inset: 0, zIndex: -1, pointerEvents: "none", maskImage: mask, WebkitMaskImage: mask, ...style }}
    >
      <div style={{ position: "absolute", inset: 0, ...paint(color) }} />
      {shimmer && (
        <>
          <style>{YK_GRID_CSS}</style>
          <div
            data-yk-sweep=""
            style={{
              position: "absolute",
              inset: 0,
              ...paint(`color-mix(in oklab, ${color} 100%, currentColor 30%)`),
              maskImage: sweep,
              WebkitMaskImage: sweep,
              maskSize: "250% 100%",
              WebkitMaskSize: "250% 100%",
              animation: "yk-grid-sweep 7s ease-in-out infinite",
            }}
          />
        </>
      )}
    </div>
  );
}

/** Draws the strokes of an inline SVG (lines, icons, diagrams) when it scrolls into view. */
function DrawSvg({
  children,
  duration = 1600,
  stagger = 120,
  delay = 0,
  fillAfter = true,
  className,
  style,
}: {
  children?: ReactNode;
  duration?: number;
  stagger?: number;
  delay?: number;
  /** fade fills in once their outline is drawn */
  fillAfter?: boolean;
  className?: string;
  style?: CSSProperties;
}) {
  const ref = useRef<HTMLDivElement>(null);
  const state = useYkReveal(ref);
  useYkLayoutEffect(() => {
    if (state === "idle" || !ref.current) return;
    const shapes = Array.from(ref.current.querySelectorAll("path, line, polyline, polygon, circle, ellipse, rect")) as SVGGeometryElement[];
    shapes.forEach((el, i) => {
      if (typeof el.getTotalLength !== "function") return;
      const len = Math.ceil(el.getTotalLength() || 0);
      if (!len) return;
      if (state === "hidden") {
        Object.assign(el.style, { transition: "none", strokeDasharray: `${len}`, strokeDashoffset: `${len}`, fillOpacity: fillAfter ? "0" : "" });
        return;
      }
      const d = delay + i * stagger;
      Object.assign(el.style, {
        transition: `stroke-dashoffset ${duration}ms ${YK_EASE} ${d}ms, fill-opacity 600ms ease ${d + duration * 0.6}ms`,
        strokeDashoffset: "0",
        fillOpacity: "",
      });
    });
  }, [state]);
  return (
    <div ref={ref} className={className} style={style}>
      {children}
    </div>
  );
}

/** Moves its content a little slower (or faster) than the page as you scroll. */
function Parallax({
  children,
  speed = 0.15,
  className,
  style,
}: {
  children?: ReactNode;
  /** 0 = scrolls normally; 0.2 = lags behind by 20%; negative values move ahead */
  speed?: number;
  className?: string;
  style?: CSSProperties;
}) {
  const ref = useRef<HTMLDivElement>(null);
  const inner = useRef<HTMLDivElement>(null);
  useEffect(() => {
    const box = ref.current, el = inner.current;
    if (!box || !el || ykReducedMotion()) return;
    let raf = 0, visible = true;
    const update = () => {
      raf = 0;
      const r = box.getBoundingClientRect();
      const offset = r.top + r.height / 2 - window.innerHeight / 2;
      el.style.transform = `translate3d(0, ${(-offset * speed).toFixed(1)}px, 0)`;
    };
    const onScroll = () => {
      if (visible && !raf) raf = requestAnimationFrame(update);
    };
    const io = typeof IntersectionObserver !== "undefined" ? new IntersectionObserver(([e]) => (visible = e.isIntersecting)) : null;
    io?.observe(box);
    // re-measure when the page's layout settles (fonts, images, late CSS)
    const ro = typeof ResizeObserver !== "undefined" ? new ResizeObserver(() => (raf ||= requestAnimationFrame(update))) : null;
    ro?.observe(document.documentElement);
    update();
    window.addEventListener("scroll", onScroll, { passive: true });
    window.addEventListener("resize", onScroll);
    return () => {
      cancelAnimationFrame(raf);
      io?.disconnect();
      ro?.disconnect();
      window.removeEventListener("scroll", onScroll);
      window.removeEventListener("resize", onScroll);
    };
  }, [speed]);
  return (
    <div ref={ref} className={className} style={style}>
      <div ref={inner} style={{ willChange: "transform" }}>
        {children}
      </div>
    </div>
  );
}

Quality checks

Automated, in a real browser · 4d ago
—

More from Gallery Graphite Editorial

The whole style →

Outlined Arrow Pill Button

Buttons

Square Outline Cookie Panel

Toasts & snackbars

Rounded Showreel Video Frame

Media & mockups

Tracked Micro Label

Badges & tags

Hairline Minimal Header

Headers & nav bars

Floating Object Project Hero

Heroes