Chuyển đến nội dung
Skillpedia
Website và giao diện (frontend)7.2k · #13395

ambient-section-particles

Skill này làm gì

Skill này hướng dẫn agent thêm hiệu ứng hạt nhẹ và có giới hạn cho một phần của trang web. Nó dành cho nhà thiết kế muốn một không khí như tuyết hay cánh hoa, nhưng vẫn giữ chữ dễ đọc.

Khi nào nên dùng

  • ✓Khi một phần trang cần một hiệu ứng tâm trạng nhẹ như tuyết, lá hay tia lửa.
  • ✓Khi bạn muốn các hạt phản ứng nhẹ với chuột mà không chặn các cú nhấp.
  • ✓Khi hiệu ứng phải dừng trên máy yếu và với người dùng muốn giảm chuyển động.

Liên kết skill

https://github.com/MengTo/Skills/blob/main/agent-skills/web-design/ambient-section-particles/SKILL.md

Sao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.

Cách dùng

Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.

Tin nhắn có sẵn để dán

Hãy dùng skill này để giúp tôi: https://github.com/MengTo/Skills/blob/main/agent-skills/web-design/ambient-section-particles/SKILL.md Đọc tệp SKILL.md tại liên kết đó và làm theo hướng dẫn cho việc của tôi.
Bạn muốn AI tự tìm những skill như thế này?Cài MCP Skillpedia miễn phí: chỉ một dòng, và AI sẽ tìm trong 15.000+ skill trước mỗi việc.Cài đặt trong 1 phút →

Ví dụ cách nhờ AI

“Thêm vài cánh hoa mềm rơi vào phần đầu trang khuyến mãi mùa xuân của tôi, nhưng giữ chữ rõ ràng.”

5 skill mới mỗi tuần. Đọc chỉ 1 phút.

Cách hoạt động

Agent chọn một cách vẽ đơn giản, đặt số lượng hạt vừa phải và đặt chúng phía sau nội dung. Hiệu ứng tạm dừng khi không nhìn thấy, và có một bản tĩnh cho người dùng muốn giảm chuyển động.

Nội dung kỹ thuật (SKILL.md gốc)

Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.

Ambient Section Particles

Build particles as a bounded atmosphere layer, not as a page-wide screensaver. Keep the content primary and stop work when the effect cannot be seen.

Choose the renderer

  • Use canvas for roughly 40 or more small particles, frequent motion, pointer forces, or simple procedural shapes.
  • Use DOM or inline SVG for a small count of branded fragments that need individual styling or semantic labels.
  • Use WebGL only for thousands of particles, depth, shaders, or real 3D behavior. Cap device pixel ratio and provide a static fallback.

Start with the least expensive renderer that preserves the desired shape language.

Define one configuration

const particles = {
  count: 54,
  gravity: 7,
  wind: -3,
  sway: 16,
  speed: [8, 18],
  size: [4, 12],
  opacity: [0.18, 0.62],
  rotation: [-0.8, 0.8],
  mode: "recycle",
  pointerRadius: 110,
  maxDpr: 2
};

Scale density by container area, then clamp it for mobile and low-power devices. Do not derive count from viewport width alone.

Layer the section

  1. Give the section a positioning context and clip overflow when particles should remain bounded.
  2. Place the particle surface behind content but above the background.
  3. Set the layer to pointer-events: none; listen for pointer movement on the section.
  4. Reserve a quiet content zone or lower density behind long text and controls.
  5. Keep controls and links in normal DOM stacking with visible focus.

Run the simulation

  • Seed particles inside or just above the container bounds.
  • Update gravity, wind, phase-based sway, rotation, opacity, and position from elapsed time.
  • Clamp large time deltas after background tabs or stalled frames.
  • Use one requestAnimationFrame loop for the whole layer.
  • Resize with ResizeObserver; cap canvas backing resolution at min(devicePixelRatio, maxDpr).
  • For pointer disturbance, apply a small distance-based force and let particles settle back naturally. Never attach a listener per particle.

Support explicit end modes:

  • recycle: return particles above the section after exit.
  • exit: remove particles after they leave the bounds.
  • settle: resolve into a shallow visual pile with a strict height cap.
  • static: render a deterministic still composition.

Stop invisible work

Use IntersectionObserver to start only when the section is visible. Cancel animation frames when it exits or document.hidden becomes true. Resume from the current simulation state instead of spawning a second loop.

On teardown, disconnect observers, remove resize and pointer listeners, cancel the frame, and release renderer resources.

Respect the reader

  • Under prefers-reduced-motion: reduce, render a sparse static arrangement or remove the layer.
  • Keep particles decorative and hidden from assistive technology.
  • Control opacity and contrast so motion never crosses the legibility threshold.
  • Avoid full-screen pointer repulsion, rapid direction changes, flashes, and large objects crossing form controls.
  • Pause decorative motion while a modal or critical task in the section is active when it competes for attention.

Verify

Test entry and exit pausing, background-tab recovery, fast resize, 390/768/1440 widths, device pixel ratio, pointer and touch input, reduced motion, section overflow, content focus, long text, route cleanup, and console errors. Confirm only one animation loop survives repeated mounts.

Use demo/index.html as the working reference and demo/PROMPT.md to recreate or remix it. Keep REFERENCES.md as the links-only implementation source list.

Câu hỏi thường gặp

Các hạt có chặn nút bấm không?

Không. Skill đặt lớp sao cho sự kiện con trỏ đi xuyên qua, và yêu cầu các vùng yên tĩnh phía sau chữ dài.

Dùng bao nhiêu hạt?

Số lượng tỉ lệ theo diện tích phần trang và được giới hạn trên điện thoại và thiết bị tiết kiệm pin.

Tôi có thể dùng hình của thương hiệu không?

Có. Skill cho phép các hình như biểu tượng hay mảnh thương hiệu, miễn là chúng hỗ trợ tâm trạng của phần đó.

Chi tiết

Mô tả gốc của tác giả

Add a restrained particle atmosphere inside one section with configurable shapes, density, gravity, wind, sway, rotation, recycling or settling, pointer disturbance, visibility pausing, responsive limits, and reduced-motion fallbacks. Use for petals, leaves, snow, sparks, confetti, dots, paper, icons, or brand fragments that support a section's mood without obscuring content.

repo: MengTo/Skills

Độ phổ biến

Sao GitHub
7.2k
Vị trí xếp hạng
#13395
Giấy phép
MIT
Cập nhật
1/11/2026

Skill này có hữu ích không?

0

Đăng nhập để bình chọn.

Bình luận

  • …

Thêm skill từ kho mã này

Skill tương tự