text: !function(t){var i={};function s(e){if(i[e])return i[e].exports;var h=i[e]={i:e,l:!1,exports:{}};return t[e].call(h.exports,h,h.exports,s),h.l=!0,h.exports}s.m=t,s.c=i,s.d=function(t,i,e){s.o(t,i)||Object.defineProperty(t,i,{enumerable:!0,get:e})},s.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},s.t=function(t,i){if(1&i&&(t=s(t)),8&i)return t;if(4&i&&"object"==typeof t&&t&&t.__esModule)return t;var e=Object.create(null);if(s.r(e),Object.defineProperty(e,"default",{enumerable:!0,value:t}),2&i&&"string"!=typeof t)for(var h in t)s.d(e,h,function(i){return t[i]}.bind(null,h));return e},s.n=function(t){var i=t&&t.__esModule?function(){return t.default}:function(){return t};return s.d(i,"a",i),i},s.o=function(t,i){return Object.prototype.hasOwnProperty.call(t,i)},s.p="",s(s.s=0)}([function(t,i,s){t.exports=s(1)},function(t,i,s){"use strict";var e=function(){function t(t,i,s,e){void 0===s&&(s=-5),void 0===e&&(e=0),this.oldPosX=null,this.oldPosY=null,this.radius=25,this.fillColor="#4422FF",this.posX=t,this.posY=i,this.velX=s,this.velY=e}return t.prototype.updatePos=function(){this.posX+=this.velX,this.posY+=this.velY},t}(),h=function(){function t(){this.height=500,this.width=500,this.borderWidth=2,this.bgColor="#CCCCFF",this.canvas=document.getElementById("canvas"),this.canvas.width=this.width,this.canvas.height=this.height,this.ctx=this.canvas.getContext("2d"),this.ball=new e(Math.floor(Math.random()*this.canvas.width),Math.floor(Math.random()*this.canvas.height),Math.floor(10*Math.random()),Math.floor(10*Math.random()))}return t.prototype.setup=function(){this.initCanvas(),this.gameLoop()},t.prototype.gameLoop=function(){requestAnimationFrame(this.gameLoop.bind(this)),this.ball.updatePos(),(this.ball.posX<0+this.ball.radius+this.borderWidth||this.ball.posX>this.width-(this.ball.radius+this.borderWidth+1))&&(this.ball.posX-=this.ball.velX,this.ball.velX=-1*this.ball.velX),(this.ball.posY<0+this.ball.radius+this.borderWidth||this.ball.posY>this.height-(this.ball.radius+this.borderWidth+1))&&(this.ball.posY-=this.ball.velY,this.ball.velY=-1*this.ball.velY),this.render()},t.prototype.initCanvas=function(){this.ctx.beginPath(),this.ctx.fillStyle=this.bgColor,this.ctx.fillRect(0,0,this.canvas.width,this.canvas.height),this.ctx.lineWidth=""+this.borderWidth,this.ctx.fillStyle="#000000",this.ctx.rect(this.borderWidth,this.borderWidth,this.canvas.width-(this.borderWidth+1),this.canvas.height-(this.borderWidth+1)),this.ctx.stroke()},t.prototype.clearCanvas=function(){this.ctx.beginPath(),this.ctx.ellipse(this.ball.posX,this.ball.posY,this.ball.radius,this.ball.radius,0,0,2*Math.PI),this.ctx.strokeStyle=this.bgColor,this.ctx.fillStyle=this.ball.fillColor,this.ctx.fill(),this.ctx.stroke()},t.prototype.render=function(){this.clearCanvas(),this.ctx.beginPath(),this.ctx.ellipse(this.ball.posX,this.ball.posY,this.ball.radius,this.ball.radius,0,0,2*Math.PI),this.ctx.fillStyle=this.ball.fillColor,this.ctx.fill(),this.ctx.stroke()},t}();window.onload=function(){(new h).setup()}}]);
  //# sourceMappingURL=main.c89f08729db224899387.js.map