Skip to main content
skill CX Codex

ambient-section-particles — Claude Code skill: section particles

A skill that builds a restrained particle layer inside one section: petals, snow, sparks, confetti. Content stays readable.

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add MengTo/Skills --skill ambient-section-particles -a claude-code
Open on GitHub

What ambient-section-particles does

The skill tells the agent how to build a particle layer bounded to a single section instead of a page-wide screensaver. Shapes, density, gravity, wind, sway, rotation and the end mode come from one config object. Density scales with container area, not viewport width, and gets clamped for mobile.

Renderer choice is part of the instructions: canvas for roughly 40 or more small particles, DOM or inline SVG for a few branded fragments, WebGL only for thousands of particles or depth. The layer sits behind content, gets pointer-events: none, and pointer movement is listened for on the section itself. End modes are recycle, exit, settle and static, with pausing via IntersectionObserver and on hidden tabs.

Nothing extra to install, but the skill leans on ResizeObserver and IntersectionObserver — without them in the browser the effect will not start. Under prefers-reduced-motion: reduce the layer becomes a sparse static arrangement or is dropped. The repo ships a working reference at demo/index.html and demo/PROMPT.md for remixing.

What it helps with

  • add falling snow to a landing page hero
  • put a petal backdrop behind a text block
  • make particles react to cursor movement
  • pause the animation when the section scrolls off screen
  • render a still composition for reduced motion

Example prompts for the agent

  • add ambient-section-particles to the testimonials section, petals, low density
  • set up a spark layer behind the hero heading that reacts to the pointer
  • use settle mode for confetti in the form block

How to install ambient-section-particles

1Skills CLI (Vercel)

npx skills add MengTo/Skills --skill ambient-section-particles -a claude-code

2Manually: put the files in place

~/.claude/skills/ambient-section-particles/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/ambient-section-particles/

Step by step, with commands for each platform: How to install skills in Claude Code: five ways

Questions about ambient-section-particles

How do I install ambient-section-particles in Claude?

Run npx skills add MengTo/Skills --skill ambient-section-particles -a claude-code. The skill file then lands at ~/.claude/skills/ambient-section-particles/SKILL.md.

What does ambient-section-particles do?

It guides the agent through building a particle layer inside one section: configuration, renderer choice, simulation, pausing when invisible, and a reduced-motion fallback.

Does it need extra libraries?

No packages to install. It relies on ResizeObserver and IntersectionObserver, so in browsers lacking them the animation will not start.

Source text

SKILL.md · MIT
---
name: ambient-section-particles
description: 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.
---

# 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

```js
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](demo/index.html) as the working reference and [demo/PROMPT.md](demo/PROMPT.md) to recreate or remix it. Keep [REFERENCES.md](REFERENCES.md) as the links-only implementation source list.

© MengTo · MIT · MengTo/Skills

Similar skills

Everything for Frontend and UI →

From the same set148

performance-profiling Guides performance profiling for Apple apps using Instruments and MetricKit. It directs the AI agent to pinpoint hangs and slow launch times. CX Codex +1 1,400installs audit-verify-explain-grade-5 This skill makes the agent audit a change, back every claim with evidence, and then explain the result in plain language. Handy when you review someone else's fix or a test report. CX Codex +1 1,400installs product-proof-saas A skill for SaaS and AI landing pages where the proof is a real interface or a clearly labeled demo, not atmospheric decoration. CX Codex +1 1,400installs funky-purple-container-tech Guides the agent to design dark, container-driven interfaces with fuchsia-purple accents, structured frame lines, and futuristic glowing details. CX Codex +1 1,400installs reveal-hover-effect A skill for building a spotlight that follows the pointer and uncovers a second aligned image through a soft radial mask. Useful for hover-to-color and before/after effects. CX Codex +1 1,400installs scroll-progress-timeline Turns any ordered sequence into a responsive scroll timeline with a progress fill. Useful for onboarding flows, checkouts, roadmaps, and case studies. CX Codex +1 1,400installs daily-ui-inspiration-capture Builds a dated UI inspiration bundle with screenshots, video, motion frames, and an AI-builder prompt. Useful for repeatable article-ready captures. CX Codex +1 1,400installs framed-tech-dark-border-gradient A skill that points your coding agent at a dark technical design system: edge rails, gradient borders, asymmetrical panels, monochrome type. CX Codex +1 1,400installs

Project sponsors

Companies that keep this analytics open
Gold sponsor

Impressions, clicks and code copies — open statistics. We keep the numbers public for the same reason NeBlask itself is public. Become a sponsor