Communitygithub.com

samm329-ui/origami-hero-system

Build a premium Next.js/React landing hero that reconstructs ANY supplied artwork as a WebGL particle sculpture inside a device frame, wrapped in an independently unfolding vector mandala, with ONE shared animation clock driving every reveal, seamless edge/section dissolves, deliberate desktop/tablet/mobile compositions, and a hardened hydration path. Use when asked to reproduce or re-skin the Nirvana "origami Buddha" hero, to build a particle + mandala + device-frame hero with different artwork, palette, fonts or copy, or to clone this site's front-end design system into another project. Also use for the mobile hamburger navigation, sine-wave footer, editorial principles grid, CDP viewport screenshots, and the asset-generation pipeline that turns one image into particle/mask/occluder files.

O que é origami-hero-system?

origami-hero-system is a Claude Code agent skill that build a premium Next.js/React landing hero that reconstructs ANY supplied artwork as a WebGL particle sculpture inside a device frame, wrapped in an independently unfolding vector mandala, with ONE shared animation clock driving every reveal, seamless edge/section dissolves, deliberate desktop/tablet/mobile compositions, and a hardened hydration path. Use when asked to reproduce or re-skin the Nirvana "origami Buddha" hero, to build a particle + mandala + device-frame hero with different artwork, palette, fonts or copy, or to clone this site's front-end design system into another project. Also use for the mobile hamburger navigation, sine-wave footer, editorial principles grid, CDP viewport screenshots, and the asset-generation pipeline that turns one image into particle/mask/occluder files.

Funciona com✓Claude Code✓Codex CLI✓Cursor✓Antigravity✓OpenCode
npx skills add https://github.com/samm329-ui/webgl-motion-skills/tree/HEAD/skills/origami-hero-system

Perguntar na sua IA favorita

Abre um novo chat com esta habilidade de agente já pré-carregada.

Documentação

Origami Hero System

