-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.js
2 lines (2 loc) · 819 Bytes
/
main.js
1
2
(()=>{var o,e,i,t=100,n=t,r=100,l=0,d=0,v,c,f=new Audio("plop.wav"),u=new Image;u.src="logo.png";function T(){e.resetTransform(),e.clearRect(0,0,v,c),e.fillStyle=`hsl(${l}, 50%, 50%)`,e.translate(i.x,i.y),e.beginPath(),e.moveTo(0,-t),e.lineTo(n,-n),e.lineTo(t,0),e.lineTo(n,n),e.lineTo(0,t),e.lineTo(-n,n),e.lineTo(-t,0),e.lineTo(-n,-n),e.fill(),e.resetTransform(),e.drawImage(u,50,50)}function g(a){n+=r*a,n>1.5*t?(r=-r,n=1.5*t):n<.1*t&&(r=-r,n=.1*t),l=(l+1)%360}function m(a){let s=a-d;d=a,g(s/1e4),T(),window.requestAnimationFrame(m)}function p(a){f.play()}function w(){o=document.querySelector("#canvas"),e=o.getContext("2d"),o.addEventListener("click",p),v=o.width,c=o.height,i={x:v/2,y:c/2},m(performance.now())}document.addEventListener("DOMContentLoaded",function(){w()});})();
//# sourceMappingURL=main.js.map