Skillpedia
المواقع والواجهات (frontend)7.2k · #13466

shaders-cursor-ripples

ما الذي تفعله

تضيف هذه المهارة تشويهًا بتموجات مائية عبر WebGPU يتبع الفأرة فوق صورة أو صورة رئيسية. وهي مخصصة لمطوري الواجهات الأمامية الذين يريدون صورة تفاعلية سلسة دون إعادة تصميم الصفحة.

متى تستخدمها

  • ✓عندما تحتاج صورة رئيسية أو معرضًا إلى تأثير تموج مائي يتبع الفأرة.
  • ✓عندما تريد استبدال تأثير قديم للضوء أو المصباح اليدوي على صورة.
  • ✓عندما تريد التفاعل الشيدري فقط من مرجع معين، دون نسخ تصميمه.

رابط المهارة

https://github.com/MengTo/Skills/blob/main/agent-skills/web-design/shaders-cursor-ripples/SKILL.md

انسخه والصقه في الذكاء الاصطناعي الذي تستخدمه (Claude أو ChatGPT أو Cursor) واطلب منه اتباع التعليمات.

طريقة الاستخدام

أسهل طريقة: انسخ الرسالة والصقها في الذكاء الاصطناعي الذي تستخدمه. سيقرأ المهارة وينفّذ تعليماتها.

رسالة جاهزة للصق

استخدم هذه المهارة لمساعدتي: https://github.com/MengTo/Skills/blob/main/agent-skills/web-design/shaders-cursor-ripples/SKILL.md اقرأ ملف SKILL.md في هذا الرابط ونفّذ تعليماته لمهمتي.
تريد أن يجد الذكاء الاصطناعي مهارات مثل هذه بنفسه؟ثبّت خادم Skillpedia MCP المجاني: سطر واحد، ويبحث في 15,000+ مهارة قبل كل مهمة.ثبّته في دقيقة واحدة →

مثال على ما تطلبه من الذكاء الاصطناعي

“أريد أن تُظهر الصورة الرئيسية في موقعي تموجًا مائيًا يتبع الفأرة، دون تغيير باقي الصفحة.”

5 مهارات جديدة كل أسبوع. قراءة في دقيقة واحدة.

كيف تعمل

يُبقي وكيلك الصورة الموجودة والمحتوى كما هما، ويضع لوحة الشيدر فوق الصورة، ويضيف طبقة التموج فوقها. يزيل الكود القديم للمؤشر المخصص، ويعود إلى الصورة العادية عندما تكون الحركة مقللة أو عندما لا يدعم المتصفح WebGPU.

المحتوى التقني (ملف SKILL.md الأصلي)

النص الأصلي من المؤلف، مباشرة من GitHub.

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 i
الأسئلة الشائعة

ماذا لو لم يدعم متصفح الزائر WebGPU؟

تقول المهارة إنه يجب إبقاء صورة حقيقية واحدة تحت اللوحة كبديل، حتى تبقى الصفحة صحيحة المظهر.

هل تزيد وزن الصفحة؟

تقول المهارة إنه يجب تحميل كود الشيدر عند الحاجة، حتى لا يبطئ التحميل الأول للصفحة.

هل تغير علامتي التجارية أو نصوصي؟

لا. تحافظ على صفحتك ومحتواها وصورتك الدلالية.

التفاصيل

الوصف الأصلي من المؤلف

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

الشعبية

نجوم GitHub
7.2k
الترتيب
#13466
الترخيص
MIT
آخر تحديث
1‏/11‏/2026

هل هذه المهارة مفيدة؟

0

سجّل الدخول للتصويت.

التعليقات

  • …

المزيد من المهارات من هذا المستودع

مهارات مشابهة