This skill is the distilled front-end system from the 38 commits that rebuilt nirvana-website (upstream PR #1, head 8151cad). It lets you reproduce the exact architecture and motion while swapping in completely different artwork, colours, type, copy or device styling.

The quality bar is: at first paint the page is calm and fully readable; then a single clock drives one continuous formation — particles assemble into the artwork, a layered mandala unfolds behind it, the device frame wipes in, the copy and navigation settle on the same spring, and the page below dissolves in without a single seam. Nothing janks, nothing flashes on hydration, and reduced -motion users get the settled final state immediately.

Repo note. This site runs a breaking-change Next.js 16.4.6. Before writing code in this repository, read the relevant guide in node_modules/next/dist/docs/ (resolved from this file's directory). Heed deprecation notices. AGENTS.md is regenerated by next dev — commit it with your work.

The composition (four layers, one clock)

.hero
├─ .hero-phone                      ← device layer (pointer-events: none)
│  ├─ .hero-phone__glow             warm halo, fades in with settled device
│  ├─ .hero-phone__fade             edge dissolves (exact --warm-paper colour)
│  ├─ .hero-phone__shadow           neutral shadow, separate from clipped frame
│  └─ .hero-phone__screen
│     ├─ .hero-phone__screen-fill   tint rides in WITH the card, never ahead
│     └─ .hero-art__stage           square, aspect-ratio:1, no distortion
│        ├─ <BinaryChakra/>         z0 vector mandala (CSS rotation)
│        ├─ .hero-art__occluder     z1 silhouette mask — hides mandala gaps
│        └─ <canvas>                z2 WebGL particle sculpture
│     └─ .hero-phone__frame         z4 bezel, clip-path left-to-right wipe
│        └─ .hero-phone__notch
└─ .hero-shell → <HeroTextReveal/>  copy and CTAs on the same clock

heroTimeline is a single requestAnimationFrame publisher owned by origami-hero.tsx. The mandala, header and copy subscribe to it and write style.transform / style.opacity straight to the DOM. There is no React state per frame and no second timer.

File map (templates are verbatim reference implementations)

Template in this skillDestinationRole
templates/app/components/hero-timeline.tsapp/components/Shared clock + easeOutBack spring
templates/app/components/origami-hero.tsxapp/components/WebGL2 particle sculpture, masks, quality tiers, rAF owner
templates/app/components/binary-chakra.tsxapp/components/Nine-layer mandala, deployment + rotation
templates/app/components/hero-text-reveal.tsxapp/components/Hero copy reveal on the clock
templates/app/components/site-header.tsxapp/Nav reveal + accessible hamburger
templates/app/components/icons.tsxapp/components/Inline SVG icons
templates/app/page.tsxapp/Editorial sections + principles grid
templates/app/site-footer.tsxapp/Sine-wave dot field footer
templates/app/layout.tsxapp/Fonts, metadata, hydration guard, no-script fallback
templates/app/globals.cssapp/Full design system + every breakpoint
templates/scripts/generate-particles.pyscripts/Image → particle bin + mask + occluder
templates/scripts/cdp-screenshot.pyscripts/Exact-viewport screenshot / QA helper

Start by copying the templates into the target project, then apply the swap map below. Keep the architecture and timing constants; replace only the visuals.

Workflow

  1. Decide the new visual. Get the source artwork (an image with the subject on a clean background) and the new palette/font/copy.
  2. Generate assets. Edit the EDIT THIS BLOCK config at the top of generate-particles.py: SOURCE, NAME, REGION, CHAKRA_CX/CY, PX_TO_NDC, PALETTE, subject-isolate thresholds and ANATOMY_BLOBS. Run python scripts/generate-particles.py. Inspect the preview PNG — the figure must be continuous, evenly dense and free of rectangular edges.
  3. Point the component at the new assets. In origami-hero.tsx update DATA_URL, MASK_URL, MASK_WIDTH/HEIGHT and any count constants. In globals.css update the occluder mask-image URL and --screen-bg.
  4. Re-skin the mandala. In binary-chakra.tsx change RED, DEEP, LIGHT, BINARY, the RINGS schedule and the geometry helpers if a different motif is wanted. Keep the two nested <g> structure (deploy outside, rotate inside) and the chakra-glyph / chakra-detail CSS reveal hooks.
  5. Re-skin the shell. :root tokens in globals.css, fonts in layout.tsx, copy in page.tsx / hero-text-reveal.tsx, logo SVGs in public/logos/.
  6. Verify at every breakpoint with the CDP helper and the checklist below.

Visual swap map

What to changeWhere
Artwork / figuregenerate-particles.py config + generated .bin files
Particle colourPALETTE in generator; aColor in RECON_VS; --cardinal* tokens
Mask protection + gaps*-mask.bin, *-occluder.png, .hero-art__occluder
Mandala colour / glyphsRED, DEEP, LIGHT, BINARY, RINGS in binary-chakra.tsx
Device colour / shape--screen-bg, .hero-phone__frame border, --phone-radius
Page atmosphere--warm-paper, --fog, section[id] wash, footer gradient
TypographyInter / Space_Grotesk in layout.tsx; --font-site / --font-display
Copy / CTAshero-text-reveal.tsx, page.tsx, site-header.tsx
Motion timingRINGS, GROUPS, ASSEMBLY_SECONDS, SETTLE_SECONDS; keep them coordinated

Non-negotiable rules

One clock, zero per-frame layout reads

  • Only origami-hero.tsx owns requestAnimationFrame. Everyone else subscribes.
  • Read clientWidth / clientHeight / getBoundingClientRect() only on resize, never in the frame loop. Per-frame layout reads are the main jank source.
  • After settling, stop the clock: drop to a ~10fps setTimeout for the near-static breath and remove will-change via the hero-settled class.
  • Feature-detect capabilities once (hardwareConcurrency, deviceMemory); sample only the deterministic prefix of the buffer for low-end/narrow devices so any prefix still reconstructs the whole figure.

WebGL particle field

  • WebGL2, instanced TRIANGLE_STRIP quads, all attributes except aCorner use vertexAttribDivisor(..., 1). mulberry32 seed keeps start positions and seeds deterministic.
  • Formation: cubic Bezier from a wide ring outside the viewport to each target, per-particle delay/flight from aSeed, easeOutCubic, wobble that decays to a sub-pixel ambient breath so the settled figure never dissolves.
  • Cursor interaction is a soft radial push that is multiplied by (1.0 - maskSample) and then re-tested against the mask: particles may never be nudged into the protected silhouette.
  • Two passes: a faint undersized depth pass (~0.07 reveal) and the main pass.
  • Fade by proximity to target and by distance to the canvas edge — otherwise a hard rectangle appears around the formation.
  • Blend ONE, ONE_MINUS_SRC_ALPHA for premultiplied alpha; clear to transparent.
  • Always tick() the clock to completion in the fetch-failure / unsupported / reduced-motion paths so the page is never left hidden.

Mandala deployment

  • Outer <g class="chakra-deploy"> is JS-driven (scale + opacity); inner <g class="chakra-ring"> is CSS-rotating. Never put both transforms on one node.
  • Rotation starts at each ring's rotationStart progress by flipping animationPlayState from paused to running — no angular jump.
  • Fine detail uses --deploy, --d, --bo and clamp() so glyphs light up progressively around the circumference. Batch tiny geometry into path strings.
  • apply(0) before subscribing; server-render rings compressed and invisible.

Seamless attachment (the detail that sells it)

  • --warm-paper must be the exact page background. Every dissolve overlay uses it, so the overlay is invisible over the page and only softens the device.
  • Desktop: bottom-only bridge .hero::after fades to --warm-paper well above the boundary; section[id] opens on the same warm value with a hairline red wash.
  • Stacked mobile: four-edge dissolve (vertical + horizontal gradients stacked), plus .hero-shell::before as a quiet 56px bridge above the copy.
  • Tablet (700–900px): bottom-only bridge again, no side fades.
  • Screen/frame tints and shadow arrive only at ~3300ms with the settled device — no white rectangle on first paint.
  • Shadow is separate from the clipped frame so it is never cut off; it is hidden on desktop where it read as a hard bottom edge.

Responsive composition

WidthComposition
≥1400pxTwo columns: copy column 600px, device clamp(440px,46vw,700px)
901–1400pxBoth sides scale together; clamp(300px,42vw,620px) device, copy min(480px,42vw)
700–900pxBalanced two-column grid, bottom-only bridge, no side fade
<700pxStacked: device first (order:-1), square, four-edge dissolve, copy below
<767pxCompact editorial: panel-style Genesis block, icon/title/desc feature rows
<479pxTwo pills stay on one row; repo label text hidden

Accessibility, hydration, performance

  • prefers-reduced-motion: draw the settled figure once, force all rings/copy/nav to final state, disable CSS animations, repaint on resize.
  • Server-render reveal items hidden (style={hidden(i)}) so there is no flash before hydration; a <noscript> rule makes them visible without JS.
  • Strip only known extension-injected attributes (bis_skin_checked, bis_register, cz-shortcut-listen, __processed_*__) with a beforeInteractive Next <Script> + short-lived MutationObserver, then disconnect at 5s. Never touch anything else in the DOM.
  • Hamburger: real <button> with aria-expanded, aria-controls, labels that change Open/Close, and bars that fold into an X. Hide secondary nav at <767px.
  • aria-hidden on all decorative art; skip link; focus-visible outlines.
  • Pin Next.js and the whole lockfile; keep cacheComponents, partialPrefetching, devIndicators: false, Tailwind v4 Turbopack rule in next.config.ts.

Provenance — what each original commit contributed

CommitContribution
5b6e917Shared hero timeline + easeOutBack spring
1dcff15Shared inline GitHub / Android icons
37e8daaNine-layer binary chakra mandala
eb4628eStaggered hero copy reveal on the clock
ebe750fWebGL Buddha particle hero with cursor interaction
7d75f52Particle field binary consumed by the shader
8b416f0Silhouette mask for shader protection
b239a37White silhouette occluder image
3194de8Particle/mask generator script
5b3939dCDP screenshot helper for viewport testing
eeed045Ignore _archive
7634cdeSecurity agent upgrade, hide dev indicator
b8eeaef / 64b9215Next.js 16.4.6 bump and lock
10e73d4Inter + Space Grotesk, no-script reveal fallback
3a76b28Global styles for origami hero and new typography
0bdc629Header navigation on the shared clock
055943bSine-wave particle footer
b04431bHomepage rebuilt around origami hero + principles grid
9f37929 / 2cef8ceOG alt text fix, font-pairing docs
46c9935 → 0d5f9d7Remove default assets and placeholder page
dead7f5Responsive layout redesign, release settled animation layers
4805c4aMobile-only Genesis editorial index + tagline
192d98fAccessible hamburger navigation
fd7b6bbRemove per-frame layout reads and idle animation work
801d39a / 8151cadExtension-attribute hydration cleanup via beforeInteractive script

QA checklist

  1. npm run build and npm run lint clean.
  2. Run the dev server, then for each viewport (390x1400, 768x1200, 1280x900, 1600x1000): python scripts/cdp-screenshot.py <w> <h> shot.png http://localhost:3000 The helper forces reduced motion, reports scrollWidth vs innerWidth and the canvas data-state (complete / error / unsupported).
  3. Check: no horizontal overflow (scrollWidth == innerWidth); no white rectangle or hard bottom edge on the device; no seam between hero and next section; headline never overlaps the device; both CTAs on one row at 390px.
  4. Check with JS disabled: copy/nav/sections are visible.
  5. Check with reduced motion: figure and mandala are settled on first paint.
  6. Confirm data-state="complete" and that the clock stops (no constant rAF).

Do not report done until every item passes at every viewport.

Habilidades Relacionadas