build-interactive-particle-trail
यह क्या करती है
यह स्किल एजेंट को 3D सतह पर पॉइंटर या स्पर्श से प्रतिक्रिया देने वाले छोटे कण बनाना सिखाती है। यह उन डेवलपर्स के लिए है जिन्हें प्रतिक्रिया देने वाला प्रभाव चाहिए, जैसे कर्सर चलने पर धूल उठना।
कब इस्तेमाल करें
- ✓जब आप चाहते हैं कि माउस के 3D सतह पर चलने से कण उठें या बिखरें।
- ✓जब तेज़ माउस स्वाइप में खाली जगह बने, या रुके कर्सर से बहुत ज़्यादा कण जमा हों।
- ✓जब पेज पर कीबोर्ड से ट्रिगर होने वाला कणों का विस्फोट चाहिए।
Skill का लिंक
https://github.com/MengTo/Skills/blob/main/agent-skills/web-design/build-interactive-particle-trail/SKILL.mdइसे कॉपी करके अपने AI (Claude, ChatGPT या Cursor) में पेस्ट करें और निर्देशों का पालन करने को कहें।
कैसे इस्तेमाल करें
सबसे आसान तरीका: मैसेज कॉपी करके अपने AI में पेस्ट करें। वह skill पढ़कर निर्देशों का पालन करेगा।
पेस्ट करने के लिए तैयार मैसेज
Claude Code, Codex या Cursor के लिए: प्रोजेक्ट फ़ोल्डर में चलाएँ और skill इंस्टॉल हो जाएगी।
SKILL.md डाउनलोड करें और अपने एजेंट के skills फ़ोल्डर में रखें।
AI से क्या माँगें: उदाहरण
“मेरी 3D सतह पर जहाँ माउस चलता है, वहाँ छोटे कण उठाइए, और तेज़ चलने पर भी उन्हें बराबर दूरी पर रखिए।”
हर हफ़्ते 5 नई skills, 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
dtto 1/30 s and reset time after resume. - Pause on
document.hiddenand 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
- अपडेट की गई
- 1/11/2026
कमेंट
- …
इस repository की और skills
3d-cloth-material
7.2kआपके एजेंट को Three.js में असली बुने हुए कपड़े जैसा दिखने वाला मटीरियल बनाने में मदद करती है, जिसमें धागों की बुनाई, हल्की चमक, प्राकृतिक सिलवटें, किनारे और सीवन हों।
3d-falling-leaves
7.2kआपके एजेंट को 3D दृश्य में असली लगने वाली गिरती पत्तियाँ जोड़ने देती है, जो लुढ़कती हैं, हवा के साथ बहती हैं और कैमरा हिलने पर दोबारा इस्तेमाल होती हैं।
3d-four-seasons
7.2kआपके एजेंट को 3D दृश्य में वसंत, गर्मी, शरद और सर्दी के रूप जोड़ने देती है, जिसमें हरियाली, रोशनी, आसमान और बर्फ़ बिना दृश्य दोबारा बनाए बदलते हैं।
3d-high-poly-models
7.2kआपके एजेंट को चिकने आकार और विश्वसनीय किनारों वाले विस्तृत 3D मॉडल बनाने देती है, और फिर वेब पर अच्छे चलने वाले हल्के संस्करण तैयार करती है।
मिलती-जुलती skills
angular-developer
280kआपके एजेंट को Angular code बनाने और प्रोजेक्ट स्ट्रक्चर पर सलाह देने में मदद करता है। नए प्रोजेक्ट शुरू करने, code के हिस्से बनाने, या performance और accessibility सुधारने में उपयोगी है।
frontend-a11y
280kआपके एजेंट को web interfaces को सबके लिए accessible बनाने में मदद करता है। यह सुनिश्चित करता है कि websites और apps screen readers और keyboard navigation के साथ अच्छे से काम करें।
frontend-patterns
280kआपके एजेंट को React और Next.js में frontend development के modern patterns लागू करने में मदद करता है। यह performance optimize करता है, state manage करता है और best practices फॉलो करवाता है।