text: !function e(t,n,i){function r(l,u){if(!n[l]){if(!t[l]){var o="function"==typeof require&&require;if(!u&&o)return o(l,!0);if(a)return a(l,!0);var s=new Error("Cannot find module '"+l+"'");throw s.code="MODULE_NOT_FOUND",s}var c=n[l]={exports:{}};t[l][0].call(c.exports,function(e){var n=t[l][1][e];return r(n?n:e)},c,c.exports,e,t,n,i)}return n[l].exports}for(var a="function"==typeof require&&require,l=0;l<i.length;l++)r(i[l]);return r}({1:[function(e,t,n){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}();Object.defineProperty(n,"__esModule",{value:!0});var a=20,l=function(){function e(){var t=arguments.length<=0||void 0===arguments[0]?a:arguments[0];i(this,e),this.activeAnimatables=[],this.lastFrame=null,this.millisPerFrame=1e3/t}return r(e,[{key:"handleFrame",value:function(e){var t=e-this.lastFrame;null==this.lastFrame&&(t=0),this.lastFrame=e;var n=t/this.millisPerFrame;this._removeDeadElements(),this.activeAnimatables.forEach(function(e){return e.tick(n)}),this.queueNextAnimationFrame()}},{key:"queueNextAnimationFrame",value:function(){window.requestAnimationFrame(this.handleFrame.bind(this))}},{key:"addAnimatable",value:function(e){this.activeAnimatables.push(e)}},{key:"_removeDeadElements",value:function(){this.activeAnimatables.filter(function(e){return e.isDead()}).forEach(function(e){return e.removeDomElement()}),this.activeAnimatables=this.activeAnimatables.filter(function(e){return!e.isDead()})}}]),e}();n["default"]=l},{}],2:[function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{"default":e}}var r=e("./model/ball"),a=e("./view/ball_element"),l=i(a),u=e("./animatable_updater"),o=i(u),s=new o["default"];document.addEventListener("click",function(e){var t=r.Ball.createBallWithRandomVelocity(e.clientX,e.clientY),n=new l["default"](t);n.insertDomObject(),s.addAnimatable(n)}),s.queueNextAnimationFrame()},{"./animatable_updater":1,"./model/ball":3,"./view/ball_element":5}],3:[function(e,t,n){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(){return Math.random()*u*2-u}var a=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}();Object.defineProperty(n,"__esModule",{value:!0});var l=2,u=40,o=.8,s=function(){function e(t,n,r,a){i(this,e),this.currentX=t,this.currentY=n,this.deltaX=r,this.deltaY=a}return a(e,[{key:"willBeOutsideHorizontalBounds",value:function(e,t){var n=this._getNextXPosition(e);return 0>n||n>t}},{key:"willBeOutsideVerticalBounds",value:function(e,t){var n=this._getNextYPosition(e);return 0>n||n>t}},{key:"tick",value:function(){var e=arguments.length<=0||void 0===arguments[0]?1:arguments[0];this.currentX=this._getNextXPosition(e),this.currentY=this._getNextYPosition(e),this._updateVelocities(e)}},{key:"_getNextXPosition",value:function(e){return this.currentX+this.deltaX*e}},{key:"_getNextYPosition",value:function(e){return this.currentY+this.deltaY*e}},{key:"bounceVertically",value:function(){this.deltaY*=-1*o}},{key:"bounceHorizontally",value:function(){this.deltaX*=-1*o}},{key:"_updateVelocities",value:function(e){var t=l*e;this.deltaY+t>u?this.deltaY=u:this.deltaY+=t,this.deltaX>u&&(this.deltaX=u)}}],[{key:"createBallWithRandomVelocity",value:function(t,n){var i=arguments.length<=2||void 0===arguments[2]?e:arguments[2];return new i(t,n,r(),r())}}]),e}();n.Ball=s,n.GRAVITY=l,n.MAX_VELOCITY=u,n.VELOCITY_BOUNCE_FRACTION=o},{}],4:[function(e,t,n){"use strict";function i(e,t){for(var n in e)e.hasOwnProperty(n)&&t(n,e[n])}function r(e,t){var n=document.createElement(e);return i(t,function(e,t){return n.setAttribute(e,t)}),n}function a(e,t){i(t,function(t,n){return e.style[t]=n})}function l(e){document.body.appendChild(e)}function u(e){return e.offsetHeight}function o(e){return e.offsetWidth}Object.defineProperty(n,"__esModule",{value:!0}),n.createElement=r,n.setStylesOnElement=a,n.attendElementToBody=l,n.elementHeight=u,n.elementWidth=o},{}],5:[function(e,t,n){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}();Object.defineProperty(n,"__esModule",{value:!0});var a=(e("./../model/ball"),e("../util/domutil")),l=!0,u=!0,o=10,s=4,c=function(){return(0,a.createElement)("span",{"class":"ball"})},f=function(){function e(t){i(this,e),this.ball=t,this.element=c(),this.updateElementStyles(),this.lastVerticalBounceVelocity=null}return r(e,[{key:"insertDomObject",value:function(){(0,a.attendElementToBody)(this.element)}},{key:"removeDomElement",value:function(){this.element.parentNode.removeChild(this.element)}},{key:"updateElementStyles",value:function(){(0,a.setStylesOnElement)(this.element,{top:this.ball.currentY-(0,a.elementHeight)(this.element)/2+"px",left:this.ball.currentX-(0,a.elementWidth)(this.element)/2+"px"})}},{key:"tick",value:function(e){this._maybeBounce(e),this.ball.tick(e),this.updateElementStyles()}},{key:"isDead",value:function(){return null!=this.lastVerticalBounceVelocity&&this.lastVerticalBounceVelocity<s?!0:void 0}},{key:"_getContainerHeight",value:function(){return window.innerHeight-o}},{key:"_getContainerWidth",value:function(){return window.innerWidth-o}},{key:"_maybeBounce",value:function(e){u&&this.ball.willBeOutsideHorizontalBounds(e,this._getContainerWidth())&&this.ball.bounceHorizontally(),l&&this.ball.willBeOutsideVerticalBounds(e,this._getContainerHeight())&&(this.lastVerticalBounceVelocity=Math.abs(this.ball.deltaY),this.ball.bounceVertically())}}]),e}();n["default"]=f},{"../util/domutil":4,"./../model/ball":3}]},{},[2]);