Generated banner for Add Shader Cursor Trail
Generated logo for Add Shader Cursor Trail

Add Shader Cursor Trail

Meng ToCommunityCreated by Meng To

  • Skill
  • Tool integration
  • Software development
  • MIT
  • Low risk
  • Has scripts

From the author

Add the Shaders WebGPU mouse effect used for the Tidal Commons hero: a white twinkling halftone cursor trail driven by ChromaFlow, masked through a DotGrid, finished with chromatic ripples and film grain, and protected by static, touch, accessibility, SSR, and performance fallbacks. Use when a user asks for this shader mouse effect, a halftone cursor trail, an interactive WebGPU hero/contact background, or a reusable cursor-following shader layer in React, Next.js, Vue, Svelte, Solid, or plain web projects.
— the description by Meng To

AutoGineer summary

Written by AutoGineer from the skill’s own files, not by the author

This skill provides a structured approach to implementing a specific WebGPU cursor trail effect, originally used in the Tidal Commons hero section. It emphasizes a progressive enhancement strategy, ensuring that the effect only loads when specific hardware and accessibility conditions are met. The implementation relies on a precise shader graph configuration and a two-part component architecture to separate the lightweight capability gate from the heavier shader module, maintaining semantic integrity and accessibility for all users.

What it does

  • Implements a twinkling halftone cursor trail using WebGPU.
  • Provides a two-module architecture to gate shader loading based on hardware and user preferences.
  • Ensures semantic content remains accessible and functional without the shader.
  • Includes logic for cleanup, such as unmounting the shader when the section leaves the viewport.
  • Provides a validation script to verify the implementation against project requirements.
  • Supports integration across React, Next.js, Vue, Svelte, and Solid frameworks.

When to use it

  • When adding an interactive, cursor-following shader background to a hero or contact section.
  • When you need to maintain a static, accessible fallback for users with reduced motion or unsupported hardware.
  • When working within React, Next.js, Vue, Svelte, or Solid environments.
  • When you need to ensure GPU resources are managed efficiently by unmounting offscreen effects.

Advantages

  • Maintains site accessibility by using CSS and JS capability gates.
  • Preserves semantic content and interactivity regardless of shader availability.
  • Reduces unnecessary resource usage by gating shader execution.
  • Provides a standardized implementation contract to ensure consistent visual output.

Usage examples

“Add the Tidal Commons cursor trail to my React hero section.”
The agent will guide you through installing the shaders package, setting up the CursorTrailGate and CursorTrailShader components, and ensuring the shader layer is placed correctly behind your content.
“How do I ensure the cursor trail doesn't break accessibility on my site?”
The agent will explain how to implement the required capability gates, such as checking for reduced motion preferences and ensuring the canvas is aria-hidden.

Install

  1. Download the skill as a ZIP:

    https://autogineer.com/agent-skills/mengto/add-shader-cursor-trail/download
  2. Unzip it into the cross-client skills folder of your project:

    mkdir -p .agents/skills && unzip add-shader-cursor-trail.zip -d .agents/skills

Documentation by Meng To

Add Shader Cursor Trail

Implement the exact trail as progressive enhancement. Preserve the host section's semantic content, imagery, controls, and static first frame.

Workflow

  1. Inspect the framework, rendering mode, existing motion stack, layer order, reduced-motion rules, and package manager. Do not add another smooth-scroll engine or replace the section's content.

  2. Install shaders with the existing package manager. Import from the matching framework subpath: shaders/react, shaders/vue, shaders/svelte, or shaders/solid.

  3. Read references/implementation.md before implementation. Keep the six shader nodes, their order, both invisible drivers, and both ID linkages exact.

  4. For React or Next.js, copy and adapt the files in assets/react/. Keep the lightweight capability gate separate from the heavy shader module so ineligible visitors do not request the shader bundle.

  5. Place one full-bleed, aria-hidden="true" shader layer behind the section content. Keep links and controls above it. Do not set pointer-events: none on the canvas unless cursor tracking is verified to use global events.

  6. Gate loading on WebGPU, a fine hover pointer, normal motion/transparency preferences, document visibility, window focus, and section intersection. Unmount when the section leaves view so GPU work stops.

  7. Keep the original image or dark background as the complete fallback. Hide the layer for reduced motion, reduced transparency, coarse/no-hover pointers, and forced colors.

  8. Adapt only presentation variables such as opacity and blend mode. Do not change the graph to decorative noise, add WebGL/Three.js, or hotlink Shaders preview assets.

Validate

Run the project's lint, typecheck/tests, and production build. For React implementations, also run:

node /path/to/add-shader-cursor-trail/scripts/verify-cursor-trail.mjs \
  path/to/CursorTrailShader.tsx \
  path/to/CursorTrailGate.tsx \
  path/to/cursor-trail.css

Verify the static section with JavaScript unavailable, keyboard access to content above the layer, touch behavior, reduced motion, unsupported WebGPU, focus/visibility cleanup, and absence of runtime requests to previews.shaders.com or data.shaders.com.

Report the chosen blend mode, fallback, capability gates, production-build result, and any browser limitation. Do not claim WebGPU visual verification unless it was actually performed in a compatible browser.

Files

references/implementation.md

Cursor trail implementation contract

Contents

  • Installation

  • Exact shader graph

  • Layering

  • Capability and lifecycle gates

  • Framework adaptation

  • Validation checklist

  • Common failures

Installation

Install shaders with the project's existing package manager. Use the framework entry point documented at https://shaders.com/docs/guide. For Vite, do not add shaders to optimizeDeps.exclude; its dependencies need normal pre-bundling.

