1 line
2.9 KiB
JavaScript
1 line
2.9 KiB
JavaScript
$(function(){function A(A){function t(){d=document.createElement("canvas"),a=d.getContext("2d"),d.style.top="0px",d.style.left="0px",d.style.pointerEvents="none",s?(d.style.position="absolute",p.appendChild(d),d.width=p.clientWidth,d.height=p.clientHeight):(d.style.position="fixed",document.body.appendChild(d),d.width=u,d.height=m),e(),c()}function e(){p.addEventListener("mousemove",o),p.addEventListener("touchmove",n),p.addEventListener("touchstart",n),window.addEventListener("resize",i)}function i(A){u=window.innerWidth,m=window.innerHeight,s?(d.width=p.clientWidth,d.height=p.clientHeight):(d.width=u,d.height=m)}function n(A){if(A.touches.length>0)for(let t=0;t<A.touches.length;t++)g(A.touches[t].clientX,A.touches[t].clientY,C)}function o(A){if(s){const t=p.getBoundingClientRect();E.x=A.clientX-t.left,E.y=A.clientY-t.top}else E.x=A.clientX,E.y=A.clientY;g(E.x,E.y,C)}function g(A,t,e){w.push(new l(A,t,e))}function h(){a.clearRect(0,0,u,m);for(let A=0;A<w.length;A++)w[A].update(a);for(let A=w.length-1;A>=0;A--)w[A].lifeSpan<0&&w.splice(A,1)}function c(){h(),requestAnimationFrame(c)}function l(A,t,e){const i=40;this.initialLifeSpan=i,this.lifeSpan=i,this.position={x:A,y:t},this.image=e,this.update=function(A){this.lifeSpan--;const t=Math.max(this.lifeSpan/this.initialLifeSpan,0);A.globalAlpha=t,A.drawImage(this.image,this.position.x,this.position.y)}}let d,a,s=A&&A.element,p=s||document.body,u=window.innerWidth,m=window.innerHeight,E={x:u/2,y:u/2},w=[],C=new Image;C.src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAATCAYAAACk9eypAAAAAXNSR0IArs4c6QAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAAhGVYSWZNTQAqAAAACAAFARIAAwAAAAEAAQAAARoABQAAAAEAAABKARsABQAAAAEAAABSASgAAwAAAAEAAgAAh2kABAAAAAEAAABaAAAA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