본문으로 건너뛰기
cccskills
무료GitHub에 공개

shaders-cursor-ripples

Add cursor-following water-ripple distortion to existing images using Shaders components. Preserve page content and layout while integrating lazy loading, accessible image fallbacks, and static display when WebGPU is unavailable or reduced motion is enabled.

한국어 요약은 준비 중입니다. 영어 요약을 표시하고 있습니다.

원문원문 설명 보기

Add cursor-following fluid WebGPU distortion over an existing image with the Shaders library's ImageTexture and CursorRipples components. Use when a hero, gallery, or media panel needs a water-ripple mouse effect; when replacing a drifting CSS spotlight or flashlight reveal; or when a prompt says to borrow only the shader interaction from a Shaders.com reference while preserving the current brand, image, copy, and layout.

설치 방법 보기

이럴 때 유용합니다

  • Adding cursor ripples to a hero image
  • Adding interactive distortion to gallery images
  • Replacing a cursor-driven spotlight reveal
  • Keeping static images for unsupported browsers

포함된 파일(5)

  • SKILL.md7.7 KB
  • agents/openai.yaml241 B
  • assets/react/cursor-ripple-media.css658 B
  • assets/react/cursor-ripple-shader.tsx694 B
  • REFERENCES.md214 B

SKILL.md(원문)

설치하기 전에 에이전트에게 전달되는 지시 내용을 확인할 수 있습니다.

Shaders Cursor Ripples

Core Contract

  1. Preserve the existing page, content, and semantic image.
  2. Install shaders and import from the active framework subpath.
  3. Render the source image through one Shader canvas.
  4. Place CursorRipples after ImageTexture so it post-processes that image.
  5. Keep toneMapping="aces" on the root.
  6. Let Shaders track the cursor. Remove custom spotlight coordinates, radial masks, duplicated reveal images, and pointer animation loops.
  7. Keep one real image beneath the canvas as the accessible loading and WebGPU fallback.
  8. Disable the shader for reduced motion and unsupported WebGPU.
  9. Lazy-load the shader code so the library does not inflate the initial page bundle.

When the user asks for only the shader effect, do not copy a reference's ribbon, blob, glow, typography, layout, copy, colors, or identity. Do not substitute the Shaders Water component: CursorRipples is the interactive image-displacement effect.

Inspect Before Editing

  • Find the real media wrapper, image URL, crop, overlays, z-index, and existing motion.
  • Confirm the wrapper has a non-zero rendered width and height.
  • Search for old reveal code such as data-reveal-hover, mask-image: radial-gradient, duplicated images, requestAnimationFrame, and manual pointer listeners.
  • Preserve unrelated parallax or entrance motion unless it conflicts with the shader canvas.
  • Check the installed shaders version and current framework API when the package may have changed.

Install

npm install shaders

Import from shaders/react, shaders/vue, shaders/svelte, or shaders/solid. For Vite projects, never add shaders to optimizeDeps.exclude; its CommonJS dependencies need Vite pre-bundling. No optimizeDeps entry is normally required.

Before a commercial release, verify the current Shaders license terms.

Required Composition

Keep the component order and values below:

<Shader toneMapping="aces">
  <ImageTexture url={imageUrl} objectFit="cover" />
  <CursorRipples decay={7.3} radius={0.6} />
</Shader>

Use this as the baseline before tuning intensity, chromaticSplit, or edges. Do not add SolidColor, Blob, Form3D, GaborNoise, Glow, or another generator unless the user explicitly requests the reference's generated artwork.

For React, copy and adapt assets/react/cursor-ripple-shader.tsx and assets/react/cursor-ripple-media.css.

Client and Fallback Pattern

Mount the shader only after the browser confirms WebGPU and motion is allowed:

const CursorRippleShader = lazy(() => import("./cursor-ripple-shader"));

const [shaderEnabled, setShaderEnabled] = useState(false);
const [shaderReady, setShaderReady] = useState(false);

