본문으로 건너뛰기
Skillpedia
웹사이트 및 UI (프런트엔드)7.2k · #13407

build-interactive-particle-trail

하는 일

이 스킬은 포인터나 터치에 반응하는 작은 파티클을 3D 표면 위에 만들도록 AI 에이전트를 안내합니다. 커서가 움직이면 먼지가 일어나는 것처럼 반응하는 효과를 원하는 개발자를 위한 스킬입니다.

사용하는 경우

  • ✓마우스가 3D 표면 위를 움직이면 파티클이 떠오르거나 흩어지게 하고 싶을 때.
  • ✓빠른 마우스 움직임에 빈틈이 생기거나 멈춘 커서에 파티클이 너무 많이 쌓일 때.
  • ✓페이지에서 키보드 입력으로 파티클이 한꺼번에 터지게 하고 싶은 경우.

스킬 링크

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

복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.

사용 방법

가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.

바로 붙여넣을 수 있는 메시지

Use this skill to help me: https://github.com/MengTo/Skills/blob/main/agent-skills/web-design/build-interactive-particle-trail/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
AI가 이런 스킬을 알아서 찾아 쓰길 원하시나요?무료 Skillpedia MCP를 설치하세요. 한 줄이면 작업마다 스킬 15,000+개 중에서 검색합니다.1분 만에 설치 →

AI에게 요청하는 예시

“마우스가 움직이는 3D 표면 위에서 작은 파티클이 떠오르게 해 주세요. 빠르게 움직여도 간격이 고르게 유지되게 해 주세요.”

매주 새 스킬 5개. 읽는 데 1분.

작동 방식

에이전트는 포인터가 표면 평면에 닿는 위치를 찾고, 시간이 아니라 이동한 거리에 따라 파티클을 만듭니다. 고정된 개수의 파티클 풀을 그래픽 카드에서 재사용해 효과를 부드럽게 유지합니다.

기술 내용 (원본 SKILL.md)

작성자의 영어 원문을 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

자주 묻는 질문

왜 거리로 만드나요?

거리 기준은 속도와 관계없이 잔상을 고르게 유지하므로, 빠른 움직임에도 빈틈이 생기지 않습니다.

성능에 부담이 큰가요?

이 스킬은 고정된 파티클 풀을 재사용하므로 효과가 효율적으로 유지됩니다.

주변 파티클 효과와 어떻게 다른가요?

이 효과는 동작에 반응하지만, 주변 파티클은 대개 스스로 떠돕니다.

상세 정보

작성자의 원본 설명

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

인기도

GitHub 스타
7.2k
순위
#13407
라이선스
MIT
업데이트
2026. 11. 1.

이 스킬이 유용한가요?

0

로그인 투표하려면 로그인하세요.

댓글

  • …

이 저장소의 다른 스킬

비슷한 스킬