var f=Object.defineProperty;var y=(c,n,o)=>n in c?f(c,n,{enumerable:!0,configurable:!0,writable:!0,value:o}):c[n]=o;var a=(c,n,o)=>y(c,typeof n!="symbol"?n+"":n,o);import{b7 as _,O as v,r as I,ai as M,aY as z,aT as C}from"./index-xnhGKCfe.js";const T="/images/gold1-Cn3R-UBE.webp",B=_({__name:"index",setup(c,{expose:n}){const o=I();let i;const d=window.innerWidth,l=window.innerHeight,h=[];let m=0;const u=new Image;u.src=T;class x{constructor(t,e,r,p){a(this,"startTime",performance.now());a(this,"duration",800);a(this,"size",24);a(this,"rotateSpeed",(Math.random()*2+2)*Math.PI);a(this,"angle",Math.random()*Math.PI*2);a(this,"cx");a(this,"cy");this.sx=t,this.sy=e,this.ex=r,this.ey=p,this.cx=(t+r)/2,this.cy=e-120-Math.random()*60}draw(t){const e=Math.min((t-this.startTime)/this.duration,1),r=(1-e)**2*this.sx+2*(1-e)*e*this.cx+e**2*this.ex,p=(1-e)**2*this.sy+2*(1-e)*e*this.cy+e**2*this.ey,w=1-e*.6;this.angle+=this.rotateSpeed*.016,i.save(),i.translate(r,p),i.rotate(this.angle),i.scale(w,w),i.drawImage(u,-this.size/2,-this.size/2,this.size,this.size),i.restore()}isDone(t){return t-this.startTime>=this.duration}}function g(s){i.clearRect(0,0,d,l),h.forEach(t=>t.draw(s));for(let t=h.length-1;t>=0;t--)h[t].isDone(s)&&h.splice(t,1);m=requestAnimationFrame(g)}return v(()=>{const s=o.value,t=window.devicePixelRatio||1;s.width=d*t,s.height=l*t,s.style.width=d+"px",s.style.height=l+"px",i=s.getContext("2d"),i.scale(t,t),m=requestAnimationFrame(g)}),M(()=>{cancelAnimationFrame(m)}),n({addCoin(s,t,e,r){h.push(new x(s,t,e,r))}}),(s,t)=>(C(),z("canvas",{ref_key:"canvas",ref:o,class:"coin-canvas"},null,512))}});export{B as default};