Use client-only rendering for the shader module. The semantic section and its static background must remain server-renderable. React/Next projects can use the templates in assets/react/; the gate delays the dynamic import until capability checks pass.

Exact shader graph

Use exactly one Shader root. Keep these children in this order:

  1. DotGrid: id="trailDots", density={40}, twinkle={0.9}, visible={false}. Drive dotSize with an inline map from source: "trailFlow", channel alpha, input 0..1, output 0..1.

  2. ChromaFlow: id="trailFlow", intensity={1.4}, radius={2.9}, visible={false}.

  3. LinearGradient: #1e1e1f to #070708, HSL, start {x:0,y:1}, end {x:1,y:0}.

  4. LinearGradient: #000000 to #ffffff, HSL, the same endpoints, maskSource="trailDots".

  5. CursorRipples with defaults.

  6. FilmGrain with strength={0.1}.

The invisible components are data sources, not dead code. trailFlow controls dot size; trailDots masks the white gradient. Removing either invisible component or breaking either ID link removes the visible trail.

Disable library telemetry when the framework API supports it. Keep the graph's props static rather than putting them into component state.

Layering

Use this semantic relationship:

section.cursor-trail-region (position: relative; isolation: isolate; overflow: hidden)
├─ static image or dark background (always present)
├─ div.cursor-trail-layer[aria-hidden=true] (absolute, full bleed)
│  └─ capability gate → one Shader canvas
└─ semantic content and controls (relative; higher z-index)

For a photographic hero, start with mix-blend-mode: screen and opacity around 0.72–0.82. For a near-black standalone section, use normal blending so the graph's dark gradient becomes the section background. Never sacrifice text contrast.

Do not overlay a separate pointer-capturing element above links. Keep content at a higher stacking level so it remains clickable. Test cursor response over non-interactive and interactive areas before deciding whether the canvas can ignore pointer events.

Capability and lifecycle gates

Load and mount the shader only when all conditions pass:

  • navigator.gpu exists.

  • (hover: hover) and (pointer: fine) matches.

  • prefers-reduced-motion: reduce does not match.

  • prefers-reduced-transparency: reduce does not match.

  • The document is visible and the window is focused.

  • An IntersectionObserver reports the section near the viewport.

Listen for preference, visibility, blur, and focus changes. Disconnect the observer and remove every listener during cleanup. Unmounting the shader is the pause mechanism; do not leave a hidden continuous GPU loop running offscreen.

Use CSS media-query fallbacks in addition to JavaScript gates. CSS prevents a late or failed initialization from exposing the canvas when an accessibility preference changes.

Framework adaptation

React/Next: use the two-module pattern in assets/react/. CursorTrailGate.tsx is lightweight and lazy-loads CursorTrailShader.tsx only after eligibility passes. Keep both files client components in an App Router project.

Vue, Svelte, or Solid: translate the same split into a lightweight host component and a dynamically imported shader component. Import from the framework-specific Shaders subpath. Keep the shader props as static literals and preserve graph order and IDs.

Plain JavaScript: follow the current Shaders plain-JS guide if available. Preserve the same capability checks and static fallback; do not recreate the effect with an unrelated canvas implementation while claiming it is this graph.

Validation checklist

  • One canvas and one shader engine only.

  • Graph order and two ID linkages remain exact.

  • Static content exists in server-rendered HTML.

  • Keyboard focus and activation work above the canvas.

  • No shader chunk is requested on unsupported WebGPU, touch-only, or reduced-motion paths when the framework permits conditional loading.

  • The shader unmounts offscreen, on blur, and in hidden tabs.

  • Reduced motion, reduced transparency, forced colors, and coarse pointers hide the layer.

  • Production build, lint, and focused tests pass.

  • No hotlinks to Shaders preview/data domains.

Common failures

  • Visible gradient but no dots: restore source: "trailFlow", id="trailFlow", maskSource="trailDots", and id="trailDots".

  • Static dots everywhere: keep dotSize as the inline map driver and both driver components visible={false}.

  • Links stop working: fix stacking; do not place a pointer-capturing wrapper above content.

  • SSR or hydration failure: isolate Shaders imports in a client-only dynamically loaded module.

  • Large initial bundle: move capability checks into a lightweight gate before importing the shader module.

  • GPU continues offscreen: use IntersectionObserver to unmount, and clean up visibility/focus listeners.

Requirements and compatibility

Works with: Claude Code, Claude apps, OpenAI Codex, GitHub Copilot, Cursor, Gemini CLI, Kiro, OpenCode, Goose, Amp, Roo Code, JetBrains Junie, Factory Droid, Devin (ex-Windsurf), Mistral Vibe, OpenHands, Letta

“Works with” means the tool reads the open Agent Skills format; a skill written for one tool may use features others lack.

Needs: Needs Node.js

Security

What our scanner noticed· Low risk

  • Scripts that your agent may run

This skill includes scripts that your agent may run. Read them before you use it.

A static scan is not a guarantee. Skills are third-party content: review a skill before you let an agent use it.

Attribution and licence

Created by
Meng To
Publisher
Meng To (Community)
Source
MengTo/Skills · agent-skills/web-design/add-shader-cursor-trail · commit 5ea1661
Licence
MIT License (redistribution allowed)
  • LICENSE (added by AutoGineer from LICENSE)
  • ATTRIBUTION.md (written by AutoGineer)
Synced

AutoGineer is not affiliated with or endorsed by Meng To or Meng To.

Download ZIP

The ZIP holds the skill’s files, its licence files and an ATTRIBUTION.md. Download add-shader-cursor-trail.zip