shaders-cursor-ripples
Fungsinya
Skill ini menambahkan distorsi riak WebGPU yang mengikuti mouse di atas foto atau gambar hero. Cocok untuk pengembang front end yang menginginkan gambar interaktif yang cair tanpa mendesain ulang halaman.
Kapan dipakai
- ✓Saat gambar hero atau galeri memerlukan efek riak air yang mengikuti mouse.
- ✓Saat Anda ingin mengganti efek sorotan atau senter lama pada gambar.
- ✓Saat Anda hanya menginginkan interaksi shader dari referensi, tanpa menyalin desainnya.
Link skill
https://github.com/MengTo/Skills/blob/main/agent-skills/web-design/shaders-cursor-ripples/SKILL.mdSalin lalu tempelkan ke AI Anda (Claude, ChatGPT, atau Cursor) dan minta AI mengikuti instruksinya.
Cara pakai
Cara paling mudah: salin pesan ini dan tempelkan ke AI Anda. AI akan membaca skill dan mengikuti instruksinya.
Pesan siap tempel
Untuk Claude Code, Codex, atau Cursor: jalankan di folder proyek, lalu skill langsung terpasang.
Unduh SKILL.md lalu taruh di folder skill agen Anda.
Contoh permintaan ke AI
“Saya ingin gambar di hero saya menampilkan riak air yang mengikuti mouse, tanpa mengubah bagian lain halaman saya.”
5 skill baru setiap minggu. 1 menit baca.
Cara kerjanya
Agent mempertahankan gambar dan konten yang ada, menempatkan kanvas shader di atas gambar, dan menambahkan lapisan riak di atasnya. Kode penunjuk kustom lama dihapus, dan gambar biasa dipakai saat gerakan dikurangi atau WebGPU tidak tersedia.
Konten teknis (SKILL.md asli)
Teks asli dari pembuat, dalam bahasa Inggris, langsung dari GitHub.
Shaders Cursor Ripples
Core Contract
- Preserve the existing page, content, and semantic image.
- Install
shadersand import from the active framework subpath. - Render the source image through one
Shadercanvas. - Place
CursorRipplesafterImageTextureso it post-processes that image. - Keep
toneMapping="aces"on the root. - Let Shaders track the cursor. Remove custom spotlight coordinates, radial masks, duplicated reveal images, and pointer animation loops.
- Keep one real image beneath the canvas as the accessible loading and WebGPU fallback.
- Disable the shader for reduced motion and unsupported WebGPU.
- 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
shadersversion 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, andisolation: isolate. - Keep the fallback at z-index
0and the canvas at z-index1. - 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 i
Pertanyaan umum
Bagaimana jika browser pengunjung tidak mendukung WebGPU?
Skill ini menyatakan untuk mempertahankan satu gambar asli di bawah kanvas sebagai cadangan, sehingga halaman tetap tampak benar.
Apakah menambah bobot halaman?
Skill ini menyatakan untuk memuat kode shader secara lazy agar tidak memperlambat pemuatan halaman pertama.
Apakah merek atau teks saya berubah?
Tidak. Skill ini mempertahankan halaman, konten, dan gambar semantik Anda.
Detail
Deskripsi asli dari pembuat
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.
repo: MengTo/Skills
Popularitas
- Bintang GitHub
- 7.2k
- Peringkat
- #13466
- Lisensi
- MIT
- Diperbarui
- 1/11/2026
Komentar
- …
Skill lain dari repositori ini
3d-cloth-material
7.2kMembantu agent Anda membuat kain tenun yang realistis di Three.js, dengan anyaman benang, kilau lembut, lipatan alami, kelim, dan jahitan.
3d-falling-leaves
7.2kMembantu agent Anda menambahkan daun berguguran yang realistis ke scene 3D, dengan daun yang berputar, terbawa angin, dan digunakan ulang saat kamera bergerak.
3d-four-seasons
7.2kMembantu agent Anda menambahkan tampilan musim semi, panas, gugur, dan dingin ke scene 3D, dengan mengubah dedaunan, cahaya, langit, dan salju tanpa membangun ulang scene.
3d-high-poly-models
7.2kMembantu agent Anda membangun model 3D yang detail dengan bentuk halus dan tepi yang meyakinkan, lalu menyiapkan versi lebih ringan yang berjalan baik di web.
Skill serupa
angular-developer
280kMembantu agent Anda membuat kode Angular dan memberi saran struktur proyek. Berguna saat memulai proyek baru, membuat komponen, atau meningkatkan performa.
frontend-a11y
280kMembantu agent Anda membuat antarmuka web dapat diakses semua orang. Memastikan website dan aplikasi berfungsi baik dengan screen reader dan navigasi keyboard.
frontend-patterns
280kMembuat agent Anda menerapkan pola modern dalam frontend. Mengoptimalkan performa, mengelola state, dan mengikuti praktik terbaik React dan Next.js.