UNPKG

@limetech/lime-elements

Version:
2 lines 995 B
const o=100;const t=50;const e=1.6;const n=2;const s=2;const c=(c,l)=>d=>{const a=d.clientX;const h=d.clientY;const m=a-c.x;const r=h-c.y;const f={x:m-c.width/s,y:r-c.height/s};const i=Math.sqrt(f.x**s+f.y**s);const u=Math.sqrt(Math.min(c.width,c.height)/t);const v=`\n ${f.y/(o*u)},\n ${-f.x/(o*u)},\n 0,\n ${Math.log(i)*e/u}deg\n `;l.style.setProperty("--limel-3d-hover-effect-rotate3d",v);const M=`\n ${f.x*n+c.width/s}px\n ${f.y*n+c.height/s}px\n `;l.style.setProperty("--limel-3d-hover-effect-glow-position",M)};const l=o=>{let t;const e=()=>{const e=o.getBoundingClientRect();t=c(e,o);document.addEventListener("mousemove",t)};const n=()=>{document.removeEventListener("mousemove",t);o.style.removeProperty("--limel-3d-hover-effect-rotate3d");o.style.removeProperty("--limel-3d-hover-effect-glow-position")};return{handleMouseEnter:e,handleMouseLeave:n}};export{l as g}; //# sourceMappingURL=p-d1947575.js.map