useEffect(() => {
  const reduceMotion = window.matchMedia("(prefers-reduced-motion: reduce)");

  const sync = () => {
    const enabled = "gpu" in navigator && !reduceMotion.matches;
    setShaderEnabled(enabled);
    if (!enabled) setShaderReady(false);
  };

  sync();
  reduceMotion.addEventListener("change", sync);
  return () => reduceMotion.removeEventListener("change", sync);
}, []);

Keep the semantic image in the wrapper, then overlay the lazy shader:

<figure className="cursor-ripple-media">
  <img
    className="cursor-ripple-media__fallback"
    src={imageUrl}
    alt={meaningfulAlt}
    width={width}
    height={height}
  />

  {shaderEnabled ? (
    <Suspense fallback={null}>
      <CursorRippleShader
        imageUrl={imageUrl}
        ready={shaderReady}
        onReady={() => setShaderReady(true)}
      />
    </Suspense>
  ) : null}
</figure>

For Next.js, an ssr: false dynamic import is also valid. Do not hide the fallback until the shader calls onReady; a failed WebGPU initialization must leave the page legible and complete.

Layering Rules

  • Give the media wrapper position: relative, a definite size, overflow: hidden, and isolation: isolate.
  • Keep the fallback at z-index 0 and the canvas at z-index 1.
  • Fill the wrapper with position: absolute; inset: 0; width: 100%; height: 100%.
  • Set the shader layer to pointer-events: none; Shaders listens globally and converts pointer coordinates using the canvas bounds.
  • Mark the shader wrapper aria-hidden="true"; the fallback image owns the accessible name.
  • Place copy, links, and controls above the canvas so the effect never intercepts interaction.
  • Preserve the same crop between the fallback and ImageTexture. Use objectFit="cover" for full-bleed media.

Remove the Failed Spotlight Pattern

Delete the old implementation rather than leaving it hidden:

  • second reveal image;
  • radial mask-image and custom reveal variables;
  • smoke or blur overlays tied to pointer position;
  • component-local requestAnimationFrame pointer easing;
  • pointerenter, pointermove, pointerleave, and resize bookkeeping created only for the flashlight;
  • coarse-pointer rules that reference the retired reveal layers.

Keeping both systems causes coordinate drift, extra GPU work, and confusing fallbacks.

Performance and Motion

  • Lazy-load the shader module behind the WebGPU check.
  • Keep exactly one shader canvas for the media panel.
  • Use the library's onReady callback for a short opacity handoff.
  • Use disableTelemetry when telemetry is not required.
  • Do not animate the canvas size; animate a stable parent if parallax is needed.
  • Disable or unmount the shader under prefers-reduced-motion: reduce.
  • Keep touch layouts usable with the static image; never put essential information inside the effect.

Verification

Run the project's lint, production build, rendered tests, and git diff --check. Then verify in a real browser:

  1. Confirm exactly one canvas[data-renderer="shaders"] exists.
  2. Confirm the shader reaches its ready class and the fallback image remains present.
  3. Sweep the pointer across several points in the media. The distortion must follow that path without a detached circle.
  4. Confirm links and controls remain clickable.
  5. Confirm no console errors or warnings occur.
  6. Confirm the static image remains when WebGPU is unavailable or reduced motion is enabled.
  7. Confirm the old data-reveal-hover or radial-mask layer is absent.
  8. Check mobile and desktop crops after the canvas initializes.

Failure Diagnosis

  • Canvas exists but is blank: verify the wrapper has non-zero dimensions and the image URL is same-origin or CORS-readable.
  • Image renders but does not ripple: keep CursorRipples after ImageTexture; it requires a child/input surface.
  • Ripple is offset: remove manual pointer transforms and check whether a transformed ancestor changes the canvas bounds.
  • Page crashes during SSR: move the shader into a client-only, lazy-loaded component.
  • Image flashes on load: retain the fallback and fade the shader in only from onReady.
  • Initial bundle becomes large: confirm the Shaders import lives only inside the lazy module.
  • Effect blocks buttons: keep the canvas pointer-transparent and controls in a higher stacking layer.

