(()=>{const t=document.createElement("canvas");document.body.appendChild(t),t.style.cssText="position:fixed;inset:0;z-index:1000;opacity:0.8;pointer-events:none";const e=t.getContext("2d"),n=()=>{t.width=innerWidth,t.height=innerHeight};n(),onresize=n;const a=[];for(let t=0;t<120;t++)a.push({x:Math.random()*innerWidth,y:Math.random()*innerHeight,vx:4*(Math.random()-.5),vy:-2*Math.random()-1,r:2+4*Math.random(),c:["#ff3b3b","#ffb74d","#ffd54f","#81d4fa","#a5d6a7"][t%5]});!function n(){e.clearRect(0,0,t.width,t.height);for(const n of a)n.x+=n.vx,n.y+=n.vy+.6,n.vy*=.99,n.y>t.height+10&&(n.x=Math.random()*t.width,n.y=-10),e.beginPath(),e.fillStyle=n.c,e.globalAlpha=.95,e.shadowColor=n.c,e.shadowBlur=12,e.arc(n.x,n.y,n.r,0,6.28),e.fill();requestAnimationFrame(n)}()})();
展开
评论