Nimbu Mirchi Charm
A hanging lemon-and-chilli charm that swings toward your cursor on heavy, playful springs.
Preview and code
index.html
<!--
MIT License
Copyright (c) 2026 Suraj Maurya
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
documentation files (the "Software"), to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and
to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions
of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
-->
<div class="nm-stage" role="img" aria-label="Hanging nimbu-mirchi charm that swings with the pointer">
<span class="nm-line" aria-hidden="true"></span>
<div class="nm-swing" aria-hidden="true">
<span class="nm-tie"></span>
<svg viewBox="0 0 360 520">
<defs>
<linearGradient id="nm-body" x1="0" y1="0" x2="0" y2="1"><stop offset="0%" stop-color="#3F8B2A"/><stop offset="55%" stop-color="#2E6B1E"/><stop offset="100%" stop-color="#234F18"/></linearGradient>
<linearGradient id="nm-shine" x1="0" y1="0" x2="0" y2="1"><stop offset="0%" stop-color="#9BD86A" stop-opacity=".85"/><stop offset="100%" stop-color="#9BD86A" stop-opacity="0"/></linearGradient>
<linearGradient id="nm-dark" x1="0" y1="0" x2="0" y2="1"><stop offset="0%" stop-color="#1E3F14"/><stop offset="100%" stop-color="#0F2409"/></linearGradient>
<radialGradient id="nm-lemon" cx="40%" cy="35%" r="75%"><stop offset="0%" stop-color="#FFE36B"/><stop offset="60%" stop-color="#F2C72F"/><stop offset="100%" stop-color="#C2901A"/></radialGradient>
<radialGradient id="nm-lsh" cx="65%" cy="80%" r="55%"><stop offset="0%" stop-color="#7A5A0E" stop-opacity=".45"/><stop offset="100%" stop-color="#7A5A0E" stop-opacity="0"/></radialGradient>
<radialGradient id="nm-lhi" cx="35%" cy="30%" r="22%"><stop offset="0%" stop-color="#FFFBE0" stop-opacity=".9"/><stop offset="100%" stop-color="#FFFBE0" stop-opacity="0"/></radialGradient>
<linearGradient id="nm-knot" x1="0" y1="0" x2="0" y2="1"><stop offset="0%" stop-color="#3A3A3A"/><stop offset="100%" stop-color="#161616"/></linearGradient>
</defs>
<g class="nm-cl">
<g transform="rotate(-3 180 60)"><path d="M50 30C80 14 220 16 305 50C318 56 318 70 305 76C220 100 90 96 56 80C42 70 38 42 50 30Z" fill="url(#nm-body)"/><path d="M50 30C80 14 220 16 305 50C318 56 318 70 305 76C220 100 90 96 56 80C42 70 38 42 50 30Z" fill="url(#nm-dark)" opacity=".35"/><path d="M70 32C140 24 230 26 290 50" stroke="url(#nm-shine)" stroke-width="3.5" fill="none" stroke-linecap="round" opacity=".9"/><ellipse cx="305" cy="60" rx="5" ry="3.4" fill="#1B3A11"/><ellipse cx="303.5" cy="59" rx="2" ry="1.2" fill="#2E5A1F" opacity=".8"/></g>
<g transform="rotate(2 180 60)"><path d="M30 92C90 78 260 82 320 110C332 118 330 130 316 138C240 158 90 156 44 142C28 134 18 102 30 92Z" fill="url(#nm-body)"/><path d="M30 92C90 78 260 82 320 110C332 118 330 130 316 138C240 158 90 156 44 142C28 134 18 102 30 92Z" fill="url(#nm-dark)" opacity=".35"/><path d="M60 96C150 86 250 88 308 112" stroke="url(#nm-shine)" stroke-width="3.5" fill="none" stroke-linecap="round" opacity=".9"/><ellipse cx="320" cy="120" rx="5" ry="3.4" fill="#1B3A11"/><ellipse cx="318.5" cy="119" rx="2" ry="1.2" fill="#2E5A1F" opacity=".8"/></g>
<g transform="rotate(-2 180 60)"><path d="M52 158C100 144 250 146 308 170C322 178 320 192 304 198C230 218 90 216 60 200C44 192 40 168 52 158Z" fill="url(#nm-body)"/><path d="M52 158C100 144 250 146 308 170C322 178 320 192 304 198C230 218 90 216 60 200C44 192 40 168 52 158Z" fill="url(#nm-dark)" opacity=".35"/><path d="M70 162C160 152 240 154 296 174" stroke="url(#nm-shine)" stroke-width="3.5" fill="none" stroke-linecap="round" opacity=".9"/><ellipse cx="308" cy="180" rx="5" ry="3.4" fill="#1B3A11"/><ellipse cx="306.5" cy="179" rx="2" ry="1.2" fill="#2E5A1F" opacity=".8"/></g>
<g transform="rotate(4 180 60)"><path d="M40 220C90 206 260 208 314 232C326 240 322 254 308 260C230 278 100 276 52 262C38 254 28 230 40 220Z" fill="url(#nm-body)"/><path d="M40 220C90 206 260 208 314 232C326 240 322 254 308 260C230 278 100 276 52 262C38 254 28 230 40 220Z" fill="url(#nm-dark)" opacity=".35"/><path d="M64 224C160 214 250 216 302 236" stroke="url(#nm-shine)" stroke-width="3.5" fill="none" stroke-linecap="round" opacity=".9"/><ellipse cx="314" cy="240" rx="5" ry="3.4" fill="#1B3A11"/><ellipse cx="312.5" cy="239" rx="2" ry="1.2" fill="#2E5A1F" opacity=".8"/></g>
</g>
<g class="nm-le">
<ellipse cx="180" cy="340" rx="92" ry="86" fill="url(#nm-lemon)"/>
<ellipse cx="188" cy="350" rx="92" ry="86" fill="url(#nm-lsh)"/>
<ellipse cx="158" cy="312" rx="36" ry="22" fill="url(#nm-lhi)"/>
<path d="M254 332q6-2 10 4q-2 8-10 6z" fill="#C28A12" opacity=".85"/>
<circle cx="142" cy="332" r="1.6" fill="#E0A91A" opacity=".55"/><circle cx="208" cy="322" r="1.4" fill="#E0A91A" opacity=".55"/><circle cx="168" cy="370" r="1.6" fill="#E0A91A" opacity=".5"/><circle cx="216" cy="362" r="1.4" fill="#E0A91A" opacity=".5"/><circle cx="138" cy="356" r="1.2" fill="#E0A91A" opacity=".45"/><circle cx="184" cy="338" r="1.2" fill="#E0A91A" opacity=".4"/>
</g>
<g><rect x="152" y="418" width="56" height="28" rx="6" fill="url(#nm-knot)"/><rect x="179" y="418" width="2" height="28" fill="#0A0A0A" opacity=".7"/><rect x="164" y="418" width="1" height="28" fill="#2A2A2A" opacity=".6"/></g>
<g class="nm-st">
<path d="M168 446C162 466 174 482 158 500C152 506 156 514 150 520" stroke="#5A5A5A" stroke-width="1.4" fill="none" stroke-linecap="round"/>
<path d="M180 446C188 466 172 482 188 500C196 508 192 514 200 520" stroke="#777" stroke-width="1.1" fill="none" stroke-linecap="round"/>
<path d="M156 446C144 462 156 478 142 494" stroke="#8C8C8C" stroke-width="1" fill="none" stroke-linecap="round"/>
</g>
</svg>
</div>
</div>
styles.css
.nm-stage{position:relative;width:100%;min-height:calc(100vh - 40px);display:flex;align-items:flex-start;justify-content:center;overflow:hidden;border-radius:16px;background:radial-gradient(70% 60% at 50% 40%,#1d1a12 0,#0c0c0e 70%);touch-action:none;user-select:none}
.nm-line{position:absolute;left:50%;top:0;width:1px;height:48px;background:#525252;transform:translateX(-50%)}
.nm-swing{position:relative;width:min(300px,62vw,calc((100vh - 110px) * .69));margin-top:44px;transform-origin:top center;will-change:transform}
.nm-tie{position:absolute;left:50%;top:-44px;width:1px;height:50px;background:#6b6b6b;transform:translateX(-50%)}
.nm-swing svg{display:block;width:100%;height:auto;overflow:visible}
script.js
(function(){
var reduce=matchMedia('(prefers-reduced-motion: reduce)').matches;
document.querySelectorAll('.nm-stage').forEach(function(st){
var sw=st.querySelector('.nm-swing'),cl=st.querySelector('.nm-cl'),le=st.querySelector('.nm-le'),sr=st.querySelector('.nm-st'),tx=0,ty=0,x=0,y=0,vx=0,vy=0,last=performance.now();
if(reduce)return;
st.addEventListener('pointermove',function(e){var r=st.getBoundingClientRect();if(!r.width)return;tx=Math.max(-1,Math.min(1,(e.clientX-(r.left+r.width/2))/(r.width/2)));ty=Math.max(-1,Math.min(1,(e.clientY-(r.top+r.height/2))/(r.height/2)));});
st.addEventListener('pointerleave',function(){tx=0;ty=0;});
requestAnimationFrame(function f(now){var dt=Math.min(.05,(now-last)/1000);last=now;
for(var s=0;s<dt;s+=.004){vx+=((-55*(x-tx))-9*vx)/1.8*.004;x+=vx*.004;vy+=((-45*(y-ty))-10*vy)/1.6*.004;y+=vy*.004;}
sw.style.transform='translateY('+(y*5).toFixed(2)+'px) rotate('+(x*13).toFixed(3)+'deg)';
cl.setAttribute('transform','rotate('+(x*7).toFixed(3)+' 180 10)');le.setAttribute('transform','rotate('+(x*3).toFixed(3)+' 180 340)');sr.setAttribute('transform','rotate('+(x*5).toFixed(3)+' 180 446)');
requestAnimationFrame(f);});
});
})();
About
The classic Indian doorway charm, built in SVG. A bundle of four glossy green chillies hangs above a bright lemon with a dark knot and three loose threads trailing below. Move your pointer and the whole charm swings toward it from its string, with the chilli cluster, the lemon and the threads each rotating a little differently for a natural, weighty sway and a gentle bob. Leave and it settles back to centre. It is pure vector art with layered gradients, and holds still for reduced motion.