Handoff

Report the affected media, Shaders package version, fallback behavior, reduced-motion behavior, build/test results, and live interaction verification. Distinguish a locally ready effect from a published deployment.

리뷰

아직 리뷰가 없습니다. 사용해 본 소감을 남겨 주세요.

댓글

로그인 없이 쓸 수 있습니다. 사용 후기, 질문, 작동하지 않은 환경 등을 편하게 남겨 주세요.

아직 댓글이 없습니다. 첫 댓글을 남겨 보세요.

보내면 바로 공개됩니다. 이메일 주소나 전화번호 같은 개인 정보는 쓰지 마세요. URL은 2개까지입니다.

0 / 1,000자

이 양식은 reCAPTCHA로 보호되며 Google 개인정보처리방침 및 서비스 약관이 적용됩니다.

같은 저장소의 스킬

Build woven fabric in Three.js with visible threads, realistic sheen, seams, and thick hems. The skill covers folds that preserve texture proportions, light passing through thin cloth, and variations in dye and wear.

한국어 요약은 준비 중입니다. 영어 요약을 표시하고 있습니다.

  • Creating backlit curtains
  • Differentiating linen, silk, and wool
  • Adding hems and stitches for close-up views
MengTo/Skills6.8천2026년 10월 18일 업데이트

Build falling leaves in Three.js and similar 3D scenes, with visible front, edge, and back views as they tumble and drift. Coordinate wind, scene depth, camera-aware recycling, and performance checks for a convincing autumn effect.

한국어 요약은 준비 중입니다. 영어 요약을 표시하고 있습니다.

  • Adding falling autumn leaves to a 3D scene
  • Coordinating leaf tumble, sideways drift, and wind
  • Managing leaves around buildings and camera movement
MengTo/Skills6.8천2026년 10월 18일 업데이트

Add coordinated seasonal transitions to an existing 3D scene. Blend foliage, lighting, sky, ground, snow, and particles from one shared state while preserving camera controls and interactions, so the same place remains recognizable throughout spring, summer, fall, and winter.

한국어 요약은 준비 중입니다. 영어 요약을 표시하고 있습니다.

  • Add a four-season selector to an outdoor 3D scene
  • Show seasonal changes in an architectural walkthrough
  • Coordinate foliage, sunlight, sky, and ground appearance
MengTo/Skills6.8천2026년 10월 18일 업데이트

Create or integrate detailed 3D models with smooth outlines and believable edges for close-up views. Prepare lower-detail versions for distant viewing, prioritize loading, and measure rendering costs in the actual scene.

한국어 요약은 준비 중입니다. 영어 요약을 표시하고 있습니다.

  • Creating a detailed 3D model for close-up views
  • Replacing visibly faceted curves with smoother geometry
  • Preparing detailed architectural assets for rendering
MengTo/Skills6.8천2026년 10월 18일 업데이트

Prepare detailed 3D materials that remain clear in close-up views. The skill guides texture resolution, physically based material maps, surface mapping, filtering, and progressive loading while checking download size and GPU memory use.

한국어 요약은 준비 중입니다. 영어 요약을 표시하고 있습니다.

  • Prepare wood, stone, and fabric materials for close-up views
  • Fix texture seams, grain direction, and normal map orientation
  • Preserve floor and foliage detail at oblique or distant views
MengTo/Skills6.8천2026년 10월 18일 업데이트

Create realistic metal surfaces in Three.js by combining structured reflections, studio lighting, scratches, fingerprints, and beveled edges. Includes polished, brushed, and aged finishes for objects such as tools, rings, and metal product parts.

한국어 요약은 준비 중입니다. 영어 요약을 표시하고 있습니다.

  • Fixing metal that looks like gray plastic
  • Creating polished or brushed metal finishes
  • Adding patina and worn edges
MengTo/Skills6.8천2026년 10월 18일 업데이트

MengTo의 스킬 모두 보기

이 스킬의 문제 신고