mirror of
https://ghfast.top/https://github.com/zsjy/halo-theme-dream2.0-plus.git
synced 2025-03-15 02:43:08 +08:00
1 line
927 B
JavaScript
1 line
927 B
JavaScript
!function(){let t,n,e=void 0,i=(e,document.body),o=window.innerWidth,s=window.innerHeight,h={x:o/2,y:o/2},d=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()}}(o/2,s/2);t=document.createElement("canvas"),n=t.getContext("2d"),t.style.top="0px",t.style.left="0px",t.style.pointerEvents="none",e,t.style.position="fixed",document.body.appendChild(t),t.width=o,t.height=s,i.addEventListener("mousemove",function(i){e,h.x=i.clientX,h.y=i.clientY}),window.addEventListener("resize",function(i){o=window.innerWidth,s=window.innerHeight,e,t.width=o,t.height=s}),function i(){n.clearRect(0,0,o,s),d.moveTowards(h.x,h.y,n),requestAnimationFrame(i)}()}(); |