{
    "id": "bhaskar/morphing-gradient-blob",
    "kind": "component",
    "title": "Morphing Gradient Blob",
    "summary": "A soft gradient blob that wobbles on springs and leans toward your cursor wherever it moves.",
    "author": "Admin",
    "stars": 0,
    "url": "https://ownlyplans.com/bhaskar/morphing-gradient-blob/",
    "stack": [
        "CSS",
        "HTML",
        "JavaScript"
    ],
    "tools": [
        "claude-code",
        "cursor",
        "lovable"
    ],
    "difficulty": "beginner",
    "license": "mit",
    "version": "1.0",
    "overview": "An organic, living shape for hero sections. A blurred violet-to-cyan blob is drawn through eight control points joined with smooth curves, and every couple of seconds each point picks a new radius and springs toward it, so the outline breathes and wobbles. The whole blob drifts gently toward your pointer and glides back when you move away. Point count, size, variance, speed, spring stiffness and damping, cursor pull and colours are all adjustable, and it rests as a calm circle for reduced motion.",
    "steps": [],
    "files": [],
    "install": "",
    "how_to_use": "Use the component code (html, css, js, or react) directly, or run the install command.",
    "component": {
        "category": "Backgrounds",
        "html": "<!--\n  MIT License\n  Copyright (c) 2026 Suraj Maurya\n  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated\n  documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation\n  the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and\n  to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n  The above copyright notice and this permission notice shall be included in all copies or substantial portions\n  of the Software.\n  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO\n  THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF\n  CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\n  DEALINGS IN THE SOFTWARE.\n-->\n<div class=\"mb-stage\">\n  <svg class=\"mb\" viewBox=\"0 0 400 400\" aria-hidden=\"true\" data-points=\"8\" data-radius=\"120\" data-variance=\"28\" data-speed=\"0.7\" data-stiffness=\"45\" data-damping=\"9\" data-strength=\"0.35\" data-smooth=\"0.08\" data-c1=\"#7C3AED\" data-c2=\"#06B6D4\"></svg>\n  <div class=\"mb-copy\"><h2>Shape that breathes</h2><p>Move your cursor around.</p></div>\n</div>",
        "css": ".mb-stage{position:relative;width:100%;min-height:calc(100vh - 40px);display:grid;place-items:center;overflow:hidden;border-radius:16px;background:#0a0a0c;font-family:Inter,system-ui,-apple-system,\"Segoe UI\",sans-serif}\n.mb{position:absolute;left:50%;top:50%;width:min(400px,90vw,calc(100vh - 40px));height:auto;aspect-ratio:1;overflow:visible;transform:translate(-50%,-50%);pointer-events:none;user-select:none}\n.mb-copy{position:relative;z-index:1;text-align:center;pointer-events:none}\n.mb-copy h2{margin:0;color:#fff;font-size:clamp(26px,5vw,44px);font-weight:700;letter-spacing:-.03em;text-shadow:0 2px 24px rgba(0,0,0,.35)}\n.mb-copy p{margin:8px 0 0;color:rgba(255,255,255,.75);font-size:14px}",
        "js": "(function(){\n  var NS='http://www.w3.org/2000/svg',TAU=Math.PI*2,uid=0,reduce=matchMedia('(prefers-reduced-motion: reduce)').matches;\n  function path(c){var n=c.length,d='M '+c[0].x.toFixed(2)+','+c[0].y.toFixed(2)+' ';for(var i=0;i<n;i++){var p0=c[(i-1+n)%n],p1=c[i],p2=c[(i+1)%n],p3=c[(i+2)%n];d+='C '+(p1.x+(p2.x-p0.x)/6).toFixed(2)+','+(p1.y+(p2.y-p0.y)/6).toFixed(2)+' '+(p2.x-(p3.x-p1.x)/6).toFixed(2)+','+(p2.y-(p3.y-p1.y)/6).toFixed(2)+' '+p2.x.toFixed(2)+','+p2.y.toFixed(2)+' ';}return d+'Z';}\n  document.querySelectorAll('svg.mb').forEach(function(svg){\n    var d=svg.dataset,W=400,H=400,N=+d.points||8,R=+d.radius||120,V=+d.variance||28,SP=+d.speed||.7,K=+d.stiffness||45,DA=+d.damping||9,CS=+d.strength||.35,SM=+d.smooth||.08,id='mbg'+(uid++);\n    svg.innerHTML='<defs><linearGradient id=\"'+id+'\" x1=\"0%\" y1=\"0%\" x2=\"100%\" y2=\"100%\"><stop offset=\"0%\" stop-color=\"'+(d.c1||'#7C3AED')+'\"/><stop offset=\"100%\" stop-color=\"'+(d.c2||'#06B6D4')+'\"/></linearGradient></defs>';\n    var p=document.createElementNS(NS,'path');p.setAttribute('fill','url(#'+id+')');p.style.filter='blur(10px)';svg.appendChild(p);\n    var st=[];for(var i=0;i<N;i++)st.push({r:R,v:0,t:R});\n    function coords(ox,oy){return st.map(function(s,i){var a=i/N*TAU;return{x:W/2+Math.cos(a)*s.r+ox,y:H/2+Math.sin(a)*s.r+oy};});}\n    p.setAttribute('d',path(coords(0,0)));\n    if(reduce)return;\n    var cur={x:W/2,y:H/2},pos={x:W/2,y:H/2};\n    addEventListener('pointermove',function(e){var r=svg.getBoundingClientRect();if(!r.width)return;cur.x=(e.clientX-r.left)*W/r.width;cur.y=(e.clientY-r.top)*H/r.height;});\n    document.documentElement.addEventListener('pointerleave',function(){cur.x=W/2;cur.y=H/2;});\n    function retarget(){st.forEach(function(s){s.t=R+(Math.random()*2-1)*V;});}\n    retarget();setInterval(retarget,1800/Math.max(SP,.01));\n    var last=performance.now();\n    requestAnimationFrame(function f(now){var dt=Math.min((now-last)/1000,.05);last=now;pos.x+=(cur.x-pos.x)*SM;pos.y+=(cur.y-pos.y)*SM;\n      st.forEach(function(s){s.v+=((s.t-s.r)*K-s.v*DA)*dt;s.r+=s.v*dt;});\n      p.setAttribute('d',path(coords((pos.x-W/2)*CS,(pos.y-H/2)*CS)));requestAnimationFrame(f);});\n  });\n})();",
        "react": "",
        "dependencies": [],
        "install": "",
        "licence_notice": ""
    }
}