Zum Inhalt springen
Skillpedia
Websites & UI (Frontend)7.2k · #13407

build-interactive-particle-trail

Was er macht

Dieser Skill leitet einen Agenten an, winzige Partikel zu bauen, die auf Zeiger oder Berührung auf einer 3D-Fläche reagieren. Er richtet sich an Entwickler, die einen reaktionsfreudigen Effekt wollen, etwa Staub, der beim Bewegen des Cursors aufsteigt.

Wann du ihn nutzt

  • ✓Wenn Partikel auf einer 3D-Fläche aufsteigen oder auseinanderstieben sollen, wenn die Maus sich bewegt.
  • ✓Wenn eine schnelle Mausbewegung Lücken hinterlässt oder ein ruhender Cursor zu viele Partikel erzeugt.
  • ✓Wenn du einen per Tastatur ausgelösten Partikelausbruch auf einer Seite willst.

Link zum Skill

https://github.com/MengTo/Skills/blob/main/agent-skills/web-design/build-interactive-particle-trail/SKILL.md

Kopiere ihn und füge ihn in deine KI ein (Claude, ChatGPT oder Cursor) mit der Bitte, den Anweisungen zu folgen.

So nutzt du ihn

Am einfachsten: Kopiere die Nachricht und füge sie in deine KI ein. Sie liest den Skill und folgt den Anweisungen.

Fertige Nachricht zum Einfügen

Nutze diesen Skill, um mir zu helfen: https://github.com/MengTo/Skills/blob/main/agent-skills/web-design/build-interactive-particle-trail/SKILL.md Lies die SKILL.md unter diesem Link und folge ihren Anweisungen für meine Aufgabe.
Soll deine KI Skills wie diesen selbst finden?Installiere den kostenlosen Skillpedia-MCP: eine Zeile, und sie durchsucht vor jeder Aufgabe 15.000+ Skills.In 1 Minute installieren →

Beispielanfrage an deine KI

“Lass kleine Partikel von meiner 3D-Fläche aufsteigen, wo sich die Maus bewegt, und gleichmäßig verteilt bleiben, auch wenn ich schnell fahre.”

5 neue Skills pro Woche. 1 Minute Lesezeit.

So funktioniert es

Der Agent ermittelt, wo der Zeiger eine Ebene trifft, und erzeugt Partikel anhand der zurückgelegten Strecke, nicht der Zeit. Er verwendet einen festen Pool von Partikeln auf der Grafikkarte, damit der Effekt flüssig bleibt.

Technischer Inhalt (originale SKILL.md)

Originaltext des Autors, auf Englisch, direkt von GitHub.

Build an Interactive Particle Trail

Emit discrete motes per unit of pointer travel, spread them across the entire segment, and recycle a fixed GPU pool. Reach for ambient-section-particles when particles are primarily autonomous atmosphere; reach for add-shader-cursor-trail when the output should be a continuous fluid or shader ribbon. Use this Skill when individual grains must react to the gesture.

Extracted from inner-green-3d.html, where a pointer had to lift pollen off a procedural moss root without a fast sweep leaving gaps or a resting cursor pumping a bright clump.

Resolve the interaction plane

Convert the pointer into normalized device coordinates, raycast from the camera, and intersect one stable plane near the visual surface. Reuse that hit for all interaction systems.

Reset the previous hit when the pointer leaves or the ray misses. Otherwise re-entry draws a long diagonal from the stale exit point.

For a curved visible surface, either intersect the real collider or place the response plane just in front of it. Do not raycast every decorative blade or particle.

Emit by distance

Spacing, not time, is the mechanism:

const distance = current.distanceTo(previous);
const count = Math.min(14, Math.floor(distance / 7));

for (let i = 1; i <= count; i++) {
  point.lerpVectors(previous, current, i / count);
  spawn(point);
}

if (count) {
  previous.copy(current);
  idle = 0;
} else if ((idle += dt) > 0.055) {
  spawn(current);       // a resting hand trickles; it does not pump
  idle = 0;
}

