Skip to content

Landing backdrop: particle field that scrolls with the page - #40

Merged
andesvel merged 6 commits into
devfrom
feat/parallax-grid
Sep 23, 2026
Merged

andesvel merged 6 commits into
devfrom
feat/parallax-grid

Conversation

@andesvel

@andesvel andesvel commented Sep 23, 2026 •

Copy link
Copy Markdown
Owner

What

Replaces the experimental line-grid backdrop with a canvas particle field, adapted from the shadcn.io Particles component:

  • components/particles.tsx (new): particles drift slowly, react to the cursor with a magnetism pull, and fade in/out at the screen edges.
  • Scrolls with the page: particles live in document coordinates and are drawn offset by the scroll position — they travel with the content while the canvas stays a viewport-sized layer (bounded memory; a document-sized bitmap would be ~180MB at DPR 2).
  • quantity is a density per viewport, scaled across the document (140/viewport after tuning), with offscreen particles culled per frame.
  • Theme-aware colors resolved from tokens: logo purple (--primary) in light, zinc gray (--muted-foreground) in dark; re-resolves on theme switch.
  • Reduced motion: static field that still tracks scroll; no drift or magnetism.
  • Vendor-code fixes: setTransform instead of accumulating ctx.scale(), mouse tracked in a ref (no re-render per mousemove), dropped the vignette/bg-neutral-950/use client, added pointer-events-none -z-10.

Branch history: this started as a full-page grid, became a dot-matrix with cursor parallax, then converged on the particle field per review — intermediate commits are kept for the record.

Verification

@andesvel andesvel changed the title Full-page grid backdrop with subtle cursor parallax Full-page dot-matrix backdrop with subtle cursor parallax Sep 23, 2026
The grid div was absolutely positioned against the initial
containing block, so it spanned exactly one viewport from the top of
the document: scrolling past the hero left the rest of the page on a
plain background. A fixed viewport layer covers every screen for the
entire scroll and skips scroll-driven repaints.
A fine pointer with no reduced-motion preference gets a subtle
background-position drift (max 10px) away from the cursor, lerped in
an rAF loop that stops once the pattern settles so idle sessions cost
no frames. Touch devices and reduced-motion users get the static
grid from the previous commit.
The 1px line grid read as graph paper; dots at the same 5% opacity
and 1lh rhythm read as soft texture. Same fixed layer, same cursor
drift, same fallbacks — only the background recipe changes.
Adapts the shadcn.io Particles background as the landing backdrop.
Colors resolve from the theme tokens (logo purple in light, zinc
gray in dark), the mouse position is tracked in a ref instead of
React state, and the DPR transform is set rather than multiplied so
repeated resizes do not zoom the particles.
Particles now live in document coordinates and are drawn offset by
the scroll position, so they travel with the content while the canvas
stays a viewport-sized layer. quantity becomes a density per viewport
and scales across the document; particles fade in and out as they
cross the visible screen, wrap only at the document edges, and
respawn within the current viewport band. Reduced motion keeps a
static field that still tracks scroll.
@andesvel andesvel changed the title Full-page dot-matrix backdrop with subtle cursor parallax Landing backdrop: particle field that scrolls with the page Sep 23, 2026
@andesvel
andesvel merged commit fe3467e into dev Sep 23, 2026
2 checks passed
@andesvel
andesvel deleted the feat/parallax-grid branch September 23, 2026 23:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant