falling-leaves
यह क्या करती है
यह स्किल एजेंट को गिरती पत्तियों का प्रभाव बनाना सिखाती है, जो साफ़ तौर पर पत्तियों जैसा दिखे। यह उन वेब डिज़ाइनरों के लिए है जिन्हें मौसमी या प्रकृति वाली गति चाहिए, पर वह कॉन्फ़ेटी जैसी न लगे।
कब इस्तेमाल करें
- ✓जब मौसमी या प्रकृति वाले पेज को असली पत्तियों जैसी दिखने वाली पत्तियाँ चाहिए।
- ✓जब सादा कण प्रभाव कॉन्फ़ेटी जैसा लगे और उसे ज़्यादा आकार चाहिए।
- ✓जब आपको पत्तियाँ फ़्लैट कैनवास वाले या 3D संस्करण में चाहिए।
Skill का लिंक
https://github.com/MengTo/Skills/blob/main/agent-skills/web-design/falling-leaves/SKILL.mdइसे कॉपी करके अपने AI (Claude, ChatGPT या Cursor) में पेस्ट करें और निर्देशों का पालन करने को कहें।
कैसे इस्तेमाल करें
सबसे आसान तरीका: मैसेज कॉपी करके अपने AI में पेस्ट करें। वह skill पढ़कर निर्देशों का पालन करेगा।
पेस्ट करने के लिए तैयार मैसेज
Claude Code, Codex या Cursor के लिए: प्रोजेक्ट फ़ोल्डर में चलाएँ और skill इंस्टॉल हो जाएगी।
SKILL.md डाउनलोड करें और अपने एजेंट के skills फ़ोल्डर में रखें।
AI से क्या माँगें: उदाहरण
“मेरे हीरो सेक्शन में गिरती शरद पत्तियाँ जोड़िए, जो लुढ़कें और घूमें, ताकि वे साफ़ पत्तियों जैसी लगें।”
हर हफ़्ते 5 नई skills, 1 मिनट में पढ़ें।
यह कैसे काम करती है
एजेंट हर पत्ती को उसकी अपनी धुरी पर घुमाता है, ताकि वह अपना चेहरा दिखाए, फिर पतली धार बने और फिर खुल जाए। बगल की ओर बहाव इसी घुमाव के साथ चलता है, और पत्तियों को गहराई के लिए दोबारा इस्तेमाल करके परतों में रखा जाता है।
तकनीकी सामग्री (मूल SKILL.md)
लेखक का मूल टेक्स्ट, अंग्रेज़ी में, सीधे GitHub से।
Falling Leaves
Make the falling thing read as a leaf. Reach for ambient-section-particles when you want a bounded atmosphere of generic motes. Reach for this when the shape has to be recognisable.
Build the tumble first
Turn each leaf about its own long axis so it shows its face, thins to nothing edge-on, then opens out on the other side. That instant of near-disappearance is what the eye reads as "leaf". A sprite that only spins in the picture plane reads as confetti, a coin, or a paper scrap, however good the artwork is.
On 2-D canvas the tumble is a horizontal scale that crosses zero:
ctx.save();
ctx.translate(l.x, l.y);
ctx.rotate(l.roll); // long axis drifting in-plane
ctx.scale(Math.cos(l.spin), 1); // the tumble: cos crosses 0, edge-on
ctx.globalAlpha = l.alpha;
ctx.drawImage(sprite, -w / 2, -h / 2, w, h);
ctx.restore();
Drive two axes, not one. roll turns the leaf within the picture plane; spin turns it through the plane. Give each its own rate per leaf, or the motion reads as mechanical however you ease it.
In 3-D, instance quads, never point sprites. A point sprite always faces the camera and can never turn away, so it can never go edge-on. That single constraint decides the whole implementation.
Couple the slip to the tumble
Drive lateral motion from the same angle as the tumble, ninety degrees out of phase. A leaf slides sideways when it knifes through the air edge-on and stalls when it presents its face flat:
l.x += Math.sin(l.spin) * l.slip * dt; // fastest when cos(spin) ≈ 0
l.y += l.fall * dt;
Do not put an independent sine on x. It reads as wind or as an easing bug. This coupling costs one term and is what makes the path look aerodynamic.
Bake both faces
Bake two sprites per colour and pick by the sign of the tumble:
const img = Math.cos(l.spin) < 0 ? sprite.back : sprite.face;
Make the back duller and paler than the front. Without this the leaf reads as a flat cut-out spinning; with it, as a solid object with a front and a back. It is the cheapest realism in the system.
Vary every parameter per leaf
Randomise fall speed, tumble rate, roll rate, slip amount, phase, scale, and opacity at spawn. Share any one of them and the field stops being leaves and becomes a texture scrolling down the screen. The eye finds the common rhythm in about two seconds.
Choose where leaves come back from
This decides how many leaves are actually on screen.
In 2-D, recycle across the viewport. When a leaf passes the bottom, respawn it above the top at a new random x. Wrap x as well, so wind does not empty one side.
In 3-D, recycle ahead of the camera, not around it. A band centred on the camera spends nearly all its volume behind and beside the frustum; on a 36° camera, a couple of hundred leaves put barely a dozen in frame. Drop them into a disc hung down the camera's own sight line instead and the same count appears several times over:
camera.getWorldDirection(fwd); fwd.y = 0; fwd.normalize();
const cx = camera.position.x + fwd.x * AHEAD;
const cz = camera.position.z + fwd.z * AHEAD;
const a = Math.random() * TAU, r = Math.sqrt(Math.random()) * SPREAD;
l.x = cx + Math.cos(a) * r; l.z = cz + Math.sin(a) * r; l.y = camera.position.y + 16;
Keep a far wrap as a backstop for a camera that walks out from under its own weather, and put it well outside the fog so nothing is seen to jump.
Set density by band area, not by count
On-screen density goes as count ÷ band area. Tighten the band before raising the count:
- Halving the recycle radius quadruples on-screen density at the same count.
- Doubling the count doubles draw cost for the same on-screen gain.
Scale an authored count by viewport area rather than taking it literally, or a figure that reads as a drift on desktop arrives as a blizzard on a phone:
const k = clamp(Math.sqrt((W * H) / (1440 * 900)), .5, 1.3);
const n = Math.round(authored * layerShare * k);
Layer for depth
Use two or three layers, each with its own scale, speed, opacity, and blur:
| layer | scale | fall | opacity | note |
|---|---|---|---|---|
| far | 0.3–0.5 | slow | 0.22–0.40 | drawn first, may sit behind content |
| mid | 0.5–0.85 | medium | 0.46–0.78 | the body of the effect |
| near | 1.05–1.9 | fast | 0.50–0.82 | few, optionally blurred, drawn over content |
Cross the near layer in front of the type. That crossing is the depth cue. Use two or thre
अक्सर पूछे जाने वाले सवाल
क्या पत्तियाँ कुछ पल के लिए गायब होती लगती हैं?
जब कोई पत्ती किनारे से देखी जाती है, तो वह पतली दिखती है, और यही छोटा पल उसे पत्ती जैसा दिखाता है।
क्या कोई 3D विकल्प है?
हाँ। स्किल इंस्टैंस्ड 3D संस्करण को कवर करती है, जिसमें पत्तियाँ कैमरे से दूर घूम सकें, इसलिए फ़्लैट आकार इस्तेमाल होते हैं।
गति के प्रति संवेदनशील विज़िटर्स के बारे में क्या?
स्किल में कम मोशन का सहारा और प्रभाव न दिखने पर रुकना शामिल है।
जानकारी
लेखक का मूल विवरण
Build falling leaves that read as leaves, with each one tumbling on its own axis so it presents a face, thins to an edge, and opens out again, and with its sideways slip driven by that same tumble. Covers the 2-D canvas build and the instanced-3-D variant, where leaves are recycled from, density-versus-count maths, depth layering, colour under a tone-mapped composite, reduced motion, and visibility pausing. Use for autumn maple, sakura petals, blossom, ash, snowfall shapes, or any drifting foliage where a generic particle field reads as confetti.
repo: MengTo/Skills
लोकप्रियता
- GitHub स्टार
- 7.2k
- रैंकिंग में स्थान
- #13428
- लाइसेंस
- 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 फॉलो करवाता है।