A timer emitter leaves dots behind a fast flick and piles them under a resting hand. Segment interpolation fixes both. Cap each frame at 14 emissions so a tab resume or teleport cannot exhaust the pool in one burst.

Use these landed defaults:

parameter default failure prevented
path spacing 7 px/world units wider gaps read as samples, tighter gaps become a ribbon
per-frame cap 14 motes teleports overwrite the whole pool
idle interval 55 ms no idle emission feels dead; faster becomes a hotspot
pool size 620 enough overlap for a 1.6 s trail without unbounded allocation
lifetime 1.6 s shorter trails break; longer trails cloud the content
random size 0.50–1.15 identical points read as a stippled brush
DPR cap 2 fill cost spikes on dense displays

Recycle a GPU pool

Allocate typed arrays once for origin, velocity, birth time, and random seed. Advance a ring head on spawn:

const index = head;
head = (head + 1) % POOL_SIZE;

origins.set([x, y, z], index * 3);
velocities.set([vx, vy, vz], index * 3);
birth[index] = elapsed;
random.set([size, phase], index * 2);
dirty = true;

Mark dynamic attributes for upload only after respawns. Animate flight in the vertex shader from age = uTime - aBirth; do not integrate 620 particles on the CPU:

float age = uTime - aBirth;
float u = age / uLife;
vec3 p = position + aVelocity * age * (1.0 - 0.34 * u)
       + vec3(sin(aRandom.y * 6.283 + age * 2.6) * 22.0 * u,
              46.0 * age,
              0.0);
vAlpha = smoothstep(0.0, 0.09, u)
       * (1.0 - smoothstep(0.40, 1.0, u));

Cull dead points in the vertex shader by setting size to zero and moving them outside clip space. Render the pool as one THREE.Points draw call with a prebuilt soft radial texture, additive blending, and depthWrite: false.

Reuse the pool for bursts

Map a button or focused control to the same interaction plane and call spawn 40–60 times with a 2.5× spread. One pool keeps visual language, budget, and cleanup shared.

Expose a real Release pollen button with visible focus and an aria-live confirmation. Do not make pointer movement the only way to see or trigger the effect.

Respect motion and lifecycle

  • Under prefers-reduced-motion: reduce, do not advance particle age. Seed a designed curved trail and let the burst button replace it with a denser still composition.
  • Clamp dt to 1/30 s and reset time after resume.
  • Pause on document.hidden and while the section is offscreen.
  • Size from ResizeObserver, guard zero viewports, and cap DPR at 2.
  • Use Pointer Events so pen and touch can participate when the surface supports it; avoid hover-only instructions.
  • On teardown, cancel the frame, disconnect observers, remove listeners, and dispose point geometry, material, sprite texture, and renderer.

State the cost honestly

The per-particle flight

Häufige Fragen

Warum nach Strecke erzeugen?

Der Abstand nach Strecke bleibt bei jeder Geschwindigkeit gleichmäßig, sodass schnelle Bewegungen keine Lücken hinterlassen.

Kostet das viel Leistung?

Der Skill nutzt einen festen Pool von Partikeln, was den Effekt effizient hält.

Worin unterscheidet er sich von einem Umgebungs-Partikeleffekt?

Dieser reagiert auf Gesten. Umgebungspartikel treiben meist von allein.

Details

Originalbeschreibung des Autors

Build a cursor or touch particle interaction that emits by distance along the traveled segment into a recycled GPU point pool, with optional keyboard-triggered bursts. Use for interactive particle trails, pollen lifted from a surface, dust disturbed by a pointer, hover particle bursts, and discrete motes whose spacing must stay consistent at different gesture speeds.

repo: MengTo/Skills

Beliebtheit

GitHub-Sterne
7.2k
Platz im Ranking
#13407
Lizenz
MIT
Aktualisiert
1.11.2026

Ist dieser Skill nützlich?

0

Anmelden um abzustimmen.

Kommentare

  • …

Weitere Skills aus diesem Repository

Ähnliche Skills