mirror of
https://ghfast.top/https://github.com/zsjy/halo-theme-dream2.0-plus.git
synced 2025-03-17 07:09:40 +08:00
1 line
908 B
JavaScript
1 line
908 B
JavaScript
!function(){let t,n,i=document.body,e=window.innerWidth,o=window.innerHeight,s={x:e/2,y:e/2},h=new function(i,t,n,e){this.position={x:i,y:t},this.width=10,this.lag=10,this.moveTowards=function(i,t,n){this.position.x+=(i-this.position.x)/this.lag,this.position.y+=(t-this.position.y)/this.lag,n.fillStyle="rgba(50, 50, 50, 0.65)",n.beginPath(),n.arc(this.position.x,this.position.y,this.width,0,2*Math.PI),n.fill(),n.closePath()}}(e/2,o/2);t=document.createElement("canvas"),n=t.getContext("2d"),t.style.top="0px",t.style.left="0px",t.style.pointerEvents="none",t.style.position="fixed",document.body.appendChild(t),t.width=e,t.height=o,i.addEventListener("mousemove",function(i){s.x=i.clientX,s.y=i.clientY}),window.addEventListener("resize",function(i){e=window.innerWidth,o=window.innerHeight,t.width=e,t.height=o}),function i(){n.clearRect(0,0,e,o),h.moveTowards(s.x,s.y,n),requestAnimationFrame(i)}()}(); |