概要
A layered, endless editorial gallery. Three parallax rows drift across a centered stage — drag, scroll, or let it move on its own. Next.js 16 · React 19 · Tailwind v4 · GSAP.
Web・アプリ開発できること
- Three parallax rows (back, mid, front) at different heights, opacities and speeds, drifting in alternating directions.
- Infinite loop — each row renders four copies of its slot sequence; the animation wraps by the measured distance between copies, so motion never visibly resets.
- Pointer drag + wheel — dragging moves every row at once with per-row drag weight, releasing flings the layers with decaying momentum. Wheel input (including trackpad horizontal swipes) feeds the same velocity.
- Idle auto-drift — automatic motion fades back in ~0.7s after the last interaction.
計測したスター増加
- 24時間
- 0
- 7日間
- 0
- 15日間
- -1
- 1か月
- 履歴を収集中
期間ごとの純増数です。期間は重複しており、日別の値ではありません。未計測の値は空欄です。スター数は注目度の指標であり、品質の保証ではありません。
README.md
オリジナルEmber Lace ✦
A layered, endless editorial gallery. Selected looks drift across three offset rows — drag, scroll, or let the composition move on its own.
Features ✨
- Three parallax rows (
back,mid,front) at different heights, opacities and speeds, drifting in alternating directions. - Infinite loop — each row renders four copies of its slot sequence; the animation wraps by the measured distance between copies, so motion never visibly resets.
- Pointer drag + wheel — dragging moves every row at once with per-row drag weight, releasing flings the layers with decaying momentum. Wheel input (including trackpad horizontal swipes) feeds the same velocity.
- Idle auto-drift — automatic motion fades back in ~0.7s after the last interaction.
- Reduced motion aware —
prefers-reduced-motion: reducedisables auto-drift, drag inertia and the intro animation. - Deterministic layout — per-image heights/opacities come from a seeded hash, so server and client render identically.
- Edge fade — rows fade out at the viewport edges via CSS masks.
- Layered composition — all three rows share the same centered stage with per-row vertical offsets and z-index, so the front row reads most prominently and the mid/back rows peek through.
- Editorial spacing rhythm —
withRhythm()guarantees a base gap after every image and layers extra major gaps on top, producing the uneven, magazine-like breathing between looks.
Tech Stack 🛠️
| Area | Choice |
|---|---|
| Framework | Next.js 16 (App Router, Turbopack, React Compiler enabled) |
| UI | React 19, Tailwind CSS v4 (@tailwindcss/turbopack) |
| Animation | GSAP (gsap.ticker + gsap.set, no plugins) |
| Fonts | Bodoni Moda (--font-display), Manrope (--font-sans) |
| Quality | Biome (lint, format, import sorting), TypeScript (strict) |
| Package | Bun |
Architecture & Design Patterns 🏗️
public/images/ 21 gallery photos (webp)
src/
app/
layout.tsx Root layout, fonts, SEO/OpenGraph metadata
page.tsx Renders <ImageGallery />
globals.css Tailwind entry, theme tokens, edge utilities
assets/images.ts Static imports of every image
components/
image-gallery.tsx Client shell: GSAP loop, drag/wheel input, layout
back-row.tsx Back layer config + markup
mid-row.tsx Middle layer config + markup
front-row.tsx Front layer config + markup
constants/gallery.ts Slot builders, seeded randomness, shared styles
types/gallery.ts Slot + row configuration types
Key Engineering Decisions
Slot Sequence as the Row Primitive Each row is a
RowConfig: an ordered list ofSlots (image or gap), a direction (1/-1), speed, drag weight and height class. Rows share one markup pattern: a masked wrapper containing a grid track ofCOPIES × slots. This keeps the row component files tiny and identical in shape — only the config differs.Rhythm-Based Spacing, Not Uniform Gaps
withRhythm()places a base gap after every image and addsrhythm[i]extra major gaps, which gives the rows their uneven editorial spacing:slots: withRhythm( imageSlots([3, 1, 4, 11, 9, 5, 6], { minH: 90, maxH: 98, minO: 0.6, maxO: 0.8, seed: 3, }), [1, 0, 0, 1, 0, 1, 0], BASE_GAP, MAJOR_GAP, ),Because the rhythm array lives in the config, the visual cadence of each row is tunable without touching markup.
Loop Period Measured From the DOM
ImageGallerymeasures the offset between the first slot of two consecutive copies to get the loop period, then advances every layer'sxeach tick from three sources: auto-drift, drag inertia and wheel velocity. No hard-coded widths — the loop survives font loading, image load, and viewport resize because the period is remeasured on everyResizeObservertick.Deterministic Per-Image Variation Per-image heights and opacities come from
hash01(seed + i), a sine-hash that produces stable values in[0, 1). Server and client render identically (no hydration mismatch), and the "random" collage is reproducible across reloads and deployments.One Engine, Three Layers The GSAP ticker, pointer handlers, wheel handler and
ResizeObserverare all attached once to the<section>shell. Rows don't own any animation state of their own — they just receive a translatedx. This means layering, z-index changes, and adding a fourth row are all trivial: assign a newLayer, register refs, done.Reduced Motion as a First-Class Path
prefers-reduced-motion: reduceturns off auto-drift, drag inertia, and the intro animation. The gallery becomes a static, scrollable layout with the same visual composition — no separate markup tree, no branching components.The Layer Order Contract The layer order in the
useEffect(MID_ROW, FRONT_ROW, BACK_ROW) matches the ref indices assigned in JSX (rowRefs.current[0..2]). Reordering the JSX without updating the config array (or vice versa) will silently mis-wire the layers — keep them in sync if you ever reorder.
Getting Started 🏁
Prerequisites
—
v20.0.0or higher— Package manager and script runner
Installation
Clone the repository
git clone https://github.com/rudra-xi/ember-lace.git cd ember-laceInstall dependencies
bun installRun the development server
bun devOpen http://localhost:3000.
Production build
bun build bun start
Scripts & Commands 📜
| Command | Description |
|---|---|
bun dev |
Start the dev server (Turbopack) |
bun build |
Production build |
bun start |
Serve the production build |
bun lint |
Biome check on ./src |
bun format |
Format ./src with Biome |
bun check:fix |
Biome check with autofixes |
How It Works ⚙️
Each row is a RowConfig: an ordered list of Slots (image or gap), a direction (1 / -1), speed, drag weight and height class. Rows share one markup pattern: a masked wrapper containing a grid track of COPIES × slots.
ImageGallery measures the offset between the first slot of two consecutive copies to get the loop period, then advances every layer's x each tick from three sources: auto-drift, drag inertia and wheel velocity. The layer order in the effect (MID_ROW, FRONT_ROW, BACK_ROW) matches the ref indices assigned in JSX — keep them in sync if you reorder rows.
Customizing 🎛️
- Images — drop a new file in
public/images/, import it insrc/assets/images.tsand add it to theimagesobject.LOOKSpicks it up automatically; reference it by index in the row configs. - Spacing & rhythm — edit each row's
rhythmarray and itsBASE_GAP/MAJOR_GAPclamps. - Motion — tune
speed,draganddirectionper row; global easing and decay live inimage-gallery.tsx. - Layering & offsets — the center-stage composition (vertical offsets, z-index, scale) lives in the wrapper divs inside
image-gallery.tsx. Adjust per-rowtranslateYclamps to change how the three rows peek past each other. - Palette & type —
--background/--foregroundinglobals.css; fonts inlayout.tsx.
Accessibility ♿
- Rows are presentational beyond the first copy; duplicate images use
alt=""andaria-hidden. - The gallery is labelled via
aria-labeland is fully usable with wheel/scroll; motion is suppressed under reduced-motion preferences.
Author & License 🪪
Developed by rudra-xi.
Distributed under the . Read
LICENSE.md for details.
関連プロジェクトを探す
読み込み中…
Live Demo: