К основному содержанию
скилл CX Codex

shaders-cursor-ripples — скилл для Claude Code: как настроить

Встраивает водяную рябь на WebGPU поверх изображений с помощью библиотеки shaders. Помогает заменить устаревший CSS-эффект прожектора без поломки вёрстки и доступности.

Установить в Claude Code · Через Skills CLI (Vercel) Все способы и платформы ↓
npx skills add MengTo/Skills --skill shaders-cursor-ripples -a claude-code
Открыть на GitHub

Что делает shaders-cursor-ripples

Скилл инструктирует агента накладывать жидкое искажение по движению курсора поверх существующей картинки. В разметку добавляется холст Shader с компонентами ImageTexture и CursorRipples. Под холстом обязательно сохраняется исходный тег <img> для доступности и фолбэка. Эффект отключается при нехватке поддержки WebGPU или системном запрете анимаций.

Агент удаляет старый код прожектора: радиальные маски, дубли картинок и циклы requestAnimationFrame. Если оставить обе механики, координаты курсора рассинхронизируются. Сам шейдер монтируется лениво, чтобы не раздувать стартовый бандл страницы. Для Vite есть строгое правило: пакет shaders нельзя добавлять в optimizeDeps.exclude, иначе упадут зависимости CommonJS.

Текстовые блоки, ссылки и кнопки выносятся выше холста, а самому холсту задаётся pointer-events: none. Компонент библиотеки слушает глобальные события указателя сам. Перед коммерческим запуском проекта придётся отдельно проверить лицензию Shaders.

Какие задачи решает

  • заменить CSS-прожектор или фонарик на водяную WebGPU-рябь
  • добавить реакцию фона на курсор без изменения разметки и текстов
  • настроить безопасный откат на статичное изображение без WebGPU
  • удалить ручные циклы анимации указателя и дубли картинок

Примеры запросов агенту

  • Добавь эффект cursor ripples из Shaders к изображению в шапке сайта, сохранив оригинальную картинку для фолбэка.
  • Замени радиальную маску и эффект фонарика на шейдерную рябь с помощью ImageTexture и CursorRipples.
  • Настрой ленивую загрузку WebGPU-шейдера с проверкой prefers-reduced-motion.

Как установить shaders-cursor-ripples

1Через Skills CLI (Vercel)

npx skills add MengTo/Skills --skill shaders-cursor-ripples -a claude-code

2Вручную: положить файлы

~/.claude/skills/shaders-cursor-ripples/SKILL.md

Папка скилла целиком; для одного проекта — .claude/skills/shaders-cursor-ripples/

По шагам, с командами для каждой платформы: Как установить скилл в Claude Code: пять способов

Из того же набора148

audit-reference-originality Сравнивает готовый сайт с референсами и помечает совпадения текста, брендов, чисел, картинок и кода. Пригодится перед релизом. CX Codex +1 1 300установок browser-video-recording Собирает демо-видео интерфейса в 4K 60 fps с пропорциями 4:3 из снимков браузера. Пригодится для показа кликов и плавного зума в стиле Dribbble. CX Codex +1 1 300установок elevenlabs-tts Генерирует аудио ElevenLabs из текста или файла сценария через локальные голосовые профили. Подходит для озвучки, дикторских дорожек и голосовых вставок. CX Codex +1 1 300установок add-shader-cursor-trail Добавляет в проект hero-эффект на WebGPU: белый мерцающий полутоновый след за курсором с хроматическими волнами и плёночным зерном. С откатом на статичный кадр. CX Codex +1 1 300установок threejs-towers Собирает пагоды, замки и купола из параметров вместо меш-файлов и показывает, как постройка растёт снизу вверх. CX Codex +1 1 200установок build-rigged-game-assets Скилл ведёт сборку игрового персонажа или монстра от исходной модели до загрузки в геймплей: риг, библиотека анимаций, сокеты, экипировка, каталог. CX Codex +1 1 200установок audit-ai-design-slop Скилл находит визуальный шум, нагромождение декоративных слоёв и дефекты интерфейса в коде или макетах. Помогает очистить проект без принудительного редизайна. CX Codex +1 1 200установок threejs-weather Добавляет в Three.js сцены управляемые состояния дождя, грозы и снега. Нужен для атмосферного фона, где погода меняет частицы, свет и поверхность. CX Codex +1 1 200установок

Похожие

shaders shader-effects-inc Скилл для WebGPU-эффектов: анимированные фоны, градиенты, стекло, искажения и частицы из компонентов shaders в React, Vue, Svelte, Solid или чистом JS. CX Codex +1 528установок threejs-shaders CloudAI-X Скилл помогает писать кастомные GLSL-шейдеры и материалы для Three.js r186, настраивать униформы и переводить код на TSL для WebGPU. CX Codex +1 15 600установок tailwind-v4-shadcn secondsky Скилл настраивает связку Tailwind CSS v4, shadcn/ui и React в проектах на Vite. Помогает избежать ошибок импорта и поломки CSS-переменных при переключении тем оформления. CX Codex +1 8 100установок tailwind-theme-builder jezweb Скилл настраивает тему Tailwind v4 с shadcn/ui и тёмным режимом: ставит зависимости, связывает CSS-переменные через @theme inline, подключает переключатель темы. CX Codex +1 3 200установок godot-shaders gamedev-skills Скилл учит агента писать canvas_item и spatial шейдеры на Godot Shading Language: анимация по TIME, юниформы, чтение экрана. Пригодится, когда нужен эффект в 2D или 3D без ручного перебора вариантов. CX Codex +1 6 500установок godot-shaders-basics thedivergentai Помогает писать шейдеры для Godot без потери батчинга и поломки depth prepass. Пригодится при настройке эффектов попадания, растворения и экранного постпроцессинга. CX Codex +1 688установок

Рядом в теме «Фронтенд и UI»

Всё по теме «Фронтенд и UI» →

Вопросы о shaders-cursor-ripples

Как установить shaders-cursor-ripples в Claude Code?

Выполните команду npx skills add MengTo/Skills --skill shaders-cursor-ripples -a claude-code. Скилл сразу появится в доступных инструкциях агента.

Что делает скилл shaders-cursor-ripples?

Он направляет агента при интеграции интерактивного WebGPU-искажения воды из библиотеки shaders. Агент настраивает порядок компонентов, подключает фолбэк и убирает конфликтующие CSS-стили.

Почему нельзя исключать shaders в настройках Vite?

Пакет shaders содержит CommonJS-зависимости. Если внести его в optimizeDeps.exclude, сборщик пропустит предварительную обработку и билд сломается.

Исходный текст

SKILL.md · MIT
---
name: shaders-cursor-ripples
description: 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.
---

# 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

```bash
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:

```tsx
<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](assets/react/cursor-ripple-shader.tsx) and [assets/react/cursor-ripple-media.css](assets/react/cursor-ripple-media.css).

## Client and Fallback Pattern

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

```tsx
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:

```tsx
<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.

© MengTo · MIT · MengTo/Skills

Смотрите также

Спонсоры проекта

Компании, которые помогают держать аналитику открытой