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AAgBpB,GAAgBC,GAG1CC,EAAS,CACPxB,SAAUyB,EACV1B,WAAO1d,GANb,GASG,CAAC+f,EAAKM,EAAapB,EAAaC,EAAME,IAEzC,IAAM57B,EAAS,CAAC28B,EAAQX,EAAM7B,OAAQ6B,EAAM9B,OAO5C,OAJAl6B,EAAOu8B,IAAMv8B,EAAO,GACpBA,EAAOm6B,OAASn6B,EAAO,GACvBA,EAAOk6B,MAAQl6B,EAAO,GAEfA,CACR","sources":["../node_modules/matter-js/build/matter.js","../node_modules/src/observe.ts","../node_modules/src/InView.tsx","../node_modules/src/useInView.tsx"],"sourcesContent":["/*!\n * matter-js 0.18.0 by @liabru\n * http://brm.io/matter-js/\n * License MIT\n * \n * The MIT License (MIT)\n * \n * Copyright (c) Liam Brummitt and contributors.\n * \n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n * \n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n * \n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\n(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine(\"Matter\", [], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"Matter\"] = factory();\n\telse\n\t\troot[\"Matter\"] = factory();\n})(this, function() {\nreturn /******/ (function(modules) { // webpackBootstrap\n/******/ \t// The module cache\n/******/ \tvar installedModules = {};\n/******/\n/******/ \t// The require function\n/******/ \tfunction __webpack_require__(moduleId) {\n/******/\n/******/ \t\t// Check if module is in cache\n/******/ \t\tif(installedModules[moduleId]) {\n/******/ \t\t\treturn installedModules[moduleId].exports;\n/******/ \t\t}\n/******/ \t\t// Create a new module (and put it into the cache)\n/******/ \t\tvar module = installedModules[moduleId] = {\n/******/ \t\t\ti: moduleId,\n/******/ \t\t\tl: false,\n/******/ \t\t\texports: {}\n/******/ \t\t};\n/******/\n/******/ \t\t// Execute the module function\n/******/ \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n/******/\n/******/ \t\t// Flag the module as loaded\n/******/ \t\tmodule.l = true;\n/******/\n/******/ \t\t// Return the exports of the module\n/******/ \t\treturn module.exports;\n/******/ \t}\n/******/\n/******/\n/******/ \t// expose the modules object (__webpack_modules__)\n/******/ \t__webpack_require__.m = modules;\n/******/\n/******/ \t// expose the module cache\n/******/ \t__webpack_require__.c = installedModules;\n/******/\n/******/ \t// define getter function for harmony exports\n/******/ \t__webpack_require__.d = function(exports, name, getter) {\n/******/ \t\tif(!__webpack_require__.o(exports, name)) {\n/******/ \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n/******/ \t\t}\n/******/ \t};\n/******/\n/******/ \t// define __esModule on exports\n/******/ \t__webpack_require__.r = function(exports) {\n/******/ \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n/******/ \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n/******/ \t\t}\n/******/ \t\tObject.defineProperty(exports, '__esModule', { value: true });\n/******/ \t};\n/******/\n/******/ \t// create a fake namespace object\n/******/ \t// mode & 1: value is a module id, require it\n/******/ \t// mode & 2: merge all properties of value into the ns\n/******/ \t// mode & 4: return value when already ns object\n/******/ \t// mode & 8|1: behave like require\n/******/ \t__webpack_require__.t = function(value, mode) {\n/******/ \t\tif(mode & 1) value = __webpack_require__(value);\n/******/ \t\tif(mode & 8) return value;\n/******/ \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n/******/ \t\tvar ns = Object.create(null);\n/******/ \t\t__webpack_require__.r(ns);\n/******/ \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n/******/ \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n/******/ \t\treturn ns;\n/******/ \t};\n/******/\n/******/ \t// getDefaultExport function for compatibility with non-harmony modules\n/******/ \t__webpack_require__.n = function(module) {\n/******/ \t\tvar getter = module && module.__esModule ?\n/******/ \t\t\tfunction getDefault() { return module['default']; } :\n/******/ \t\t\tfunction getModuleExports() { return module; };\n/******/ \t\t__webpack_require__.d(getter, 'a', getter);\n/******/ \t\treturn getter;\n/******/ \t};\n/******/\n/******/ \t// Object.prototype.hasOwnProperty.call\n/******/ \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n/******/\n/******/ \t// __webpack_public_path__\n/******/ \t__webpack_require__.p = \"\";\n/******/\n/******/\n/******/ \t// Load entry module and return exports\n/******/ \treturn __webpack_require__(__webpack_require__.s = 21);\n/******/ })\n/************************************************************************/\n/******/ ([\n/* 0 */\n/***/ (function(module, exports) {\n\n/**\n* The `Matter.Common` module contains utility functions that are common to all modules.\n*\n* @class Common\n*/\n\nvar Common = {};\n\nmodule.exports = Common;\n\n(function() {\n\n Common._nextId = 0;\n Common._seed = 0;\n Common._nowStartTime = +(new Date());\n Common._warnedOnce = {};\n Common._decomp = null;\n \n /**\n * Extends the object in the first argument using the object in the second argument.\n * @method extend\n * @param {} obj\n * @param {boolean} deep\n * @return {} obj extended\n */\n Common.extend = function(obj, deep) {\n var argsStart,\n args,\n deepClone;\n\n if (typeof deep === 'boolean') {\n argsStart = 2;\n deepClone = deep;\n } else {\n argsStart = 1;\n deepClone = true;\n }\n\n for (var i = argsStart; i < arguments.length; i++) {\n var source = arguments[i];\n\n if (source) {\n for (var prop in source) {\n if (deepClone && source[prop] && source[prop].constructor === Object) {\n if (!obj[prop] || obj[prop].constructor === Object) {\n obj[prop] = obj[prop] || {};\n Common.extend(obj[prop], deepClone, source[prop]);\n } else {\n obj[prop] = source[prop];\n }\n } else {\n obj[prop] = source[prop];\n }\n }\n }\n }\n \n return obj;\n };\n\n /**\n * Creates a new clone of the object, if deep is true references will also be cloned.\n * @method clone\n * @param {} obj\n * @param {bool} deep\n * @return {} obj cloned\n */\n Common.clone = function(obj, deep) {\n return Common.extend({}, deep, obj);\n };\n\n /**\n * Returns the list of keys for the given object.\n * @method keys\n * @param {} obj\n * @return {string[]} keys\n */\n Common.keys = function(obj) {\n if (Object.keys)\n return Object.keys(obj);\n\n // avoid hasOwnProperty for performance\n var keys = [];\n for (var key in obj)\n keys.push(key);\n return keys;\n };\n\n /**\n * Returns the list of values for the given object.\n * @method values\n * @param {} obj\n * @return {array} Array of the objects property values\n */\n Common.values = function(obj) {\n var values = [];\n \n if (Object.keys) {\n var keys = Object.keys(obj);\n for (var i = 0; i < keys.length; i++) {\n values.push(obj[keys[i]]);\n }\n return values;\n }\n \n // avoid hasOwnProperty for performance\n for (var key in obj)\n values.push(obj[key]);\n return values;\n };\n\n /**\n * Gets a value from `base` relative to the `path` string.\n * @method get\n * @param {} obj The base object\n * @param {string} path The path relative to `base`, e.g. 'Foo.Bar.baz'\n * @param {number} [begin] Path slice begin\n * @param {number} [end] Path slice end\n * @return {} The object at the given path\n */\n Common.get = function(obj, path, begin, end) {\n path = path.split('.').slice(begin, end);\n\n for (var i = 0; i < path.length; i += 1) {\n obj = obj[path[i]];\n }\n\n return obj;\n };\n\n /**\n * Sets a value on `base` relative to the given `path` string.\n * @method set\n * @param {} obj The base object\n * @param {string} path The path relative to `base`, e.g. 'Foo.Bar.baz'\n * @param {} val The value to set\n * @param {number} [begin] Path slice begin\n * @param {number} [end] Path slice end\n * @return {} Pass through `val` for chaining\n */\n Common.set = function(obj, path, val, begin, end) {\n var parts = path.split('.').slice(begin, end);\n Common.get(obj, path, 0, -1)[parts[parts.length - 1]] = val;\n return val;\n };\n\n /**\n * Shuffles the given array in-place.\n * The function uses a seeded random generator.\n * @method shuffle\n * @param {array} array\n * @return {array} array shuffled randomly\n */\n Common.shuffle = function(array) {\n for (var i = array.length - 1; i > 0; i--) {\n var j = Math.floor(Common.random() * (i + 1));\n var temp = array[i];\n array[i] = array[j];\n array[j] = temp;\n }\n return array;\n };\n\n /**\n * Randomly chooses a value from a list with equal probability.\n * The function uses a seeded random generator.\n * @method choose\n * @param {array} choices\n * @return {object} A random choice object from the array\n */\n Common.choose = function(choices) {\n return choices[Math.floor(Common.random() * choices.length)];\n };\n\n /**\n * Returns true if the object is a HTMLElement, otherwise false.\n * @method isElement\n * @param {object} obj\n * @return {boolean} True if the object is a HTMLElement, otherwise false\n */\n Common.isElement = function(obj) {\n if (typeof HTMLElement !== 'undefined') {\n return obj instanceof HTMLElement;\n }\n\n return !!(obj && obj.nodeType && obj.nodeName);\n };\n\n /**\n * Returns true if the object is an array.\n * @method isArray\n * @param {object} obj\n * @return {boolean} True if the object is an array, otherwise false\n */\n Common.isArray = function(obj) {\n return Object.prototype.toString.call(obj) === '[object Array]';\n };\n\n /**\n * Returns true if the object is a function.\n * @method isFunction\n * @param {object} obj\n * @return {boolean} True if the object is a function, otherwise false\n */\n Common.isFunction = function(obj) {\n return typeof obj === \"function\";\n };\n\n /**\n * Returns true if the object is a plain object.\n * @method isPlainObject\n * @param {object} obj\n * @return {boolean} True if the object is a plain object, otherwise false\n */\n Common.isPlainObject = function(obj) {\n return typeof obj === 'object' && obj.constructor === Object;\n };\n\n /**\n * Returns true if the object is a string.\n * @method isString\n * @param {object} obj\n * @return {boolean} True if the object is a string, otherwise false\n */\n Common.isString = function(obj) {\n return toString.call(obj) === '[object String]';\n };\n \n /**\n * Returns the given value clamped between a minimum and maximum value.\n * @method clamp\n * @param {number} value\n * @param {number} min\n * @param {number} max\n * @return {number} The value clamped between min and max inclusive\n */\n Common.clamp = function(value, min, max) {\n if (value < min)\n return min;\n if (value > max)\n return max;\n return value;\n };\n \n /**\n * Returns the sign of the given value.\n * @method sign\n * @param {number} value\n * @return {number} -1 if negative, +1 if 0 or positive\n */\n Common.sign = function(value) {\n return value < 0 ? -1 : 1;\n };\n \n /**\n * Returns the current timestamp since the time origin (e.g. from page load).\n * The result is in milliseconds and will use high-resolution timing if available.\n * @method now\n * @return {number} the current timestamp in milliseconds\n */\n Common.now = function() {\n if (typeof window !== 'undefined' && window.performance) {\n if (window.performance.now) {\n return window.performance.now();\n } else if (window.performance.webkitNow) {\n return window.performance.webkitNow();\n }\n }\n\n if (Date.now) {\n return Date.now();\n }\n\n return (new Date()) - Common._nowStartTime;\n };\n \n /**\n * Returns a random value between a minimum and a maximum value inclusive.\n * The function uses a seeded random generator.\n * @method random\n * @param {number} min\n * @param {number} max\n * @return {number} A random number between min and max inclusive\n */\n Common.random = function(min, max) {\n min = (typeof min !== \"undefined\") ? min : 0;\n max = (typeof max !== \"undefined\") ? max : 1;\n return min + _seededRandom() * (max - min);\n };\n\n var _seededRandom = function() {\n // https://en.wikipedia.org/wiki/Linear_congruential_generator\n Common._seed = (Common._seed * 9301 + 49297) % 233280;\n return Common._seed / 233280;\n };\n\n /**\n * Converts a CSS hex colour string into an integer.\n * @method colorToNumber\n * @param {string} colorString\n * @return {number} An integer representing the CSS hex string\n */\n Common.colorToNumber = function(colorString) {\n colorString = colorString.replace('#','');\n\n if (colorString.length == 3) {\n colorString = colorString.charAt(0) + colorString.charAt(0)\n + colorString.charAt(1) + colorString.charAt(1)\n + colorString.charAt(2) + colorString.charAt(2);\n }\n\n return parseInt(colorString, 16);\n };\n\n /**\n * The console logging level to use, where each level includes all levels above and excludes the levels below.\n * The default level is 'debug' which shows all console messages. \n *\n * Possible level values are:\n * - 0 = None\n * - 1 = Debug\n * - 2 = Info\n * - 3 = Warn\n * - 4 = Error\n * @property Common.logLevel\n * @type {Number}\n * @default 1\n */\n Common.logLevel = 1;\n\n /**\n * Shows a `console.log` message only if the current `Common.logLevel` allows it.\n * The message will be prefixed with 'matter-js' to make it easily identifiable.\n * @method log\n * @param ...objs {} The objects to log.\n */\n Common.log = function() {\n if (console && Common.logLevel > 0 && Common.logLevel <= 3) {\n console.log.apply(console, ['matter-js:'].concat(Array.prototype.slice.call(arguments)));\n }\n };\n\n /**\n * Shows a `console.info` message only if the current `Common.logLevel` allows it.\n * The message will be prefixed with 'matter-js' to make it easily identifiable.\n * @method info\n * @param ...objs {} The objects to log.\n */\n Common.info = function() {\n if (console && Common.logLevel > 0 && Common.logLevel <= 2) {\n console.info.apply(console, ['matter-js:'].concat(Array.prototype.slice.call(arguments)));\n }\n };\n\n /**\n * Shows a `console.warn` message only if the current `Common.logLevel` allows it.\n * The message will be prefixed with 'matter-js' to make it easily identifiable.\n * @method warn\n * @param ...objs {} The objects to log.\n */\n Common.warn = function() {\n if (console && Common.logLevel > 0 && Common.logLevel <= 3) {\n console.warn.apply(console, ['matter-js:'].concat(Array.prototype.slice.call(arguments)));\n }\n };\n\n /**\n * Uses `Common.warn` to log the given message one time only.\n * @method warnOnce\n * @param ...objs {} The objects to log.\n */\n Common.warnOnce = function() {\n var message = Array.prototype.slice.call(arguments).join(' ');\n\n if (!Common._warnedOnce[message]) {\n Common.warn(message);\n Common._warnedOnce[message] = true;\n }\n };\n\n /**\n * Shows a deprecated console warning when the function on the given object is called.\n * The target function will be replaced with a new function that first shows the warning\n * and then calls the original function.\n * @method deprecated\n * @param {object} obj The object or module\n * @param {string} name The property name of the function on obj\n * @param {string} warning The one-time message to show if the function is called\n */\n Common.deprecated = function(obj, prop, warning) {\n obj[prop] = Common.chain(function() {\n Common.warnOnce('🔅 deprecated 🔅', warning);\n }, obj[prop]);\n };\n\n /**\n * Returns the next unique sequential ID.\n * @method nextId\n * @return {Number} Unique sequential ID\n */\n Common.nextId = function() {\n return Common._nextId++;\n };\n\n /**\n * A cross browser compatible indexOf implementation.\n * @method indexOf\n * @param {array} haystack\n * @param {object} needle\n * @return {number} The position of needle in haystack, otherwise -1.\n */\n Common.indexOf = function(haystack, needle) {\n if (haystack.indexOf)\n return haystack.indexOf(needle);\n\n for (var i = 0; i < haystack.length; i++) {\n if (haystack[i] === needle)\n return i;\n }\n\n return -1;\n };\n\n /**\n * A cross browser compatible array map implementation.\n * @method map\n * @param {array} list\n * @param {function} func\n * @return {array} Values from list transformed by func.\n */\n Common.map = function(list, func) {\n if (list.map) {\n return list.map(func);\n }\n\n var mapped = [];\n\n for (var i = 0; i < list.length; i += 1) {\n mapped.push(func(list[i]));\n }\n\n return mapped;\n };\n\n /**\n * Takes a directed graph and returns the partially ordered set of vertices in topological order.\n * Circular dependencies are allowed.\n * @method topologicalSort\n * @param {object} graph\n * @return {array} Partially ordered set of vertices in topological order.\n */\n Common.topologicalSort = function(graph) {\n // https://github.com/mgechev/javascript-algorithms\n // Copyright (c) Minko Gechev (MIT license)\n // Modifications: tidy formatting and naming\n var result = [],\n visited = [],\n temp = [];\n\n for (var node in graph) {\n if (!visited[node] && !temp[node]) {\n Common._topologicalSort(node, visited, temp, graph, result);\n }\n }\n\n return result;\n };\n\n Common._topologicalSort = function(node, visited, temp, graph, result) {\n var neighbors = graph[node] || [];\n temp[node] = true;\n\n for (var i = 0; i < neighbors.length; i += 1) {\n var neighbor = neighbors[i];\n\n if (temp[neighbor]) {\n // skip circular dependencies\n continue;\n }\n\n if (!visited[neighbor]) {\n Common._topologicalSort(neighbor, visited, temp, graph, result);\n }\n }\n\n temp[node] = false;\n visited[node] = true;\n\n result.push(node);\n };\n\n /**\n * Takes _n_ functions as arguments and returns a new function that calls them in order.\n * The arguments applied when calling the new function will also be applied to every function passed.\n * The value of `this` refers to the last value returned in the chain that was not `undefined`.\n * Therefore if a passed function does not return a value, the previously returned value is maintained.\n * After all passed functions have been called the new function returns the last returned value (if any).\n * If any of the passed functions are a chain, then the chain will be flattened.\n * @method chain\n * @param ...funcs {function} The functions to chain.\n * @return {function} A new function that calls the passed functions in order.\n */\n Common.chain = function() {\n var funcs = [];\n\n for (var i = 0; i < arguments.length; i += 1) {\n var func = arguments[i];\n\n if (func._chained) {\n // flatten already chained functions\n funcs.push.apply(funcs, func._chained);\n } else {\n funcs.push(func);\n }\n }\n\n var chain = function() {\n // https://github.com/GoogleChrome/devtools-docs/issues/53#issuecomment-51941358\n var lastResult,\n args = new Array(arguments.length);\n\n for (var i = 0, l = arguments.length; i < l; i++) {\n args[i] = arguments[i];\n }\n\n for (i = 0; i < funcs.length; i += 1) {\n var result = funcs[i].apply(lastResult, args);\n\n if (typeof result !== 'undefined') {\n lastResult = result;\n }\n }\n\n return lastResult;\n };\n\n chain._chained = funcs;\n\n return chain;\n };\n\n /**\n * Chains a function to excute before the original function on the given `path` relative to `base`.\n * See also docs for `Common.chain`.\n * @method chainPathBefore\n * @param {} base The base object\n * @param {string} path The path relative to `base`\n * @param {function} func The function to chain before the original\n * @return {function} The chained function that replaced the original\n */\n Common.chainPathBefore = function(base, path, func) {\n return Common.set(base, path, Common.chain(\n func,\n Common.get(base, path)\n ));\n };\n\n /**\n * Chains a function to excute after the original function on the given `path` relative to `base`.\n * See also docs for `Common.chain`.\n * @method chainPathAfter\n * @param {} base The base object\n * @param {string} path The path relative to `base`\n * @param {function} func The function to chain after the original\n * @return {function} The chained function that replaced the original\n */\n Common.chainPathAfter = function(base, path, func) {\n return Common.set(base, path, Common.chain(\n Common.get(base, path),\n func\n ));\n };\n\n /**\n * Provide the [poly-decomp](https://github.com/schteppe/poly-decomp.js) library module to enable\n * concave vertex decomposition support when using `Bodies.fromVertices` e.g. `Common.setDecomp(require('poly-decomp'))`.\n * @method setDecomp\n * @param {} decomp The [poly-decomp](https://github.com/schteppe/poly-decomp.js) library module.\n */\n Common.setDecomp = function(decomp) {\n Common._decomp = decomp;\n };\n\n /**\n * Returns the [poly-decomp](https://github.com/schteppe/poly-decomp.js) library module provided through `Common.setDecomp`,\n * otherwise returns the global `decomp` if set.\n * @method getDecomp\n * @return {} The [poly-decomp](https://github.com/schteppe/poly-decomp.js) library module if provided.\n */\n Common.getDecomp = function() {\n // get user provided decomp if set\n var decomp = Common._decomp;\n\n try {\n // otherwise from window global\n if (!decomp && typeof window !== 'undefined') {\n decomp = window.decomp;\n }\n \n // otherwise from node global\n if (!decomp && typeof global !== 'undefined') {\n decomp = global.decomp;\n }\n } catch (e) {\n // decomp not available\n decomp = null;\n }\n\n return decomp;\n };\n})();\n\n\n/***/ }),\n/* 1 */\n/***/ (function(module, exports) {\n\n/**\n* The `Matter.Bounds` module contains methods for creating and manipulating axis-aligned bounding boxes (AABB).\n*\n* @class Bounds\n*/\n\nvar Bounds = {};\n\nmodule.exports = Bounds;\n\n(function() {\n\n /**\n * Creates a new axis-aligned bounding box (AABB) for the given vertices.\n * @method create\n * @param {vertices} vertices\n * @return {bounds} A new bounds object\n */\n Bounds.create = function(vertices) {\n var bounds = { \n min: { x: 0, y: 0 }, \n max: { x: 0, y: 0 }\n };\n\n if (vertices)\n Bounds.update(bounds, vertices);\n \n return bounds;\n };\n\n /**\n * Updates bounds using the given vertices and extends the bounds given a velocity.\n * @method update\n * @param {bounds} bounds\n * @param {vertices} vertices\n * @param {vector} velocity\n */\n Bounds.update = function(bounds, vertices, velocity) {\n bounds.min.x = Infinity;\n bounds.max.x = -Infinity;\n bounds.min.y = Infinity;\n bounds.max.y = -Infinity;\n\n for (var i = 0; i < vertices.length; i++) {\n var vertex = vertices[i];\n if (vertex.x > bounds.max.x) bounds.max.x = vertex.x;\n if (vertex.x < bounds.min.x) bounds.min.x = vertex.x;\n if (vertex.y > bounds.max.y) bounds.max.y = vertex.y;\n if (vertex.y < bounds.min.y) bounds.min.y = vertex.y;\n }\n \n if (velocity) {\n if (velocity.x > 0) {\n bounds.max.x += velocity.x;\n } else {\n bounds.min.x += velocity.x;\n }\n \n if (velocity.y > 0) {\n bounds.max.y += velocity.y;\n } else {\n bounds.min.y += velocity.y;\n }\n }\n };\n\n /**\n * Returns true if the bounds contains the given point.\n * @method contains\n * @param {bounds} bounds\n * @param {vector} point\n * @return {boolean} True if the bounds contain the point, otherwise false\n */\n Bounds.contains = function(bounds, point) {\n return point.x >= bounds.min.x && point.x <= bounds.max.x \n && point.y >= bounds.min.y && point.y <= bounds.max.y;\n };\n\n /**\n * Returns true if the two bounds intersect.\n * @method overlaps\n * @param {bounds} boundsA\n * @param {bounds} boundsB\n * @return {boolean} True if the bounds overlap, otherwise false\n */\n Bounds.overlaps = function(boundsA, boundsB) {\n return (boundsA.min.x <= boundsB.max.x && boundsA.max.x >= boundsB.min.x\n && boundsA.max.y >= boundsB.min.y && boundsA.min.y <= boundsB.max.y);\n };\n\n /**\n * Translates the bounds by the given vector.\n * @method translate\n * @param {bounds} bounds\n * @param {vector} vector\n */\n Bounds.translate = function(bounds, vector) {\n bounds.min.x += vector.x;\n bounds.max.x += vector.x;\n bounds.min.y += vector.y;\n bounds.max.y += vector.y;\n };\n\n /**\n * Shifts the bounds to the given position.\n * @method shift\n * @param {bounds} bounds\n * @param {vector} position\n */\n Bounds.shift = function(bounds, position) {\n var deltaX = bounds.max.x - bounds.min.x,\n deltaY = bounds.max.y - bounds.min.y;\n \n bounds.min.x = position.x;\n bounds.max.x = position.x + deltaX;\n bounds.min.y = position.y;\n bounds.max.y = position.y + deltaY;\n };\n \n})();\n\n\n/***/ }),\n/* 2 */\n/***/ (function(module, exports) {\n\n/**\n* The `Matter.Vector` module contains methods for creating and manipulating vectors.\n* Vectors are the basis of all the geometry related operations in the engine.\n* A `Matter.Vector` object is of the form `{ x: 0, y: 0 }`.\n*\n* See the included usage [examples](https://github.com/liabru/matter-js/tree/master/examples).\n*\n* @class Vector\n*/\n\n// TODO: consider params for reusing vector objects\n\nvar Vector = {};\n\nmodule.exports = Vector;\n\n(function() {\n\n /**\n * Creates a new vector.\n * @method create\n * @param {number} x\n * @param {number} y\n * @return {vector} A new vector\n */\n Vector.create = function(x, y) {\n return { x: x || 0, y: y || 0 };\n };\n\n /**\n * Returns a new vector with `x` and `y` copied from the given `vector`.\n * @method clone\n * @param {vector} vector\n * @return {vector} A new cloned vector\n */\n Vector.clone = function(vector) {\n return { x: vector.x, y: vector.y };\n };\n\n /**\n * Returns the magnitude (length) of a vector.\n * @method magnitude\n * @param {vector} vector\n * @return {number} The magnitude of the vector\n */\n Vector.magnitude = function(vector) {\n return Math.sqrt((vector.x * vector.x) + (vector.y * vector.y));\n };\n\n /**\n * Returns the magnitude (length) of a vector (therefore saving a `sqrt` operation).\n * @method magnitudeSquared\n * @param {vector} vector\n * @return {number} The squared magnitude of the vector\n */\n Vector.magnitudeSquared = function(vector) {\n return (vector.x * vector.x) + (vector.y * vector.y);\n };\n\n /**\n * Rotates the vector about (0, 0) by specified angle.\n * @method rotate\n * @param {vector} vector\n * @param {number} angle\n * @param {vector} [output]\n * @return {vector} The vector rotated about (0, 0)\n */\n Vector.rotate = function(vector, angle, output) {\n var cos = Math.cos(angle), sin = Math.sin(angle);\n if (!output) output = {};\n var x = vector.x * cos - vector.y * sin;\n output.y = vector.x * sin + vector.y * cos;\n output.x = x;\n return output;\n };\n\n /**\n * Rotates the vector about a specified point by specified angle.\n * @method rotateAbout\n * @param {vector} vector\n * @param {number} angle\n * @param {vector} point\n * @param {vector} [output]\n * @return {vector} A new vector rotated about the point\n */\n Vector.rotateAbout = function(vector, angle, point, output) {\n var cos = Math.cos(angle), sin = Math.sin(angle);\n if (!output) output = {};\n var x = point.x + ((vector.x - point.x) * cos - (vector.y - point.y) * sin);\n output.y = point.y + ((vector.x - point.x) * sin + (vector.y - point.y) * cos);\n output.x = x;\n return output;\n };\n\n /**\n * Normalises a vector (such that its magnitude is `1`).\n * @method normalise\n * @param {vector} vector\n * @return {vector} A new vector normalised\n */\n Vector.normalise = function(vector) {\n var magnitude = Vector.magnitude(vector);\n if (magnitude === 0)\n return { x: 0, y: 0 };\n return { x: vector.x / magnitude, y: vector.y / magnitude };\n };\n\n /**\n * Returns the dot-product of two vectors.\n * @method dot\n * @param {vector} vectorA\n * @param {vector} vectorB\n * @return {number} The dot product of the two vectors\n */\n Vector.dot = function(vectorA, vectorB) {\n return (vectorA.x * vectorB.x) + (vectorA.y * vectorB.y);\n };\n\n /**\n * Returns the cross-product of two vectors.\n * @method cross\n * @param {vector} vectorA\n * @param {vector} vectorB\n * @return {number} The cross product of the two vectors\n */\n Vector.cross = function(vectorA, vectorB) {\n return (vectorA.x * vectorB.y) - (vectorA.y * vectorB.x);\n };\n\n /**\n * Returns the cross-product of three vectors.\n * @method cross3\n * @param {vector} vectorA\n * @param {vector} vectorB\n * @param {vector} vectorC\n * @return {number} The cross product of the three vectors\n */\n Vector.cross3 = function(vectorA, vectorB, vectorC) {\n return (vectorB.x - vectorA.x) * (vectorC.y - vectorA.y) - (vectorB.y - vectorA.y) * (vectorC.x - vectorA.x);\n };\n\n /**\n * Adds the two vectors.\n * @method add\n * @param {vector} vectorA\n * @param {vector} vectorB\n * @param {vector} [output]\n * @return {vector} A new vector of vectorA and vectorB added\n */\n Vector.add = function(vectorA, vectorB, output) {\n if (!output) output = {};\n output.x = vectorA.x + vectorB.x;\n output.y = vectorA.y + vectorB.y;\n return output;\n };\n\n /**\n * Subtracts the two vectors.\n * @method sub\n * @param {vector} vectorA\n * @param {vector} vectorB\n * @param {vector} [output]\n * @return {vector} A new vector of vectorA and vectorB subtracted\n */\n Vector.sub = function(vectorA, vectorB, output) {\n if (!output) output = {};\n output.x = vectorA.x - vectorB.x;\n output.y = vectorA.y - vectorB.y;\n return output;\n };\n\n /**\n * Multiplies a vector and a scalar.\n * @method mult\n * @param {vector} vector\n * @param {number} scalar\n * @return {vector} A new vector multiplied by scalar\n */\n Vector.mult = function(vector, scalar) {\n return { x: vector.x * scalar, y: vector.y * scalar };\n };\n\n /**\n * Divides a vector and a scalar.\n * @method div\n * @param {vector} vector\n * @param {number} scalar\n * @return {vector} A new vector divided by scalar\n */\n Vector.div = function(vector, scalar) {\n return { x: vector.x / scalar, y: vector.y / scalar };\n };\n\n /**\n * Returns the perpendicular vector. Set `negate` to true for the perpendicular in the opposite direction.\n * @method perp\n * @param {vector} vector\n * @param {bool} [negate=false]\n * @return {vector} The perpendicular vector\n */\n Vector.perp = function(vector, negate) {\n negate = negate === true ? -1 : 1;\n return { x: negate * -vector.y, y: negate * vector.x };\n };\n\n /**\n * Negates both components of a vector such that it points in the opposite direction.\n * @method neg\n * @param {vector} vector\n * @return {vector} The negated vector\n */\n Vector.neg = function(vector) {\n return { x: -vector.x, y: -vector.y };\n };\n\n /**\n * Returns the angle between the vector `vectorB - vectorA` and the x-axis in radians.\n * @method angle\n * @param {vector} vectorA\n * @param {vector} vectorB\n * @return {number} The angle in radians\n */\n Vector.angle = function(vectorA, vectorB) {\n return Math.atan2(vectorB.y - vectorA.y, vectorB.x - vectorA.x);\n };\n\n /**\n * Temporary vector pool (not thread-safe).\n * @property _temp\n * @type {vector[]}\n * @private\n */\n Vector._temp = [\n Vector.create(), Vector.create(), \n Vector.create(), Vector.create(), \n Vector.create(), Vector.create()\n ];\n\n})();\n\n/***/ }),\n/* 3 */\n/***/ (function(module, exports, __webpack_require__) {\n\n/**\n* The `Matter.Vertices` module contains methods for creating and manipulating sets of vertices.\n* A set of vertices is an array of `Matter.Vector` with additional indexing properties inserted by `Vertices.create`.\n* A `Matter.Body` maintains a set of vertices to represent the shape of the object (its convex hull).\n*\n* See the included usage [examples](https://github.com/liabru/matter-js/tree/master/examples).\n*\n* @class Vertices\n*/\n\nvar Vertices = {};\n\nmodule.exports = Vertices;\n\nvar Vector = __webpack_require__(2);\nvar Common = __webpack_require__(0);\n\n(function() {\n\n /**\n * Creates a new set of `Matter.Body` compatible vertices.\n * The `points` argument accepts an array of `Matter.Vector` points orientated around the origin `(0, 0)`, for example:\n *\n * [{ x: 0, y: 0 }, { x: 25, y: 50 }, { x: 50, y: 0 }]\n *\n * The `Vertices.create` method returns a new array of vertices, which are similar to Matter.Vector objects,\n * but with some additional references required for efficient collision detection routines.\n *\n * Vertices must be specified in clockwise order.\n *\n * Note that the `body` argument is not optional, a `Matter.Body` reference must be provided.\n *\n * @method create\n * @param {vector[]} points\n * @param {body} body\n */\n Vertices.create = function(points, body) {\n var vertices = [];\n\n for (var i = 0; i < points.length; i++) {\n var point = points[i],\n vertex = {\n x: point.x,\n y: point.y,\n index: i,\n body: body,\n isInternal: false\n };\n\n vertices.push(vertex);\n }\n\n return vertices;\n };\n\n /**\n * Parses a string containing ordered x y pairs separated by spaces (and optionally commas), \n * into a `Matter.Vertices` object for the given `Matter.Body`.\n * For parsing SVG paths, see `Svg.pathToVertices`.\n * @method fromPath\n * @param {string} path\n * @param {body} body\n * @return {vertices} vertices\n */\n Vertices.fromPath = function(path, body) {\n var pathPattern = /L?\\s*([-\\d.e]+)[\\s,]*([-\\d.e]+)*/ig,\n points = [];\n\n path.replace(pathPattern, function(match, x, y) {\n points.push({ x: parseFloat(x), y: parseFloat(y) });\n });\n\n return Vertices.create(points, body);\n };\n\n /**\n * Returns the centre (centroid) of the set of vertices.\n * @method centre\n * @param {vertices} vertices\n * @return {vector} The centre point\n */\n Vertices.centre = function(vertices) {\n var area = Vertices.area(vertices, true),\n centre = { x: 0, y: 0 },\n cross,\n temp,\n j;\n\n for (var i = 0; i < vertices.length; i++) {\n j = (i + 1) % vertices.length;\n cross = Vector.cross(vertices[i], vertices[j]);\n temp = Vector.mult(Vector.add(vertices[i], vertices[j]), cross);\n centre = Vector.add(centre, temp);\n }\n\n return Vector.div(centre, 6 * area);\n };\n\n /**\n * Returns the average (mean) of the set of vertices.\n * @method mean\n * @param {vertices} vertices\n * @return {vector} The average point\n */\n Vertices.mean = function(vertices) {\n var average = { x: 0, y: 0 };\n\n for (var i = 0; i < vertices.length; i++) {\n average.x += vertices[i].x;\n average.y += vertices[i].y;\n }\n\n return Vector.div(average, vertices.length);\n };\n\n /**\n * Returns the area of the set of vertices.\n * @method area\n * @param {vertices} vertices\n * @param {bool} signed\n * @return {number} The area\n */\n Vertices.area = function(vertices, signed) {\n var area = 0,\n j = vertices.length - 1;\n\n for (var i = 0; i < vertices.length; i++) {\n area += (vertices[j].x - vertices[i].x) * (vertices[j].y + vertices[i].y);\n j = i;\n }\n\n if (signed)\n return area / 2;\n\n return Math.abs(area) / 2;\n };\n\n /**\n * Returns the moment of inertia (second moment of area) of the set of vertices given the total mass.\n * @method inertia\n * @param {vertices} vertices\n * @param {number} mass\n * @return {number} The polygon's moment of inertia\n */\n Vertices.inertia = function(vertices, mass) {\n var numerator = 0,\n denominator = 0,\n v = vertices,\n cross,\n j;\n\n // find the polygon's moment of inertia, using second moment of area\n // from equations at http://www.physicsforums.com/showthread.php?t=25293\n for (var n = 0; n < v.length; n++) {\n j = (n + 1) % v.length;\n cross = Math.abs(Vector.cross(v[j], v[n]));\n numerator += cross * (Vector.dot(v[j], v[j]) + Vector.dot(v[j], v[n]) + Vector.dot(v[n], v[n]));\n denominator += cross;\n }\n\n return (mass / 6) * (numerator / denominator);\n };\n\n /**\n * Translates the set of vertices in-place.\n * @method translate\n * @param {vertices} vertices\n * @param {vector} vector\n * @param {number} scalar\n */\n Vertices.translate = function(vertices, vector, scalar) {\n scalar = typeof scalar !== 'undefined' ? scalar : 1;\n\n var verticesLength = vertices.length,\n translateX = vector.x * scalar,\n translateY = vector.y * scalar,\n i;\n \n for (i = 0; i < verticesLength; i++) {\n vertices[i].x += translateX;\n vertices[i].y += translateY;\n }\n\n return vertices;\n };\n\n /**\n * Rotates the set of vertices in-place.\n * @method rotate\n * @param {vertices} vertices\n * @param {number} angle\n * @param {vector} point\n */\n Vertices.rotate = function(vertices, angle, point) {\n if (angle === 0)\n return;\n\n var cos = Math.cos(angle),\n sin = Math.sin(angle),\n pointX = point.x,\n pointY = point.y,\n verticesLength = vertices.length,\n vertex,\n dx,\n dy,\n i;\n\n for (i = 0; i < verticesLength; i++) {\n vertex = vertices[i];\n dx = vertex.x - pointX;\n dy = vertex.y - pointY;\n vertex.x = pointX + (dx * cos - dy * sin);\n vertex.y = pointY + (dx * sin + dy * cos);\n }\n\n return vertices;\n };\n\n /**\n * Returns `true` if the `point` is inside the set of `vertices`.\n * @method contains\n * @param {vertices} vertices\n * @param {vector} point\n * @return {boolean} True if the vertices contains point, otherwise false\n */\n Vertices.contains = function(vertices, point) {\n var pointX = point.x,\n pointY = point.y,\n verticesLength = vertices.length,\n vertex = vertices[verticesLength - 1],\n nextVertex;\n\n for (var i = 0; i < verticesLength; i++) {\n nextVertex = vertices[i];\n\n if ((pointX - vertex.x) * (nextVertex.y - vertex.y) \n + (pointY - vertex.y) * (vertex.x - nextVertex.x) > 0) {\n return false;\n }\n\n vertex = nextVertex;\n }\n\n return true;\n };\n\n /**\n * Scales the vertices from a point (default is centre) in-place.\n * @method scale\n * @param {vertices} vertices\n * @param {number} scaleX\n * @param {number} scaleY\n * @param {vector} point\n */\n Vertices.scale = function(vertices, scaleX, scaleY, point) {\n if (scaleX === 1 && scaleY === 1)\n return vertices;\n\n point = point || Vertices.centre(vertices);\n\n var vertex,\n delta;\n\n for (var i = 0; i < vertices.length; i++) {\n vertex = vertices[i];\n delta = Vector.sub(vertex, point);\n vertices[i].x = point.x + delta.x * scaleX;\n vertices[i].y = point.y + delta.y * scaleY;\n }\n\n return vertices;\n };\n\n /**\n * Chamfers a set of vertices by giving them rounded corners, returns a new set of vertices.\n * The radius parameter is a single number or an array to specify the radius for each vertex.\n * @method chamfer\n * @param {vertices} vertices\n * @param {number[]} radius\n * @param {number} quality\n * @param {number} qualityMin\n * @param {number} qualityMax\n */\n Vertices.chamfer = function(vertices, radius, quality, qualityMin, qualityMax) {\n if (typeof radius === 'number') {\n radius = [radius];\n } else {\n radius = radius || [8];\n }\n\n // quality defaults to -1, which is auto\n quality = (typeof quality !== 'undefined') ? quality : -1;\n qualityMin = qualityMin || 2;\n qualityMax = qualityMax || 14;\n\n var newVertices = [];\n\n for (var i = 0; i < vertices.length; i++) {\n var prevVertex = vertices[i - 1 >= 0 ? i - 1 : vertices.length - 1],\n vertex = vertices[i],\n nextVertex = vertices[(i + 1) % vertices.length],\n currentRadius = radius[i < radius.length ? i : radius.length - 1];\n\n if (currentRadius === 0) {\n newVertices.push(vertex);\n continue;\n }\n\n var prevNormal = Vector.normalise({ \n x: vertex.y - prevVertex.y, \n y: prevVertex.x - vertex.x\n });\n\n var nextNormal = Vector.normalise({ \n x: nextVertex.y - vertex.y, \n y: vertex.x - nextVertex.x\n });\n\n var diagonalRadius = Math.sqrt(2 * Math.pow(currentRadius, 2)),\n radiusVector = Vector.mult(Common.clone(prevNormal), currentRadius),\n midNormal = Vector.normalise(Vector.mult(Vector.add(prevNormal, nextNormal), 0.5)),\n scaledVertex = Vector.sub(vertex, Vector.mult(midNormal, diagonalRadius));\n\n var precision = quality;\n\n if (quality === -1) {\n // automatically decide precision\n precision = Math.pow(currentRadius, 0.32) * 1.75;\n }\n\n precision = Common.clamp(precision, qualityMin, qualityMax);\n\n // use an even value for precision, more likely to reduce axes by using symmetry\n if (precision % 2 === 1)\n precision += 1;\n\n var alpha = Math.acos(Vector.dot(prevNormal, nextNormal)),\n theta = alpha / precision;\n\n for (var j = 0; j < precision; j++) {\n newVertices.push(Vector.add(Vector.rotate(radiusVector, theta * j), scaledVertex));\n }\n }\n\n return newVertices;\n };\n\n /**\n * Sorts the input vertices into clockwise order in place.\n * @method clockwiseSort\n * @param {vertices} vertices\n * @return {vertices} vertices\n */\n Vertices.clockwiseSort = function(vertices) {\n var centre = Vertices.mean(vertices);\n\n vertices.sort(function(vertexA, vertexB) {\n return Vector.angle(centre, vertexA) - Vector.angle(centre, vertexB);\n });\n\n return vertices;\n };\n\n /**\n * Returns true if the vertices form a convex shape (vertices must be in clockwise order).\n * @method isConvex\n * @param {vertices} vertices\n * @return {bool} `true` if the `vertices` are convex, `false` if not (or `null` if not computable).\n */\n Vertices.isConvex = function(vertices) {\n // http://paulbourke.net/geometry/polygonmesh/\n // Copyright (c) Paul Bourke (use permitted)\n\n var flag = 0,\n n = vertices.length,\n i,\n j,\n k,\n z;\n\n if (n < 3)\n return null;\n\n for (i = 0; i < n; i++) {\n j = (i + 1) % n;\n k = (i + 2) % n;\n z = (vertices[j].x - vertices[i].x) * (vertices[k].y - vertices[j].y);\n z -= (vertices[j].y - vertices[i].y) * (vertices[k].x - vertices[j].x);\n\n if (z < 0) {\n flag |= 1;\n } else if (z > 0) {\n flag |= 2;\n }\n\n if (flag === 3) {\n return false;\n }\n }\n\n if (flag !== 0){\n return true;\n } else {\n return null;\n }\n };\n\n /**\n * Returns the convex hull of the input vertices as a new array of points.\n * @method hull\n * @param {vertices} vertices\n * @return [vertex] vertices\n */\n Vertices.hull = function(vertices) {\n // http://geomalgorithms.com/a10-_hull-1.html\n\n var upper = [],\n lower = [], \n vertex,\n i;\n\n // sort vertices on x-axis (y-axis for ties)\n vertices = vertices.slice(0);\n vertices.sort(function(vertexA, vertexB) {\n var dx = vertexA.x - vertexB.x;\n return dx !== 0 ? dx : vertexA.y - vertexB.y;\n });\n\n // build lower hull\n for (i = 0; i < vertices.length; i += 1) {\n vertex = vertices[i];\n\n while (lower.length >= 2 \n && Vector.cross3(lower[lower.length - 2], lower[lower.length - 1], vertex) <= 0) {\n lower.pop();\n }\n\n lower.push(vertex);\n }\n\n // build upper hull\n for (i = vertices.length - 1; i >= 0; i -= 1) {\n vertex = vertices[i];\n\n while (upper.length >= 2 \n && Vector.cross3(upper[upper.length - 2], upper[upper.length - 1], vertex) <= 0) {\n upper.pop();\n }\n\n upper.push(vertex);\n }\n\n // concatenation of the lower and upper hulls gives the convex hull\n // omit last points because they are repeated at the beginning of the other list\n upper.pop();\n lower.pop();\n\n return upper.concat(lower);\n };\n\n})();\n\n\n/***/ }),\n/* 4 */\n/***/ (function(module, exports, __webpack_require__) {\n\n/**\n* The `Matter.Events` module contains methods to fire and listen to events on other objects.\n*\n* See the included usage [examples](https://github.com/liabru/matter-js/tree/master/examples).\n*\n* @class Events\n*/\n\nvar Events = {};\n\nmodule.exports = Events;\n\nvar Common = __webpack_require__(0);\n\n(function() {\n\n /**\n * Subscribes a callback function to the given object's `eventName`.\n * @method on\n * @param {} object\n * @param {string} eventNames\n * @param {function} callback\n */\n Events.on = function(object, eventNames, callback) {\n var names = eventNames.split(' '),\n name;\n\n for (var i = 0; i < names.length; i++) {\n name = names[i];\n object.events = object.events || {};\n object.events[name] = object.events[name] || [];\n object.events[name].push(callback);\n }\n\n return callback;\n };\n\n /**\n * Removes the given event callback. If no callback, clears all callbacks in `eventNames`. If no `eventNames`, clears all events.\n * @method off\n * @param {} object\n * @param {string} eventNames\n * @param {function} callback\n */\n Events.off = function(object, eventNames, callback) {\n if (!eventNames) {\n object.events = {};\n return;\n }\n\n // handle Events.off(object, callback)\n if (typeof eventNames === 'function') {\n callback = eventNames;\n eventNames = Common.keys(object.events).join(' ');\n }\n\n var names = eventNames.split(' ');\n\n for (var i = 0; i < names.length; i++) {\n var callbacks = object.events[names[i]],\n newCallbacks = [];\n\n if (callback && callbacks) {\n for (var j = 0; j < callbacks.length; j++) {\n if (callbacks[j] !== callback)\n newCallbacks.push(callbacks[j]);\n }\n }\n\n object.events[names[i]] = newCallbacks;\n }\n };\n\n /**\n * Fires all the callbacks subscribed to the given object's `eventName`, in the order they subscribed, if any.\n * @method trigger\n * @param {} object\n * @param {string} eventNames\n * @param {} event\n */\n Events.trigger = function(object, eventNames, event) {\n var names,\n name,\n callbacks,\n eventClone;\n\n var events = object.events;\n \n if (events && Common.keys(events).length > 0) {\n if (!event)\n event = {};\n\n names = eventNames.split(' ');\n\n for (var i = 0; i < names.length; i++) {\n name = names[i];\n callbacks = events[name];\n\n if (callbacks) {\n eventClone = Common.clone(event, false);\n eventClone.name = name;\n eventClone.source = object;\n\n for (var j = 0; j < callbacks.length; j++) {\n callbacks[j].apply(object, [eventClone]);\n }\n }\n }\n }\n };\n\n})();\n\n\n/***/ }),\n/* 5 */\n/***/ (function(module, exports, __webpack_require__) {\n\n/**\n* A composite is a collection of `Matter.Body`, `Matter.Constraint` and other `Matter.Composite` objects.\n*\n* They are a container that can represent complex objects made of multiple parts, even if they are not physically connected.\n* A composite could contain anything from a single body all the way up to a whole world.\n* \n* When making any changes to composites, use the included functions rather than changing their properties directly.\n*\n* See the included usage [examples](https://github.com/liabru/matter-js/tree/master/examples).\n*\n* @class Composite\n*/\n\nvar Composite = {};\n\nmodule.exports = Composite;\n\nvar Events = __webpack_require__(4);\nvar Common = __webpack_require__(0);\nvar Bounds = __webpack_require__(1);\nvar Body = __webpack_require__(6);\n\n(function() {\n\n /**\n * Creates a new composite. The options parameter is an object that specifies any properties you wish to override the defaults.\n * See the properites section below for detailed information on what you can pass via the `options` object.\n * @method create\n * @param {} [options]\n * @return {composite} A new composite\n */\n Composite.create = function(options) {\n return Common.extend({ \n id: Common.nextId(),\n type: 'composite',\n parent: null,\n isModified: false,\n bodies: [], \n constraints: [], \n composites: [],\n label: 'Composite',\n plugin: {},\n cache: {\n allBodies: null,\n allConstraints: null,\n allComposites: null\n }\n }, options);\n };\n\n /**\n * Sets the composite's `isModified` flag. \n * If `updateParents` is true, all parents will be set (default: false).\n * If `updateChildren` is true, all children will be set (default: false).\n * @private\n * @method setModified\n * @param {composite} composite\n * @param {boolean} isModified\n * @param {boolean} [updateParents=false]\n * @param {boolean} [updateChildren=false]\n */\n Composite.setModified = function(composite, isModified, updateParents, updateChildren) {\n composite.isModified = isModified;\n\n if (isModified && composite.cache) {\n composite.cache.allBodies = null;\n composite.cache.allConstraints = null;\n composite.cache.allComposites = null;\n }\n\n if (updateParents && composite.parent) {\n Composite.setModified(composite.parent, isModified, updateParents, updateChildren);\n }\n\n if (updateChildren) {\n for (var i = 0; i < composite.composites.length; i++) {\n var childComposite = composite.composites[i];\n Composite.setModified(childComposite, isModified, updateParents, updateChildren);\n }\n }\n };\n\n /**\n * Generic single or multi-add function. Adds a single or an array of body(s), constraint(s) or composite(s) to the given composite.\n * Triggers `beforeAdd` and `afterAdd` events on the `composite`.\n * @method add\n * @param {composite} composite\n * @param {object|array} object A single or an array of body(s), constraint(s) or composite(s)\n * @return {composite} The original composite with the objects added\n */\n Composite.add = function(composite, object) {\n var objects = [].concat(object);\n\n Events.trigger(composite, 'beforeAdd', { object: object });\n\n for (var i = 0; i < objects.length; i++) {\n var obj = objects[i];\n\n switch (obj.type) {\n\n case 'body':\n // skip adding compound parts\n if (obj.parent !== obj) {\n Common.warn('Composite.add: skipped adding a compound body part (you must add its parent instead)');\n break;\n }\n\n Composite.addBody(composite, obj);\n break;\n case 'constraint':\n Composite.addConstraint(composite, obj);\n break;\n case 'composite':\n Composite.addComposite(composite, obj);\n break;\n case 'mouseConstraint':\n Composite.addConstraint(composite, obj.constraint);\n break;\n\n }\n }\n\n Events.trigger(composite, 'afterAdd', { object: object });\n\n return composite;\n };\n\n /**\n * Generic remove function. Removes one or many body(s), constraint(s) or a composite(s) to the given composite.\n * Optionally searching its children recursively.\n * Triggers `beforeRemove` and `afterRemove` events on the `composite`.\n * @method remove\n * @param {composite} composite\n * @param {object|array} object\n * @param {boolean} [deep=false]\n * @return {composite} The original composite with the objects removed\n */\n Composite.remove = function(composite, object, deep) {\n var objects = [].concat(object);\n\n Events.trigger(composite, 'beforeRemove', { object: object });\n\n for (var i = 0; i < objects.length; i++) {\n var obj = objects[i];\n\n switch (obj.type) {\n\n case 'body':\n Composite.removeBody(composite, obj, deep);\n break;\n case 'constraint':\n Composite.removeConstraint(composite, obj, deep);\n break;\n case 'composite':\n Composite.removeComposite(composite, obj, deep);\n break;\n case 'mouseConstraint':\n Composite.removeConstraint(composite, obj.constraint);\n break;\n\n }\n }\n\n Events.trigger(composite, 'afterRemove', { object: object });\n\n return composite;\n };\n\n /**\n * Adds a composite to the given composite.\n * @private\n * @method addComposite\n * @param {composite} compositeA\n * @param {composite} compositeB\n * @return {composite} The original compositeA with the objects from compositeB added\n */\n Composite.addComposite = function(compositeA, compositeB) {\n compositeA.composites.push(compositeB);\n compositeB.parent = compositeA;\n Composite.setModified(compositeA, true, true, false);\n return compositeA;\n };\n\n /**\n * Removes a composite from the given composite, and optionally searching its children recursively.\n * @private\n * @method removeComposite\n * @param {composite} compositeA\n * @param {composite} compositeB\n * @param {boolean} [deep=false]\n * @return {composite} The original compositeA with the composite removed\n */\n Composite.removeComposite = function(compositeA, compositeB, deep) {\n var position = Common.indexOf(compositeA.composites, compositeB);\n if (position !== -1) {\n Composite.removeCompositeAt(compositeA, position);\n }\n\n if (deep) {\n for (var i = 0; i < compositeA.composites.length; i++){\n Composite.removeComposite(compositeA.composites[i], compositeB, true);\n }\n }\n\n return compositeA;\n };\n\n /**\n * Removes a composite from the given composite.\n * @private\n * @method removeCompositeAt\n * @param {composite} composite\n * @param {number} position\n * @return {composite} The original composite with the composite removed\n */\n Composite.removeCompositeAt = function(composite, position) {\n composite.composites.splice(position, 1);\n Composite.setModified(composite, true, true, false);\n return composite;\n };\n\n /**\n * Adds a body to the given composite.\n * @private\n * @method addBody\n * @param {composite} composite\n * @param {body} body\n * @return {composite} The original composite with the body added\n */\n Composite.addBody = function(composite, body) {\n composite.bodies.push(body);\n Composite.setModified(composite, true, true, false);\n return composite;\n };\n\n /**\n * Removes a body from the given composite, and optionally searching its children recursively.\n * @private\n * @method removeBody\n * @param {composite} composite\n * @param {body} body\n * @param {boolean} [deep=false]\n * @return {composite} The original composite with the body removed\n */\n Composite.removeBody = function(composite, body, deep) {\n var position = Common.indexOf(composite.bodies, body);\n if (position !== -1) {\n Composite.removeBodyAt(composite, position);\n }\n\n if (deep) {\n for (var i = 0; i < composite.composites.length; i++){\n Composite.removeBody(composite.composites[i], body, true);\n }\n }\n\n return composite;\n };\n\n /**\n * Removes a body from the given composite.\n * @private\n * @method removeBodyAt\n * @param {composite} composite\n * @param {number} position\n * @return {composite} The original composite with the body removed\n */\n Composite.removeBodyAt = function(composite, position) {\n composite.bodies.splice(position, 1);\n Composite.setModified(composite, true, true, false);\n return composite;\n };\n\n /**\n * Adds a constraint to the given composite.\n * @private\n * @method addConstraint\n * @param {composite} composite\n * @param {constraint} constraint\n * @return {composite} The original composite with the constraint added\n */\n Composite.addConstraint = function(composite, constraint) {\n composite.constraints.push(constraint);\n Composite.setModified(composite, true, true, false);\n return composite;\n };\n\n /**\n * Removes a constraint from the given composite, and optionally searching its children recursively.\n * @private\n * @method removeConstraint\n * @param {composite} composite\n * @param {constraint} constraint\n * @param {boolean} [deep=false]\n * @return {composite} The original composite with the constraint removed\n */\n Composite.removeConstraint = function(composite, constraint, deep) {\n var position = Common.indexOf(composite.constraints, constraint);\n if (position !== -1) {\n Composite.removeConstraintAt(composite, position);\n }\n\n if (deep) {\n for (var i = 0; i < composite.composites.length; i++){\n Composite.removeConstraint(composite.composites[i], constraint, true);\n }\n }\n\n return composite;\n };\n\n /**\n * Removes a body from the given composite.\n * @private\n * @method removeConstraintAt\n * @param {composite} composite\n * @param {number} position\n * @return {composite} The original composite with the constraint removed\n */\n Composite.removeConstraintAt = function(composite, position) {\n composite.constraints.splice(position, 1);\n Composite.setModified(composite, true, true, false);\n return composite;\n };\n\n /**\n * Removes all bodies, constraints and composites from the given composite.\n * Optionally clearing its children recursively.\n * @method clear\n * @param {composite} composite\n * @param {boolean} keepStatic\n * @param {boolean} [deep=false]\n */\n Composite.clear = function(composite, keepStatic, deep) {\n if (deep) {\n for (var i = 0; i < composite.composites.length; i++){\n Composite.clear(composite.composites[i], keepStatic, true);\n }\n }\n \n if (keepStatic) {\n composite.bodies = composite.bodies.filter(function(body) { return body.isStatic; });\n } else {\n composite.bodies.length = 0;\n }\n\n composite.constraints.length = 0;\n composite.composites.length = 0;\n\n Composite.setModified(composite, true, true, false);\n\n return composite;\n };\n\n /**\n * Returns all bodies in the given composite, including all bodies in its children, recursively.\n * @method allBodies\n * @param {composite} composite\n * @return {body[]} All the bodies\n */\n Composite.allBodies = function(composite) {\n if (composite.cache && composite.cache.allBodies) {\n return composite.cache.allBodies;\n }\n\n var bodies = [].concat(composite.bodies);\n\n for (var i = 0; i < composite.composites.length; i++)\n bodies = bodies.concat(Composite.allBodies(composite.composites[i]));\n\n if (composite.cache) {\n composite.cache.allBodies = bodies;\n }\n\n return bodies;\n };\n\n /**\n * Returns all constraints in the given composite, including all constraints in its children, recursively.\n * @method allConstraints\n * @param {composite} composite\n * @return {constraint[]} All the constraints\n */\n Composite.allConstraints = function(composite) {\n if (composite.cache && composite.cache.allConstraints) {\n return composite.cache.allConstraints;\n }\n\n var constraints = [].concat(composite.constraints);\n\n for (var i = 0; i < composite.composites.length; i++)\n constraints = constraints.concat(Composite.allConstraints(composite.composites[i]));\n\n if (composite.cache) {\n composite.cache.allConstraints = constraints;\n }\n\n return constraints;\n };\n\n /**\n * Returns all composites in the given composite, including all composites in its children, recursively.\n * @method allComposites\n * @param {composite} composite\n * @return {composite[]} All the composites\n */\n Composite.allComposites = function(composite) {\n if (composite.cache && composite.cache.allComposites) {\n return composite.cache.allComposites;\n }\n\n var composites = [].concat(composite.composites);\n\n for (var i = 0; i < composite.composites.length; i++)\n composites = composites.concat(Composite.allComposites(composite.composites[i]));\n\n if (composite.cache) {\n composite.cache.allComposites = composites;\n }\n\n return composites;\n };\n\n /**\n * Searches the composite recursively for an object matching the type and id supplied, null if not found.\n * @method get\n * @param {composite} composite\n * @param {number} id\n * @param {string} type\n * @return {object} The requested object, if found\n */\n Composite.get = function(composite, id, type) {\n var objects,\n object;\n\n switch (type) {\n case 'body':\n objects = Composite.allBodies(composite);\n break;\n case 'constraint':\n objects = Composite.allConstraints(composite);\n break;\n case 'composite':\n objects = Composite.allComposites(composite).concat(composite);\n break;\n }\n\n if (!objects)\n return null;\n\n object = objects.filter(function(object) { \n return object.id.toString() === id.toString(); \n });\n\n return object.length === 0 ? null : object[0];\n };\n\n /**\n * Moves the given object(s) from compositeA to compositeB (equal to a remove followed by an add).\n * @method move\n * @param {compositeA} compositeA\n * @param {object[]} objects\n * @param {compositeB} compositeB\n * @return {composite} Returns compositeA\n */\n Composite.move = function(compositeA, objects, compositeB) {\n Composite.remove(compositeA, objects);\n Composite.add(compositeB, objects);\n return compositeA;\n };\n\n /**\n * Assigns new ids for all objects in the composite, recursively.\n * @method rebase\n * @param {composite} composite\n * @return {composite} Returns composite\n */\n Composite.rebase = function(composite) {\n var objects = Composite.allBodies(composite)\n .concat(Composite.allConstraints(composite))\n .concat(Composite.allComposites(composite));\n\n for (var i = 0; i < objects.length; i++) {\n objects[i].id = Common.nextId();\n }\n\n return composite;\n };\n\n /**\n * Translates all children in the composite by a given vector relative to their current positions, \n * without imparting any velocity.\n * @method translate\n * @param {composite} composite\n * @param {vector} translation\n * @param {bool} [recursive=true]\n */\n Composite.translate = function(composite, translation, recursive) {\n var bodies = recursive ? Composite.allBodies(composite) : composite.bodies;\n\n for (var i = 0; i < bodies.length; i++) {\n Body.translate(bodies[i], translation);\n }\n\n return composite;\n };\n\n /**\n * Rotates all children in the composite by a given angle about the given point, without imparting any angular velocity.\n * @method rotate\n * @param {composite} composite\n * @param {number} rotation\n * @param {vector} point\n * @param {bool} [recursive=true]\n */\n Composite.rotate = function(composite, rotation, point, recursive) {\n var cos = Math.cos(rotation),\n sin = Math.sin(rotation),\n bodies = recursive ? Composite.allBodies(composite) : composite.bodies;\n\n for (var i = 0; i < bodies.length; i++) {\n var body = bodies[i],\n dx = body.position.x - point.x,\n dy = body.position.y - point.y;\n \n Body.setPosition(body, {\n x: point.x + (dx * cos - dy * sin),\n y: point.y + (dx * sin + dy * cos)\n });\n\n Body.rotate(body, rotation);\n }\n\n return composite;\n };\n\n /**\n * Scales all children in the composite, including updating physical properties (mass, area, axes, inertia), from a world-space point.\n * @method scale\n * @param {composite} composite\n * @param {number} scaleX\n * @param {number} scaleY\n * @param {vector} point\n * @param {bool} [recursive=true]\n */\n Composite.scale = function(composite, scaleX, scaleY, point, recursive) {\n var bodies = recursive ? Composite.allBodies(composite) : composite.bodies;\n\n for (var i = 0; i < bodies.length; i++) {\n var body = bodies[i],\n dx = body.position.x - point.x,\n dy = body.position.y - point.y;\n \n Body.setPosition(body, {\n x: point.x + dx * scaleX,\n y: point.y + dy * scaleY\n });\n\n Body.scale(body, scaleX, scaleY);\n }\n\n return composite;\n };\n\n /**\n * Returns the union of the bounds of all of the composite's bodies.\n * @method bounds\n * @param {composite} composite The composite.\n * @returns {bounds} The composite bounds.\n */\n Composite.bounds = function(composite) {\n var bodies = Composite.allBodies(composite),\n vertices = [];\n\n for (var i = 0; i < bodies.length; i += 1) {\n var body = bodies[i];\n vertices.push(body.bounds.min, body.bounds.max);\n }\n\n return Bounds.create(vertices);\n };\n\n /*\n *\n * Events Documentation\n *\n */\n\n /**\n * Fired when a call to `Composite.add` is made, before objects have been added.\n *\n * @event beforeAdd\n * @param {} event An event object\n * @param {} event.object The object(s) to be added (may be a single body, constraint, composite or a mixed array of these)\n * @param {} event.source The source object of the event\n * @param {} event.name The name of the event\n */\n\n /**\n * Fired when a call to `Composite.add` is made, after objects have been added.\n *\n * @event afterAdd\n * @param {} event An event object\n * @param {} event.object The object(s) that have been added (may be a single body, constraint, composite or a mixed array of these)\n * @param {} event.source The source object of the event\n * @param {} event.name The name of the event\n */\n\n /**\n * Fired when a call to `Composite.remove` is made, before objects have been removed.\n *\n * @event beforeRemove\n * @param {} event An event object\n * @param {} event.object The object(s) to be removed (may be a single body, constraint, composite or a mixed array of these)\n * @param {} event.source The source object of the event\n * @param {} event.name The name of the event\n */\n\n /**\n * Fired when a call to `Composite.remove` is made, after objects have been removed.\n *\n * @event afterRemove\n * @param {} event An event object\n * @param {} event.object The object(s) that have been removed (may be a single body, constraint, composite or a mixed array of these)\n * @param {} event.source The source object of the event\n * @param {} event.name The name of the event\n */\n\n /*\n *\n * Properties Documentation\n *\n */\n\n /**\n * An integer `Number` uniquely identifying number generated in `Composite.create` by `Common.nextId`.\n *\n * @property id\n * @type number\n */\n\n /**\n * A `String` denoting the type of object.\n *\n * @property type\n * @type string\n * @default \"composite\"\n * @readOnly\n */\n\n /**\n * An arbitrary `String` name to help the user identify and manage composites.\n *\n * @property label\n * @type string\n * @default \"Composite\"\n */\n\n /**\n * A flag that specifies whether the composite has been modified during the current step.\n * This is automatically managed when bodies, constraints or composites are added or removed.\n *\n * @property isModified\n * @type boolean\n * @default false\n */\n\n /**\n * The `Composite` that is the parent of this composite. It is automatically managed by the `Matter.Composite` methods.\n *\n * @property parent\n * @type composite\n * @default null\n */\n\n /**\n * An array of `Body` that are _direct_ children of this composite.\n * To add or remove bodies you should use `Composite.add` and `Composite.remove` methods rather than directly modifying this property.\n * If you wish to recursively find all descendants, you should use the `Composite.allBodies` method.\n *\n * @property bodies\n * @type body[]\n * @default []\n */\n\n /**\n * An array of `Constraint` that are _direct_ children of this composite.\n * To add or remove constraints you should use `Composite.add` and `Composite.remove` methods rather than directly modifying this property.\n * If you wish to recursively find all descendants, you should use the `Composite.allConstraints` method.\n *\n * @property constraints\n * @type constraint[]\n * @default []\n */\n\n /**\n * An array of `Composite` that are _direct_ children of this composite.\n * To add or remove composites you should use `Composite.add` and `Composite.remove` methods rather than directly modifying this property.\n * If you wish to recursively find all descendants, you should use the `Composite.allComposites` method.\n *\n * @property composites\n * @type composite[]\n * @default []\n */\n\n /**\n * An object reserved for storing plugin-specific properties.\n *\n * @property plugin\n * @type {}\n */\n\n /**\n * An object used for storing cached results for performance reasons.\n * This is used internally only and is automatically managed.\n *\n * @private\n * @property cache\n * @type {}\n */\n\n})();\n\n\n/***/ }),\n/* 6 */\n/***/ (function(module, exports, __webpack_require__) {\n\n/**\n* The `Matter.Body` module contains methods for creating and manipulating body models.\n* A `Matter.Body` is a rigid body that can be simulated by a `Matter.Engine`.\n* Factories for commonly used body configurations (such as rectangles, circles and other polygons) can be found in the module `Matter.Bodies`.\n*\n* See the included usage [examples](https://github.com/liabru/matter-js/tree/master/examples).\n\n* @class Body\n*/\n\nvar Body = {};\n\nmodule.exports = Body;\n\nvar Vertices = __webpack_require__(3);\nvar Vector = __webpack_require__(2);\nvar Sleeping = __webpack_require__(7);\nvar Render = __webpack_require__(16);\nvar Common = __webpack_require__(0);\nvar Bounds = __webpack_require__(1);\nvar Axes = __webpack_require__(11);\n\n(function() {\n\n Body._inertiaScale = 4;\n Body._nextCollidingGroupId = 1;\n Body._nextNonCollidingGroupId = -1;\n Body._nextCategory = 0x0001;\n\n /**\n * Creates a new rigid body model. The options parameter is an object that specifies any properties you wish to override the defaults.\n * All properties have default values, and many are pre-calculated automatically based on other properties.\n * Vertices must be specified in clockwise order.\n * See the properties section below for detailed information on what you can pass via the `options` object.\n * @method create\n * @param {} options\n * @return {body} body\n */\n Body.create = function(options) {\n var defaults = {\n id: Common.nextId(),\n type: 'body',\n label: 'Body',\n parts: [],\n plugin: {},\n angle: 0,\n vertices: Vertices.fromPath('L 0 0 L 40 0 L 40 40 L 0 40'),\n position: { x: 0, y: 0 },\n force: { x: 0, y: 0 },\n torque: 0,\n positionImpulse: { x: 0, y: 0 },\n constraintImpulse: { x: 0, y: 0, angle: 0 },\n totalContacts: 0,\n speed: 0,\n angularSpeed: 0,\n velocity: { x: 0, y: 0 },\n angularVelocity: 0,\n isSensor: false,\n isStatic: false,\n isSleeping: false,\n motion: 0,\n sleepThreshold: 60,\n density: 0.001,\n restitution: 0,\n friction: 0.1,\n frictionStatic: 0.5,\n frictionAir: 0.01,\n collisionFilter: {\n category: 0x0001,\n mask: 0xFFFFFFFF,\n group: 0\n },\n slop: 0.05,\n timeScale: 1,\n render: {\n visible: true,\n opacity: 1,\n strokeStyle: null,\n fillStyle: null,\n lineWidth: null,\n sprite: {\n xScale: 1,\n yScale: 1,\n xOffset: 0,\n yOffset: 0\n }\n },\n events: null,\n bounds: null,\n chamfer: null,\n circleRadius: 0,\n positionPrev: null,\n anglePrev: 0,\n parent: null,\n axes: null,\n area: 0,\n mass: 0,\n inertia: 0,\n _original: null\n };\n\n var body = Common.extend(defaults, options);\n\n _initProperties(body, options);\n\n return body;\n };\n\n /**\n * Returns the next unique group index for which bodies will collide.\n * If `isNonColliding` is `true`, returns the next unique group index for which bodies will _not_ collide.\n * See `body.collisionFilter` for more information.\n * @method nextGroup\n * @param {bool} [isNonColliding=false]\n * @return {Number} Unique group index\n */\n Body.nextGroup = function(isNonColliding) {\n if (isNonColliding)\n return Body._nextNonCollidingGroupId--;\n\n return Body._nextCollidingGroupId++;\n };\n\n /**\n * Returns the next unique category bitfield (starting after the initial default category `0x0001`).\n * There are 32 available. See `body.collisionFilter` for more information.\n * @method nextCategory\n * @return {Number} Unique category bitfield\n */\n Body.nextCategory = function() {\n Body._nextCategory = Body._nextCategory << 1;\n return Body._nextCategory;\n };\n\n /**\n * Initialises body properties.\n * @method _initProperties\n * @private\n * @param {body} body\n * @param {} [options]\n */\n var _initProperties = function(body, options) {\n options = options || {};\n\n // init required properties (order is important)\n Body.set(body, {\n bounds: body.bounds || Bounds.create(body.vertices),\n positionPrev: body.positionPrev || Vector.clone(body.position),\n anglePrev: body.anglePrev || body.angle,\n vertices: body.vertices,\n parts: body.parts || [body],\n isStatic: body.isStatic,\n isSleeping: body.isSleeping,\n parent: body.parent || body\n });\n\n Vertices.rotate(body.vertices, body.angle, body.position);\n Axes.rotate(body.axes, body.angle);\n Bounds.update(body.bounds, body.vertices, body.velocity);\n\n // allow options to override the automatically calculated properties\n Body.set(body, {\n axes: options.axes || body.axes,\n area: options.area || body.area,\n mass: options.mass || body.mass,\n inertia: options.inertia || body.inertia\n });\n\n // render properties\n var defaultFillStyle = (body.isStatic ? '#14151f' : Common.choose(['#f19648', '#f5d259', '#f55a3c', '#063e7b', '#ececd1'])),\n defaultStrokeStyle = body.isStatic ? '#555' : '#ccc',\n defaultLineWidth = body.isStatic && body.render.fillStyle === null ? 1 : 0;\n body.render.fillStyle = body.render.fillStyle || defaultFillStyle;\n body.render.strokeStyle = body.render.strokeStyle || defaultStrokeStyle;\n body.render.lineWidth = body.render.lineWidth || defaultLineWidth;\n body.render.sprite.xOffset += -(body.bounds.min.x - body.position.x) / (body.bounds.max.x - body.bounds.min.x);\n body.render.sprite.yOffset += -(body.bounds.min.y - body.position.y) / (body.bounds.max.y - body.bounds.min.y);\n };\n\n /**\n * Given a property and a value (or map of), sets the property(s) on the body, using the appropriate setter functions if they exist.\n * Prefer to use the actual setter functions in performance critical situations.\n * @method set\n * @param {body} body\n * @param {} settings A property name (or map of properties and values) to set on the body.\n * @param {} value The value to set if `settings` is a single property name.\n */\n Body.set = function(body, settings, value) {\n var property;\n\n if (typeof settings === 'string') {\n property = settings;\n settings = {};\n settings[property] = value;\n }\n\n for (property in settings) {\n if (!Object.prototype.hasOwnProperty.call(settings, property))\n continue;\n\n value = settings[property];\n switch (property) {\n\n case 'isStatic':\n Body.setStatic(body, value);\n break;\n case 'isSleeping':\n Sleeping.set(body, value);\n break;\n case 'mass':\n Body.setMass(body, value);\n break;\n case 'density':\n Body.setDensity(body, value);\n break;\n case 'inertia':\n Body.setInertia(body, value);\n break;\n case 'vertices':\n Body.setVertices(body, value);\n break;\n case 'position':\n Body.setPosition(body, value);\n break;\n case 'angle':\n Body.setAngle(body, value);\n break;\n case 'velocity':\n Body.setVelocity(body, value);\n break;\n case 'angularVelocity':\n Body.setAngularVelocity(body, value);\n break;\n case 'parts':\n Body.setParts(body, value);\n break;\n case 'centre':\n Body.setCentre(body, value);\n break;\n default:\n body[property] = value;\n\n }\n }\n };\n\n /**\n * Sets the body as static, including isStatic flag and setting mass and inertia to Infinity.\n * @method setStatic\n * @param {body} body\n * @param {bool} isStatic\n */\n Body.setStatic = function(body, isStatic) {\n for (var i = 0; i < body.parts.length; i++) {\n var part = body.parts[i];\n part.isStatic = isStatic;\n\n if (isStatic) {\n part._original = {\n restitution: part.restitution,\n friction: part.friction,\n mass: part.mass,\n inertia: part.inertia,\n density: part.density,\n inverseMass: part.inverseMass,\n inverseInertia: part.inverseInertia\n };\n\n part.restitution = 0;\n part.friction = 1;\n part.mass = part.inertia = part.density = Infinity;\n part.inverseMass = part.inverseInertia = 0;\n\n part.positionPrev.x = part.position.x;\n part.positionPrev.y = part.position.y;\n part.anglePrev = part.angle;\n part.angularVelocity = 0;\n part.speed = 0;\n part.angularSpeed = 0;\n part.motion = 0;\n } else if (part._original) {\n part.restitution = part._original.restitution;\n part.friction = part._original.friction;\n part.mass = part._original.mass;\n part.inertia = part._original.inertia;\n part.density = part._original.density;\n part.inverseMass = part._original.inverseMass;\n part.inverseInertia = part._original.inverseInertia;\n\n part._original = null;\n }\n }\n };\n\n /**\n * Sets the mass of the body. Inverse mass, density and inertia are automatically updated to reflect the change.\n * @method setMass\n * @param {body} body\n * @param {number} mass\n */\n Body.setMass = function(body, mass) {\n var moment = body.inertia / (body.mass / 6);\n body.inertia = moment * (mass / 6);\n body.inverseInertia = 1 / body.inertia;\n\n body.mass = mass;\n body.inverseMass = 1 / body.mass;\n body.density = body.mass / body.area;\n };\n\n /**\n * Sets the density of the body. Mass and inertia are automatically updated to reflect the change.\n * @method setDensity\n * @param {body} body\n * @param {number} density\n */\n Body.setDensity = function(body, density) {\n Body.setMass(body, density * body.area);\n body.density = density;\n };\n\n /**\n * Sets the moment of inertia (i.e. second moment of area) of the body. \n * Inverse inertia is automatically updated to reflect the change. Mass is not changed.\n * @method setInertia\n * @param {body} body\n * @param {number} inertia\n */\n Body.setInertia = function(body, inertia) {\n body.inertia = inertia;\n body.inverseInertia = 1 / body.inertia;\n };\n\n /**\n * Sets the body's vertices and updates body properties accordingly, including inertia, area and mass (with respect to `body.density`).\n * Vertices will be automatically transformed to be orientated around their centre of mass as the origin.\n * They are then automatically translated to world space based on `body.position`.\n *\n * The `vertices` argument should be passed as an array of `Matter.Vector` points (or a `Matter.Vertices` array).\n * Vertices must form a convex hull, concave hulls are not supported.\n *\n * @method setVertices\n * @param {body} body\n * @param {vector[]} vertices\n */\n Body.setVertices = function(body, vertices) {\n // change vertices\n if (vertices[0].body === body) {\n body.vertices = vertices;\n } else {\n body.vertices = Vertices.create(vertices, body);\n }\n\n // update properties\n body.axes = Axes.fromVertices(body.vertices);\n body.area = Vertices.area(body.vertices);\n Body.setMass(body, body.density * body.area);\n\n // orient vertices around the centre of mass at origin (0, 0)\n var centre = Vertices.centre(body.vertices);\n Vertices.translate(body.vertices, centre, -1);\n\n // update inertia while vertices are at origin (0, 0)\n Body.setInertia(body, Body._inertiaScale * Vertices.inertia(body.vertices, body.mass));\n\n // update geometry\n Vertices.translate(body.vertices, body.position);\n Bounds.update(body.bounds, body.vertices, body.velocity);\n };\n\n /**\n * Sets the parts of the `body` and updates mass, inertia and centroid.\n * Each part will have its parent set to `body`.\n * By default the convex hull will be automatically computed and set on `body`, unless `autoHull` is set to `false.`\n * Note that this method will ensure that the first part in `body.parts` will always be the `body`.\n * @method setParts\n * @param {body} body\n * @param [body] parts\n * @param {bool} [autoHull=true]\n */\n Body.setParts = function(body, parts, autoHull) {\n var i;\n\n // add all the parts, ensuring that the first part is always the parent body\n parts = parts.slice(0);\n body.parts.length = 0;\n body.parts.push(body);\n body.parent = body;\n\n for (i = 0; i < parts.length; i++) {\n var part = parts[i];\n if (part !== body) {\n part.parent = body;\n body.parts.push(part);\n }\n }\n\n if (body.parts.length === 1)\n return;\n\n autoHull = typeof autoHull !== 'undefined' ? autoHull : true;\n\n // find the convex hull of all parts to set on the parent body\n if (autoHull) {\n var vertices = [];\n for (i = 0; i < parts.length; i++) {\n vertices = vertices.concat(parts[i].vertices);\n }\n\n Vertices.clockwiseSort(vertices);\n\n var hull = Vertices.hull(vertices),\n hullCentre = Vertices.centre(hull);\n\n Body.setVertices(body, hull);\n Vertices.translate(body.vertices, hullCentre);\n }\n\n // sum the properties of all compound parts of the parent body\n var total = Body._totalProperties(body);\n\n body.area = total.area;\n body.parent = body;\n body.position.x = total.centre.x;\n body.position.y = total.centre.y;\n body.positionPrev.x = total.centre.x;\n body.positionPrev.y = total.centre.y;\n\n Body.setMass(body, total.mass);\n Body.setInertia(body, total.inertia);\n Body.setPosition(body, total.centre);\n };\n\n /**\n * Set the centre of mass of the body. \n * The `centre` is a vector in world-space unless `relative` is set, in which case it is a translation.\n * The centre of mass is the point the body rotates about and can be used to simulate non-uniform density.\n * This is equal to moving `body.position` but not the `body.vertices`.\n * Invalid if the `centre` falls outside the body's convex hull.\n * @method setCentre\n * @param {body} body\n * @param {vector} centre\n * @param {bool} relative\n */\n Body.setCentre = function(body, centre, relative) {\n if (!relative) {\n body.positionPrev.x = centre.x - (body.position.x - body.positionPrev.x);\n body.positionPrev.y = centre.y - (body.position.y - body.positionPrev.y);\n body.position.x = centre.x;\n body.position.y = centre.y;\n } else {\n body.positionPrev.x += centre.x;\n body.positionPrev.y += centre.y;\n body.position.x += centre.x;\n body.position.y += centre.y;\n }\n };\n\n /**\n * Sets the position of the body instantly. Velocity, angle, force etc. are unchanged.\n * @method setPosition\n * @param {body} body\n * @param {vector} position\n */\n Body.setPosition = function(body, position) {\n var delta = Vector.sub(position, body.position);\n body.positionPrev.x += delta.x;\n body.positionPrev.y += delta.y;\n\n for (var i = 0; i < body.parts.length; i++) {\n var part = body.parts[i];\n part.position.x += delta.x;\n part.position.y += delta.y;\n Vertices.translate(part.vertices, delta);\n Bounds.update(part.bounds, part.vertices, body.velocity);\n }\n };\n\n /**\n * Sets the angle of the body instantly. Angular velocity, position, force etc. are unchanged.\n * @method setAngle\n * @param {body} body\n * @param {number} angle\n */\n Body.setAngle = function(body, angle) {\n var delta = angle - body.angle;\n body.anglePrev += delta;\n\n for (var i = 0; i < body.parts.length; i++) {\n var part = body.parts[i];\n part.angle += delta;\n Vertices.rotate(part.vertices, delta, body.position);\n Axes.rotate(part.axes, delta);\n Bounds.update(part.bounds, part.vertices, body.velocity);\n if (i > 0) {\n Vector.rotateAbout(part.position, delta, body.position, part.position);\n }\n }\n };\n\n /**\n * Sets the linear velocity of the body instantly. Position, angle, force etc. are unchanged. See also `Body.applyForce`.\n * @method setVelocity\n * @param {body} body\n * @param {vector} velocity\n */\n Body.setVelocity = function(body, velocity) {\n body.positionPrev.x = body.position.x - velocity.x;\n body.positionPrev.y = body.position.y - velocity.y;\n body.velocity.x = velocity.x;\n body.velocity.y = velocity.y;\n body.speed = Vector.magnitude(body.velocity);\n };\n\n /**\n * Sets the angular velocity of the body instantly. Position, angle, force etc. are unchanged. See also `Body.applyForce`.\n * @method setAngularVelocity\n * @param {body} body\n * @param {number} velocity\n */\n Body.setAngularVelocity = function(body, velocity) {\n body.anglePrev = body.angle - velocity;\n body.angularVelocity = velocity;\n body.angularSpeed = Math.abs(body.angularVelocity);\n };\n\n /**\n * Moves a body by a given vector relative to its current position, without imparting any velocity.\n * @method translate\n * @param {body} body\n * @param {vector} translation\n */\n Body.translate = function(body, translation) {\n Body.setPosition(body, Vector.add(body.position, translation));\n };\n\n /**\n * Rotates a body by a given angle relative to its current angle, without imparting any angular velocity.\n * @method rotate\n * @param {body} body\n * @param {number} rotation\n * @param {vector} [point]\n */\n Body.rotate = function(body, rotation, point) {\n if (!point) {\n Body.setAngle(body, body.angle + rotation);\n } else {\n var cos = Math.cos(rotation),\n sin = Math.sin(rotation),\n dx = body.position.x - point.x,\n dy = body.position.y - point.y;\n \n Body.setPosition(body, {\n x: point.x + (dx * cos - dy * sin),\n y: point.y + (dx * sin + dy * cos)\n });\n\n Body.setAngle(body, body.angle + rotation);\n }\n };\n\n /**\n * Scales the body, including updating physical properties (mass, area, axes, inertia), from a world-space point (default is body centre).\n * @method scale\n * @param {body} body\n * @param {number} scaleX\n * @param {number} scaleY\n * @param {vector} [point]\n */\n Body.scale = function(body, scaleX, scaleY, point) {\n var totalArea = 0,\n totalInertia = 0;\n\n point = point || body.position;\n\n for (var i = 0; i < body.parts.length; i++) {\n var part = body.parts[i];\n\n // scale vertices\n Vertices.scale(part.vertices, scaleX, scaleY, point);\n\n // update properties\n part.axes = Axes.fromVertices(part.vertices);\n part.area = Vertices.area(part.vertices);\n Body.setMass(part, body.density * part.area);\n\n // update inertia (requires vertices to be at origin)\n Vertices.translate(part.vertices, { x: -part.position.x, y: -part.position.y });\n Body.setInertia(part, Body._inertiaScale * Vertices.inertia(part.vertices, part.mass));\n Vertices.translate(part.vertices, { x: part.position.x, y: part.position.y });\n\n if (i > 0) {\n totalArea += part.area;\n totalInertia += part.inertia;\n }\n\n // scale position\n part.position.x = point.x + (part.position.x - point.x) * scaleX;\n part.position.y = point.y + (part.position.y - point.y) * scaleY;\n\n // update bounds\n Bounds.update(part.bounds, part.vertices, body.velocity);\n }\n\n // handle parent body\n if (body.parts.length > 1) {\n body.area = totalArea;\n\n if (!body.isStatic) {\n Body.setMass(body, body.density * totalArea);\n Body.setInertia(body, totalInertia);\n }\n }\n\n // handle circles\n if (body.circleRadius) { \n if (scaleX === scaleY) {\n body.circleRadius *= scaleX;\n } else {\n // body is no longer a circle\n body.circleRadius = null;\n }\n }\n };\n\n /**\n * Performs a simulation step for the given `body`, including updating position and angle using Verlet integration.\n * @method update\n * @param {body} body\n * @param {number} deltaTime\n * @param {number} timeScale\n * @param {number} correction\n */\n Body.update = function(body, deltaTime, timeScale, correction) {\n var deltaTimeSquared = Math.pow(deltaTime * timeScale * body.timeScale, 2);\n\n // from the previous step\n var frictionAir = 1 - body.frictionAir * timeScale * body.timeScale,\n velocityPrevX = body.position.x - body.positionPrev.x,\n velocityPrevY = body.position.y - body.positionPrev.y;\n\n // update velocity with Verlet integration\n body.velocity.x = (velocityPrevX * frictionAir * correction) + (body.force.x / body.mass) * deltaTimeSquared;\n body.velocity.y = (velocityPrevY * frictionAir * correction) + (body.force.y / body.mass) * deltaTimeSquared;\n\n body.positionPrev.x = body.position.x;\n body.positionPrev.y = body.position.y;\n body.position.x += body.velocity.x;\n body.position.y += body.velocity.y;\n\n // update angular velocity with Verlet integration\n body.angularVelocity = ((body.angle - body.anglePrev) * frictionAir * correction) + (body.torque / body.inertia) * deltaTimeSquared;\n body.anglePrev = body.angle;\n body.angle += body.angularVelocity;\n\n // track speed and acceleration\n body.speed = Vector.magnitude(body.velocity);\n body.angularSpeed = Math.abs(body.angularVelocity);\n\n // transform the body geometry\n for (var i = 0; i < body.parts.length; i++) {\n var part = body.parts[i];\n\n Vertices.translate(part.vertices, body.velocity);\n \n if (i > 0) {\n part.position.x += body.velocity.x;\n part.position.y += body.velocity.y;\n }\n\n if (body.angularVelocity !== 0) {\n Vertices.rotate(part.vertices, body.angularVelocity, body.position);\n Axes.rotate(part.axes, body.angularVelocity);\n if (i > 0) {\n Vector.rotateAbout(part.position, body.angularVelocity, body.position, part.position);\n }\n }\n\n Bounds.update(part.bounds, part.vertices, body.velocity);\n }\n };\n\n /**\n * Applies a force to a body from a given world-space position, including resulting torque.\n * @method applyForce\n * @param {body} body\n * @param {vector} position\n * @param {vector} force\n */\n Body.applyForce = function(body, position, force) {\n body.force.x += force.x;\n body.force.y += force.y;\n var offset = { x: position.x - body.position.x, y: position.y - body.position.y };\n body.torque += offset.x * force.y - offset.y * force.x;\n };\n\n /**\n * Returns the sums of the properties of all compound parts of the parent body.\n * @method _totalProperties\n * @private\n * @param {body} body\n * @return {}\n */\n Body._totalProperties = function(body) {\n // from equations at:\n // https://ecourses.ou.edu/cgi-bin/ebook.cgi?doc=&topic=st&chap_sec=07.2&page=theory\n // http://output.to/sideway/default.asp?qno=121100087\n\n var properties = {\n mass: 0,\n area: 0,\n inertia: 0,\n centre: { x: 0, y: 0 }\n };\n\n // sum the properties of all compound parts of the parent body\n for (var i = body.parts.length === 1 ? 0 : 1; i < body.parts.length; i++) {\n var part = body.parts[i],\n mass = part.mass !== Infinity ? part.mass : 1;\n\n properties.mass += mass;\n properties.area += part.area;\n properties.inertia += part.inertia;\n properties.centre = Vector.add(properties.centre, Vector.mult(part.position, mass));\n }\n\n properties.centre = Vector.div(properties.centre, properties.mass);\n\n return properties;\n };\n\n /*\n *\n * Events Documentation\n *\n */\n\n /**\n * Fired when a body starts sleeping (where `this` is the body).\n *\n * @event sleepStart\n * @this {body} The body that has started sleeping\n * @param {} event An event object\n * @param {} event.source The source object of the event\n * @param {} event.name The name of the event\n */\n\n /**\n * Fired when a body ends sleeping (where `this` is the body).\n *\n * @event sleepEnd\n * @this {body} The body that has ended sleeping\n * @param {} event An event object\n * @param {} event.source The source object of the event\n * @param {} event.name The name of the event\n */\n\n /*\n *\n * Properties Documentation\n *\n */\n\n /**\n * An integer `Number` uniquely identifying number generated in `Body.create` by `Common.nextId`.\n *\n * @property id\n * @type number\n */\n\n /**\n * A `String` denoting the type of object.\n *\n * @property type\n * @type string\n * @default \"body\"\n * @readOnly\n */\n\n /**\n * An arbitrary `String` name to help the user identify and manage bodies.\n *\n * @property label\n * @type string\n * @default \"Body\"\n */\n\n /**\n * An array of bodies that make up this body. \n * The first body in the array must always be a self reference to the current body instance.\n * All bodies in the `parts` array together form a single rigid compound body.\n * Parts are allowed to overlap, have gaps or holes or even form concave bodies.\n * Parts themselves should never be added to a `World`, only the parent body should be.\n * Use `Body.setParts` when setting parts to ensure correct updates of all properties.\n *\n * @property parts\n * @type body[]\n */\n\n /**\n * An object reserved for storing plugin-specific properties.\n *\n * @property plugin\n * @type {}\n */\n\n /**\n * A self reference if the body is _not_ a part of another body.\n * Otherwise this is a reference to the body that this is a part of.\n * See `body.parts`.\n *\n * @property parent\n * @type body\n */\n\n /**\n * A `Number` specifying the angle of the body, in radians.\n *\n * @property angle\n * @type number\n * @default 0\n */\n\n /**\n * An array of `Vector` objects that specify the convex hull of the rigid body.\n * These should be provided about the origin `(0, 0)`. E.g.\n *\n * [{ x: 0, y: 0 }, { x: 25, y: 50 }, { x: 50, y: 0 }]\n *\n * When passed via `Body.create`, the vertices are translated relative to `body.position` (i.e. world-space, and constantly updated by `Body.update` during simulation).\n * The `Vector` objects are also augmented with additional properties required for efficient collision detection. \n *\n * Other properties such as `inertia` and `bounds` are automatically calculated from the passed vertices (unless provided via `options`).\n * Concave hulls are not currently supported. The module `Matter.Vertices` contains useful methods for working with vertices.\n *\n * @property vertices\n * @type vector[]\n */\n\n /**\n * A `Vector` that specifies the current world-space position of the body.\n *\n * @property position\n * @type vector\n * @default { x: 0, y: 0 }\n */\n\n /**\n * A `Vector` that specifies the force to apply in the current step. It is zeroed after every `Body.update`. See also `Body.applyForce`.\n *\n * @property force\n * @type vector\n * @default { x: 0, y: 0 }\n */\n\n /**\n * A `Number` that specifies the torque (turning force) to apply in the current step. It is zeroed after every `Body.update`.\n *\n * @property torque\n * @type number\n * @default 0\n */\n\n /**\n * A `Number` that _measures_ the current speed of the body after the last `Body.update`. It is read-only and always positive (it's the magnitude of `body.velocity`).\n *\n * @readOnly\n * @property speed\n * @type number\n * @default 0\n */\n\n /**\n * A `Number` that _measures_ the current angular speed of the body after the last `Body.update`. It is read-only and always positive (it's the magnitude of `body.angularVelocity`).\n *\n * @readOnly\n * @property angularSpeed\n * @type number\n * @default 0\n */\n\n /**\n * A `Vector` that _measures_ the current velocity of the body after the last `Body.update`. It is read-only. \n * If you need to modify a body's velocity directly, you should either apply a force or simply change the body's `position` (as the engine uses position-Verlet integration).\n *\n * @readOnly\n * @property velocity\n * @type vector\n * @default { x: 0, y: 0 }\n */\n\n /**\n * A `Number` that _measures_ the current angular velocity of the body after the last `Body.update`. It is read-only. \n * If you need to modify a body's angular velocity directly, you should apply a torque or simply change the body's `angle` (as the engine uses position-Verlet integration).\n *\n * @readOnly\n * @property angularVelocity\n * @type number\n * @default 0\n */\n\n /**\n * A flag that indicates whether a body is considered static. A static body can never change position or angle and is completely fixed.\n * If you need to set a body as static after its creation, you should use `Body.setStatic` as this requires more than just setting this flag.\n *\n * @property isStatic\n * @type boolean\n * @default false\n */\n\n /**\n * A flag that indicates whether a body is a sensor. Sensor triggers collision events, but doesn't react with colliding body physically.\n *\n * @property isSensor\n * @type boolean\n * @default false\n */\n\n /**\n * A flag that indicates whether the body is considered sleeping. A sleeping body acts similar to a static body, except it is only temporary and can be awoken.\n * If you need to set a body as sleeping, you should use `Sleeping.set` as this requires more than just setting this flag.\n *\n * @property isSleeping\n * @type boolean\n * @default false\n */\n\n /**\n * A `Number` that _measures_ the amount of movement a body currently has (a combination of `speed` and `angularSpeed`). It is read-only and always positive.\n * It is used and updated by the `Matter.Sleeping` module during simulation to decide if a body has come to rest.\n *\n * @readOnly\n * @property motion\n * @type number\n * @default 0\n */\n\n /**\n * A `Number` that defines the number of updates in which this body must have near-zero velocity before it is set as sleeping by the `Matter.Sleeping` module (if sleeping is enabled by the engine).\n *\n * @property sleepThreshold\n * @type number\n * @default 60\n */\n\n /**\n * A `Number` that defines the density of the body, that is its mass per unit area.\n * If you pass the density via `Body.create` the `mass` property is automatically calculated for you based on the size (area) of the object.\n * This is generally preferable to simply setting mass and allows for more intuitive definition of materials (e.g. rock has a higher density than wood).\n *\n * @property density\n * @type number\n * @default 0.001\n */\n\n /**\n * A `Number` that defines the mass of the body, although it may be more appropriate to specify the `density` property instead.\n * If you modify this value, you must also modify the `body.inverseMass` property (`1 / mass`).\n *\n * @property mass\n * @type number\n */\n\n /**\n * A `Number` that defines the inverse mass of the body (`1 / mass`).\n * If you modify this value, you must also modify the `body.mass` property.\n *\n * @property inverseMass\n * @type number\n */\n\n /**\n * A `Number` that defines the moment of inertia (i.e. second moment of area) of the body.\n * It is automatically calculated from the given convex hull (`vertices` array) and density in `Body.create`.\n * If you modify this value, you must also modify the `body.inverseInertia` property (`1 / inertia`).\n *\n * @property inertia\n * @type number\n */\n\n /**\n * A `Number` that defines the inverse moment of inertia of the body (`1 / inertia`).\n * If you modify this value, you must also modify the `body.inertia` property.\n *\n * @property inverseInertia\n * @type number\n */\n\n /**\n * A `Number` that defines the restitution (elasticity) of the body. The value is always positive and is in the range `(0, 1)`.\n * A value of `0` means collisions may be perfectly inelastic and no bouncing may occur. \n * A value of `0.8` means the body may bounce back with approximately 80% of its kinetic energy.\n * Note that collision response is based on _pairs_ of bodies, and that `restitution` values are _combined_ with the following formula:\n *\n * Math.max(bodyA.restitution, bodyB.restitution)\n *\n * @property restitution\n * @type number\n * @default 0\n */\n\n /**\n * A `Number` that defines the friction of the body. The value is always positive and is in the range `(0, 1)`.\n * A value of `0` means that the body may slide indefinitely.\n * A value of `1` means the body may come to a stop almost instantly after a force is applied.\n *\n * The effects of the value may be non-linear. \n * High values may be unstable depending on the body.\n * The engine uses a Coulomb friction model including static and kinetic friction.\n * Note that collision response is based on _pairs_ of bodies, and that `friction` values are _combined_ with the following formula:\n *\n * Math.min(bodyA.friction, bodyB.friction)\n *\n * @property friction\n * @type number\n * @default 0.1\n */\n\n /**\n * A `Number` that defines the static friction of the body (in the Coulomb friction model). \n * A value of `0` means the body will never 'stick' when it is nearly stationary and only dynamic `friction` is used.\n * The higher the value (e.g. `10`), the more force it will take to initially get the body moving when nearly stationary.\n * This value is multiplied with the `friction` property to make it easier to change `friction` and maintain an appropriate amount of static friction.\n *\n * @property frictionStatic\n * @type number\n * @default 0.5\n */\n\n /**\n * A `Number` that defines the air friction of the body (air resistance). \n * A value of `0` means the body will never slow as it moves through space.\n * The higher the value, the faster a body slows when moving through space.\n * The effects of the value are non-linear. \n *\n * @property frictionAir\n * @type number\n * @default 0.01\n */\n\n /**\n * An `Object` that specifies the collision filtering properties of this body.\n *\n * Collisions between two bodies will obey the following rules:\n * - If the two bodies have the same non-zero value of `collisionFilter.group`,\n * they will always collide if the value is positive, and they will never collide\n * if the value is negative.\n * - If the two bodies have different values of `collisionFilter.group` or if one\n * (or both) of the bodies has a value of 0, then the category/mask rules apply as follows:\n *\n * Each body belongs to a collision category, given by `collisionFilter.category`. This\n * value is used as a bit field and the category should have only one bit set, meaning that\n * the value of this property is a power of two in the range [1, 2^31]. Thus, there are 32\n * different collision categories available.\n *\n * Each body also defines a collision bitmask, given by `collisionFilter.mask` which specifies\n * the categories it collides with (the value is the bitwise AND value of all these categories).\n *\n * Using the category/mask rules, two bodies `A` and `B` collide if each includes the other's\n * category in its mask, i.e. `(categoryA & maskB) !== 0` and `(categoryB & maskA) !== 0`\n * are both true.\n *\n * @property collisionFilter\n * @type object\n */\n\n /**\n * An Integer `Number`, that specifies the collision group this body belongs to.\n * See `body.collisionFilter` for more information.\n *\n * @property collisionFilter.group\n * @type object\n * @default 0\n */\n\n /**\n * A bit field that specifies the collision category this body belongs to.\n * The category value should have only one bit set, for example `0x0001`.\n * This means there are up to 32 unique collision categories available.\n * See `body.collisionFilter` for more information.\n *\n * @property collisionFilter.category\n * @type object\n * @default 1\n */\n\n /**\n * A bit mask that specifies the collision categories this body may collide with.\n * See `body.collisionFilter` for more information.\n *\n * @property collisionFilter.mask\n * @type object\n * @default -1\n */\n\n /**\n * A `Number` that specifies a tolerance on how far a body is allowed to 'sink' or rotate into other bodies.\n * Avoid changing this value unless you understand the purpose of `slop` in physics engines.\n * The default should generally suffice, although very large bodies may require larger values for stable stacking.\n *\n * @property slop\n * @type number\n * @default 0.05\n */\n\n /**\n * A `Number` that allows per-body time scaling, e.g. a force-field where bodies inside are in slow-motion, while others are at full speed.\n *\n * @property timeScale\n * @type number\n * @default 1\n */\n\n /**\n * An `Object` that defines the rendering properties to be consumed by the module `Matter.Render`.\n *\n * @property render\n * @type object\n */\n\n /**\n * A flag that indicates if the body should be rendered.\n *\n * @property render.visible\n * @type boolean\n * @default true\n */\n\n /**\n * Sets the opacity to use when rendering.\n *\n * @property render.opacity\n * @type number\n * @default 1\n */\n\n /**\n * An `Object` that defines the sprite properties to use when rendering, if any.\n *\n * @property render.sprite\n * @type object\n */\n\n /**\n * An `String` that defines the path to the image to use as the sprite texture, if any.\n *\n * @property render.sprite.texture\n * @type string\n */\n \n /**\n * A `Number` that defines the scaling in the x-axis for the sprite, if any.\n *\n * @property render.sprite.xScale\n * @type number\n * @default 1\n */\n\n /**\n * A `Number` that defines the scaling in the y-axis for the sprite, if any.\n *\n * @property render.sprite.yScale\n * @type number\n * @default 1\n */\n\n /**\n * A `Number` that defines the offset in the x-axis for the sprite (normalised by texture width).\n *\n * @property render.sprite.xOffset\n * @type number\n * @default 0\n */\n\n /**\n * A `Number` that defines the offset in the y-axis for the sprite (normalised by texture height).\n *\n * @property render.sprite.yOffset\n * @type number\n * @default 0\n */\n\n /**\n * A `Number` that defines the line width to use when rendering the body outline (if a sprite is not defined).\n * A value of `0` means no outline will be rendered.\n *\n * @property render.lineWidth\n * @type number\n * @default 0\n */\n\n /**\n * A `String` that defines the fill style to use when rendering the body (if a sprite is not defined).\n * It is the same as when using a canvas, so it accepts CSS style property values.\n *\n * @property render.fillStyle\n * @type string\n * @default a random colour\n */\n\n /**\n * A `String` that defines the stroke style to use when rendering the body outline (if a sprite is not defined).\n * It is the same as when using a canvas, so it accepts CSS style property values.\n *\n * @property render.strokeStyle\n * @type string\n * @default a random colour\n */\n\n /**\n * An array of unique axis vectors (edge normals) used for collision detection.\n * These are automatically calculated from the given convex hull (`vertices` array) in `Body.create`.\n * They are constantly updated by `Body.update` during the simulation.\n *\n * @property axes\n * @type vector[]\n */\n \n /**\n * A `Number` that _measures_ the area of the body's convex hull, calculated at creation by `Body.create`.\n *\n * @property area\n * @type string\n * @default \n */\n\n /**\n * A `Bounds` object that defines the AABB region for the body.\n * It is automatically calculated from the given convex hull (`vertices` array) in `Body.create` and constantly updated by `Body.update` during simulation.\n *\n * @property bounds\n * @type bounds\n */\n\n})();\n\n\n/***/ }),\n/* 7 */\n/***/ (function(module, exports, __webpack_require__) {\n\n/**\n* The `Matter.Sleeping` module contains methods to manage the sleeping state of bodies.\n*\n* @class Sleeping\n*/\n\nvar Sleeping = {};\n\nmodule.exports = Sleeping;\n\nvar Events = __webpack_require__(4);\n\n(function() {\n\n Sleeping._motionWakeThreshold = 0.18;\n Sleeping._motionSleepThreshold = 0.08;\n Sleeping._minBias = 0.9;\n\n /**\n * Puts bodies to sleep or wakes them up depending on their motion.\n * @method update\n * @param {body[]} bodies\n * @param {number} timeScale\n */\n Sleeping.update = function(bodies, timeScale) {\n var timeFactor = timeScale * timeScale * timeScale;\n\n // update bodies sleeping status\n for (var i = 0; i < bodies.length; i++) {\n var body = bodies[i],\n motion = body.speed * body.speed + body.angularSpeed * body.angularSpeed;\n\n // wake up bodies if they have a force applied\n if (body.force.x !== 0 || body.force.y !== 0) {\n Sleeping.set(body, false);\n continue;\n }\n\n var minMotion = Math.min(body.motion, motion),\n maxMotion = Math.max(body.motion, motion);\n \n // biased average motion estimation between frames\n body.motion = Sleeping._minBias * minMotion + (1 - Sleeping._minBias) * maxMotion;\n \n if (body.sleepThreshold > 0 && body.motion < Sleeping._motionSleepThreshold * timeFactor) {\n body.sleepCounter += 1;\n \n if (body.sleepCounter >= body.sleepThreshold)\n Sleeping.set(body, true);\n } else if (body.sleepCounter > 0) {\n body.sleepCounter -= 1;\n }\n }\n };\n\n /**\n * Given a set of colliding pairs, wakes the sleeping bodies involved.\n * @method afterCollisions\n * @param {pair[]} pairs\n * @param {number} timeScale\n */\n Sleeping.afterCollisions = function(pairs, timeScale) {\n var timeFactor = timeScale * timeScale * timeScale;\n\n // wake up bodies involved in collisions\n for (var i = 0; i < pairs.length; i++) {\n var pair = pairs[i];\n \n // don't wake inactive pairs\n if (!pair.isActive)\n continue;\n\n var collision = pair.collision,\n bodyA = collision.bodyA.parent, \n bodyB = collision.bodyB.parent;\n \n // don't wake if at least one body is static\n if ((bodyA.isSleeping && bodyB.isSleeping) || bodyA.isStatic || bodyB.isStatic)\n continue;\n \n if (bodyA.isSleeping || bodyB.isSleeping) {\n var sleepingBody = (bodyA.isSleeping && !bodyA.isStatic) ? bodyA : bodyB,\n movingBody = sleepingBody === bodyA ? bodyB : bodyA;\n\n if (!sleepingBody.isStatic && movingBody.motion > Sleeping._motionWakeThreshold * timeFactor) {\n Sleeping.set(sleepingBody, false);\n }\n }\n }\n };\n \n /**\n * Set a body as sleeping or awake.\n * @method set\n * @param {body} body\n * @param {boolean} isSleeping\n */\n Sleeping.set = function(body, isSleeping) {\n var wasSleeping = body.isSleeping;\n\n if (isSleeping) {\n body.isSleeping = true;\n body.sleepCounter = body.sleepThreshold;\n\n body.positionImpulse.x = 0;\n body.positionImpulse.y = 0;\n\n body.positionPrev.x = body.position.x;\n body.positionPrev.y = body.position.y;\n\n body.anglePrev = body.angle;\n body.speed = 0;\n body.angularSpeed = 0;\n body.motion = 0;\n\n if (!wasSleeping) {\n Events.trigger(body, 'sleepStart');\n }\n } else {\n body.isSleeping = false;\n body.sleepCounter = 0;\n\n if (wasSleeping) {\n Events.trigger(body, 'sleepEnd');\n }\n }\n };\n\n})();\n\n\n/***/ }),\n/* 8 */\n/***/ (function(module, exports, __webpack_require__) {\n\n/**\n* The `Matter.Collision` module contains methods for detecting collisions between a given pair of bodies.\n*\n* For efficient detection between a list of bodies, see `Matter.Detector` and `Matter.Query`.\n*\n* See `Matter.Engine` for collision events.\n*\n* @class Collision\n*/\n\nvar Collision = {};\n\nmodule.exports = Collision;\n\nvar Vertices = __webpack_require__(3);\nvar Pair = __webpack_require__(9);\n\n(function() {\n var _supports = [];\n\n var _overlapAB = {\n overlap: 0,\n axis: null\n };\n\n var _overlapBA = {\n overlap: 0,\n axis: null\n };\n\n /**\n * Creates a new collision record.\n * @method create\n * @param {body} bodyA The first body part represented by the collision record\n * @param {body} bodyB The second body part represented by the collision record\n * @return {collision} A new collision record\n */\n Collision.create = function(bodyA, bodyB) {\n return { \n pair: null,\n collided: false,\n bodyA: bodyA,\n bodyB: bodyB,\n parentA: bodyA.parent,\n parentB: bodyB.parent,\n depth: 0,\n normal: { x: 0, y: 0 },\n tangent: { x: 0, y: 0 },\n penetration: { x: 0, y: 0 },\n supports: []\n };\n };\n\n /**\n * Detect collision between two bodies.\n * @method collides\n * @param {body} bodyA\n * @param {body} bodyB\n * @param {pairs} [pairs] Optionally reuse collision records from existing pairs.\n * @return {collision|null} A collision record if detected, otherwise null\n */\n Collision.collides = function(bodyA, bodyB, pairs) {\n Collision._overlapAxes(_overlapAB, bodyA.vertices, bodyB.vertices, bodyA.axes);\n\n if (_overlapAB.overlap <= 0) {\n return null;\n }\n\n Collision._overlapAxes(_overlapBA, bodyB.vertices, bodyA.vertices, bodyB.axes);\n\n if (_overlapBA.overlap <= 0) {\n return null;\n }\n\n // reuse collision records for gc efficiency\n var pair = pairs && pairs.table[Pair.id(bodyA, bodyB)],\n collision;\n\n if (!pair) {\n collision = Collision.create(bodyA, bodyB);\n collision.collided = true;\n collision.bodyA = bodyA.id < bodyB.id ? bodyA : bodyB;\n collision.bodyB = bodyA.id < bodyB.id ? bodyB : bodyA;\n collision.parentA = collision.bodyA.parent;\n collision.parentB = collision.bodyB.parent;\n } else {\n collision = pair.collision;\n }\n\n bodyA = collision.bodyA;\n bodyB = collision.bodyB;\n\n var minOverlap;\n\n if (_overlapAB.overlap < _overlapBA.overlap) {\n minOverlap = _overlapAB;\n } else {\n minOverlap = _overlapBA;\n }\n\n var normal = collision.normal,\n supports = collision.supports,\n minAxis = minOverlap.axis,\n minAxisX = minAxis.x,\n minAxisY = minAxis.y;\n\n // ensure normal is facing away from bodyA\n if (minAxisX * (bodyB.position.x - bodyA.position.x) + minAxisY * (bodyB.position.y - bodyA.position.y) < 0) {\n normal.x = minAxisX;\n normal.y = minAxisY;\n } else {\n normal.x = -minAxisX;\n normal.y = -minAxisY;\n }\n \n collision.tangent.x = -normal.y;\n collision.tangent.y = normal.x;\n\n collision.depth = minOverlap.overlap;\n\n collision.penetration.x = normal.x * collision.depth;\n collision.penetration.y = normal.y * collision.depth;\n\n // find support points, there is always either exactly one or two\n var supportsB = Collision._findSupports(bodyA, bodyB, normal, 1),\n supportCount = 0;\n\n // find the supports from bodyB that are inside bodyA\n if (Vertices.contains(bodyA.vertices, supportsB[0])) {\n supports[supportCount++] = supportsB[0];\n }\n\n if (Vertices.contains(bodyA.vertices, supportsB[1])) {\n supports[supportCount++] = supportsB[1];\n }\n\n // find the supports from bodyA that are inside bodyB\n if (supportCount < 2) {\n var supportsA = Collision._findSupports(bodyB, bodyA, normal, -1);\n\n if (Vertices.contains(bodyB.vertices, supportsA[0])) {\n supports[supportCount++] = supportsA[0];\n }\n\n if (supportCount < 2 && Vertices.contains(bodyB.vertices, supportsA[1])) {\n supports[supportCount++] = supportsA[1];\n }\n }\n\n // account for the edge case of overlapping but no vertex containment\n if (supportCount === 0) {\n supports[supportCount++] = supportsB[0];\n }\n\n // update supports array size\n supports.length = supportCount;\n\n return collision;\n };\n\n /**\n * Find the overlap between two sets of vertices.\n * @method _overlapAxes\n * @private\n * @param {object} result\n * @param {vertices} verticesA\n * @param {vertices} verticesB\n * @param {axes} axes\n */\n Collision._overlapAxes = function(result, verticesA, verticesB, axes) {\n var verticesALength = verticesA.length,\n verticesBLength = verticesB.length,\n verticesAX = verticesA[0].x,\n verticesAY = verticesA[0].y,\n verticesBX = verticesB[0].x,\n verticesBY = verticesB[0].y,\n axesLength = axes.length,\n overlapMin = Number.MAX_VALUE,\n overlapAxisNumber = 0,\n overlap,\n overlapAB,\n overlapBA,\n dot,\n i,\n j;\n\n for (i = 0; i < axesLength; i++) {\n var axis = axes[i],\n axisX = axis.x,\n axisY = axis.y,\n minA = verticesAX * axisX + verticesAY * axisY,\n minB = verticesBX * axisX + verticesBY * axisY,\n maxA = minA,\n maxB = minB;\n \n for (j = 1; j < verticesALength; j += 1) {\n dot = verticesA[j].x * axisX + verticesA[j].y * axisY;\n\n if (dot > maxA) { \n maxA = dot;\n } else if (dot < minA) { \n minA = dot;\n }\n }\n\n for (j = 1; j < verticesBLength; j += 1) {\n dot = verticesB[j].x * axisX + verticesB[j].y * axisY;\n\n if (dot > maxB) { \n maxB = dot;\n } else if (dot < minB) { \n minB = dot;\n }\n }\n\n overlapAB = maxA - minB;\n overlapBA = maxB - minA;\n overlap = overlapAB < overlapBA ? overlapAB : overlapBA;\n\n if (overlap < overlapMin) {\n overlapMin = overlap;\n overlapAxisNumber = i;\n\n if (overlap <= 0) {\n // can not be intersecting\n break;\n }\n } \n }\n\n result.axis = axes[overlapAxisNumber];\n result.overlap = overlapMin;\n };\n\n /**\n * Projects vertices on an axis and returns an interval.\n * @method _projectToAxis\n * @private\n * @param {} projection\n * @param {} vertices\n * @param {} axis\n */\n Collision._projectToAxis = function(projection, vertices, axis) {\n var min = vertices[0].x * axis.x + vertices[0].y * axis.y,\n max = min;\n\n for (var i = 1; i < vertices.length; i += 1) {\n var dot = vertices[i].x * axis.x + vertices[i].y * axis.y;\n\n if (dot > max) { \n max = dot; \n } else if (dot < min) { \n min = dot; \n }\n }\n\n projection.min = min;\n projection.max = max;\n };\n\n /**\n * Finds supporting vertices given two bodies along a given direction using hill-climbing.\n * @method _findSupports\n * @private\n * @param {body} bodyA\n * @param {body} bodyB\n * @param {vector} normal\n * @param {number} direction\n * @return [vector]\n */\n Collision._findSupports = function(bodyA, bodyB, normal, direction) {\n var vertices = bodyB.vertices,\n verticesLength = vertices.length,\n bodyAPositionX = bodyA.position.x,\n bodyAPositionY = bodyA.position.y,\n normalX = normal.x * direction,\n normalY = normal.y * direction,\n nearestDistance = Number.MAX_VALUE,\n vertexA,\n vertexB,\n vertexC,\n distance,\n j;\n\n // find deepest vertex relative to the axis\n for (j = 0; j < verticesLength; j += 1) {\n vertexB = vertices[j];\n distance = normalX * (bodyAPositionX - vertexB.x) + normalY * (bodyAPositionY - vertexB.y);\n\n // convex hill-climbing\n if (distance < nearestDistance) {\n nearestDistance = distance;\n vertexA = vertexB;\n }\n }\n\n // measure next vertex\n vertexC = vertices[(verticesLength + vertexA.index - 1) % verticesLength];\n nearestDistance = normalX * (bodyAPositionX - vertexC.x) + normalY * (bodyAPositionY - vertexC.y);\n\n // compare with previous vertex\n vertexB = vertices[(vertexA.index + 1) % verticesLength];\n if (normalX * (bodyAPositionX - vertexB.x) + normalY * (bodyAPositionY - vertexB.y) < nearestDistance) {\n _supports[0] = vertexA;\n _supports[1] = vertexB;\n\n return _supports;\n }\n\n _supports[0] = vertexA;\n _supports[1] = vertexC;\n\n return _supports;\n };\n\n /*\n *\n * Properties Documentation\n *\n */\n\n /**\n * A reference to the pair using this collision record, if there is one.\n *\n * @property pair\n * @type {pair|null}\n * @default null\n */\n\n /**\n * A flag that indicates if the bodies were colliding when the collision was last updated.\n * \n * @property collided\n * @type boolean\n * @default false\n */\n\n /**\n * The first body part represented by the collision (see also `collision.parentA`).\n * \n * @property bodyA\n * @type body\n */\n\n /**\n * The second body part represented by the collision (see also `collision.parentB`).\n * \n * @property bodyB\n * @type body\n */\n\n /**\n * The first body represented by the collision (i.e. `collision.bodyA.parent`).\n * \n * @property parentA\n * @type body\n */\n\n /**\n * The second body represented by the collision (i.e. `collision.bodyB.parent`).\n * \n * @property parentB\n * @type body\n */\n\n /**\n * A `Number` that represents the minimum separating distance between the bodies along the collision normal.\n *\n * @readOnly\n * @property depth\n * @type number\n * @default 0\n */\n\n /**\n * A normalised `Vector` that represents the direction between the bodies that provides the minimum separating distance.\n *\n * @property normal\n * @type vector\n * @default { x: 0, y: 0 }\n */\n\n /**\n * A normalised `Vector` that is the tangent direction to the collision normal.\n *\n * @property tangent\n * @type vector\n * @default { x: 0, y: 0 }\n */\n\n /**\n * A `Vector` that represents the direction and depth of the collision.\n *\n * @property penetration\n * @type vector\n * @default { x: 0, y: 0 }\n */\n\n /**\n * An array of body vertices that represent the support points in the collision.\n * These are the deepest vertices (along the collision normal) of each body that are contained by the other body's vertices.\n *\n * @property supports\n * @type vector[]\n * @default []\n */\n\n})();\n\n\n/***/ }),\n/* 9 */\n/***/ (function(module, exports, __webpack_require__) {\n\n/**\n* The `Matter.Pair` module contains methods for creating and manipulating collision pairs.\n*\n* @class Pair\n*/\n\nvar Pair = {};\n\nmodule.exports = Pair;\n\nvar Contact = __webpack_require__(17);\n\n(function() {\n \n /**\n * Creates a pair.\n * @method create\n * @param {collision} collision\n * @param {number} timestamp\n * @return {pair} A new pair\n */\n Pair.create = function(collision, timestamp) {\n var bodyA = collision.bodyA,\n bodyB = collision.bodyB;\n\n var pair = {\n id: Pair.id(bodyA, bodyB),\n bodyA: bodyA,\n bodyB: bodyB,\n collision: collision,\n contacts: [],\n activeContacts: [],\n separation: 0,\n isActive: true,\n confirmedActive: true,\n isSensor: bodyA.isSensor || bodyB.isSensor,\n timeCreated: timestamp,\n timeUpdated: timestamp,\n inverseMass: 0,\n friction: 0,\n frictionStatic: 0,\n restitution: 0,\n slop: 0\n };\n\n Pair.update(pair, collision, timestamp);\n\n return pair;\n };\n\n /**\n * Updates a pair given a collision.\n * @method update\n * @param {pair} pair\n * @param {collision} collision\n * @param {number} timestamp\n */\n Pair.update = function(pair, collision, timestamp) {\n var contacts = pair.contacts,\n supports = collision.supports,\n activeContacts = pair.activeContacts,\n parentA = collision.parentA,\n parentB = collision.parentB,\n parentAVerticesLength = parentA.vertices.length;\n \n pair.isActive = true;\n pair.timeUpdated = timestamp;\n pair.collision = collision;\n pair.separation = collision.depth;\n pair.inverseMass = parentA.inverseMass + parentB.inverseMass;\n pair.friction = parentA.friction < parentB.friction ? parentA.friction : parentB.friction;\n pair.frictionStatic = parentA.frictionStatic > parentB.frictionStatic ? parentA.frictionStatic : parentB.frictionStatic;\n pair.restitution = parentA.restitution > parentB.restitution ? parentA.restitution : parentB.restitution;\n pair.slop = parentA.slop > parentB.slop ? parentA.slop : parentB.slop;\n\n collision.pair = pair;\n activeContacts.length = 0;\n \n for (var i = 0; i < supports.length; i++) {\n var support = supports[i],\n contactId = support.body === parentA ? support.index : parentAVerticesLength + support.index,\n contact = contacts[contactId];\n\n if (contact) {\n activeContacts.push(contact);\n } else {\n activeContacts.push(contacts[contactId] = Contact.create(support));\n }\n }\n };\n \n /**\n * Set a pair as active or inactive.\n * @method setActive\n * @param {pair} pair\n * @param {bool} isActive\n * @param {number} timestamp\n */\n Pair.setActive = function(pair, isActive, timestamp) {\n if (isActive) {\n pair.isActive = true;\n pair.timeUpdated = timestamp;\n } else {\n pair.isActive = false;\n pair.activeContacts.length = 0;\n }\n };\n\n /**\n * Get the id for the given pair.\n * @method id\n * @param {body} bodyA\n * @param {body} bodyB\n * @return {string} Unique pairId\n */\n Pair.id = function(bodyA, bodyB) {\n if (bodyA.id < bodyB.id) {\n return 'A' + bodyA.id + 'B' + bodyB.id;\n } else {\n return 'A' + bodyB.id + 'B' + bodyA.id;\n }\n };\n\n})();\n\n\n/***/ }),\n/* 10 */\n/***/ (function(module, exports, __webpack_require__) {\n\n/**\n* The `Matter.Constraint` module contains methods for creating and manipulating constraints.\n* Constraints are used for specifying that a fixed distance must be maintained between two bodies (or a body and a fixed world-space position).\n* The stiffness of constraints can be modified to create springs or elastic.\n*\n* See the included usage [examples](https://github.com/liabru/matter-js/tree/master/examples).\n*\n* @class Constraint\n*/\n\nvar Constraint = {};\n\nmodule.exports = Constraint;\n\nvar Vertices = __webpack_require__(3);\nvar Vector = __webpack_require__(2);\nvar Sleeping = __webpack_require__(7);\nvar Bounds = __webpack_require__(1);\nvar Axes = __webpack_require__(11);\nvar Common = __webpack_require__(0);\n\n(function() {\n\n Constraint._warming = 0.4;\n Constraint._torqueDampen = 1;\n Constraint._minLength = 0.000001;\n\n /**\n * Creates a new constraint.\n * All properties have default values, and many are pre-calculated automatically based on other properties.\n * To simulate a revolute constraint (or pin joint) set `length: 0` and a high `stiffness` value (e.g. `0.7` or above).\n * If the constraint is unstable, try lowering the `stiffness` value and / or increasing `engine.constraintIterations`.\n * For compound bodies, constraints must be applied to the parent body (not one of its parts).\n * See the properties section below for detailed information on what you can pass via the `options` object.\n * @method create\n * @param {} options\n * @return {constraint} constraint\n */\n Constraint.create = function(options) {\n var constraint = options;\n\n // if bodies defined but no points, use body centre\n if (constraint.bodyA && !constraint.pointA)\n constraint.pointA = { x: 0, y: 0 };\n if (constraint.bodyB && !constraint.pointB)\n constraint.pointB = { x: 0, y: 0 };\n\n // calculate static length using initial world space points\n var initialPointA = constraint.bodyA ? Vector.add(constraint.bodyA.position, constraint.pointA) : constraint.pointA,\n initialPointB = constraint.bodyB ? Vector.add(constraint.bodyB.position, constraint.pointB) : constraint.pointB,\n length = Vector.magnitude(Vector.sub(initialPointA, initialPointB));\n \n constraint.length = typeof constraint.length !== 'undefined' ? constraint.length : length;\n\n // option defaults\n constraint.id = constraint.id || Common.nextId();\n constraint.label = constraint.label || 'Constraint';\n constraint.type = 'constraint';\n constraint.stiffness = constraint.stiffness || (constraint.length > 0 ? 1 : 0.7);\n constraint.damping = constraint.damping || 0;\n constraint.angularStiffness = constraint.angularStiffness || 0;\n constraint.angleA = constraint.bodyA ? constraint.bodyA.angle : constraint.angleA;\n constraint.angleB = constraint.bodyB ? constraint.bodyB.angle : constraint.angleB;\n constraint.plugin = {};\n\n // render\n var render = {\n visible: true,\n lineWidth: 2,\n strokeStyle: '#ffffff',\n type: 'line',\n anchors: true\n };\n\n if (constraint.length === 0 && constraint.stiffness > 0.1) {\n render.type = 'pin';\n render.anchors = false;\n } else if (constraint.stiffness < 0.9) {\n render.type = 'spring';\n }\n\n constraint.render = Common.extend(render, constraint.render);\n\n return constraint;\n };\n\n /**\n * Prepares for solving by constraint warming.\n * @private\n * @method preSolveAll\n * @param {body[]} bodies\n */\n Constraint.preSolveAll = function(bodies) {\n for (var i = 0; i < bodies.length; i += 1) {\n var body = bodies[i],\n impulse = body.constraintImpulse;\n\n if (body.isStatic || (impulse.x === 0 && impulse.y === 0 && impulse.angle === 0)) {\n continue;\n }\n\n body.position.x += impulse.x;\n body.position.y += impulse.y;\n body.angle += impulse.angle;\n }\n };\n\n /**\n * Solves all constraints in a list of collisions.\n * @private\n * @method solveAll\n * @param {constraint[]} constraints\n * @param {number} timeScale\n */\n Constraint.solveAll = function(constraints, timeScale) {\n // Solve fixed constraints first.\n for (var i = 0; i < constraints.length; i += 1) {\n var constraint = constraints[i],\n fixedA = !constraint.bodyA || (constraint.bodyA && constraint.bodyA.isStatic),\n fixedB = !constraint.bodyB || (constraint.bodyB && constraint.bodyB.isStatic);\n\n if (fixedA || fixedB) {\n Constraint.solve(constraints[i], timeScale);\n }\n }\n\n // Solve free constraints last.\n for (i = 0; i < constraints.length; i += 1) {\n constraint = constraints[i];\n fixedA = !constraint.bodyA || (constraint.bodyA && constraint.bodyA.isStatic);\n fixedB = !constraint.bodyB || (constraint.bodyB && constraint.bodyB.isStatic);\n\n if (!fixedA && !fixedB) {\n Constraint.solve(constraints[i], timeScale);\n }\n }\n };\n\n /**\n * Solves a distance constraint with Gauss-Siedel method.\n * @private\n * @method solve\n * @param {constraint} constraint\n * @param {number} timeScale\n */\n Constraint.solve = function(constraint, timeScale) {\n var bodyA = constraint.bodyA,\n bodyB = constraint.bodyB,\n pointA = constraint.pointA,\n pointB = constraint.pointB;\n\n if (!bodyA && !bodyB)\n return;\n\n // update reference angle\n if (bodyA && !bodyA.isStatic) {\n Vector.rotate(pointA, bodyA.angle - constraint.angleA, pointA);\n constraint.angleA = bodyA.angle;\n }\n \n // update reference angle\n if (bodyB && !bodyB.isStatic) {\n Vector.rotate(pointB, bodyB.angle - constraint.angleB, pointB);\n constraint.angleB = bodyB.angle;\n }\n\n var pointAWorld = pointA,\n pointBWorld = pointB;\n\n if (bodyA) pointAWorld = Vector.add(bodyA.position, pointA);\n if (bodyB) pointBWorld = Vector.add(bodyB.position, pointB);\n\n if (!pointAWorld || !pointBWorld)\n return;\n\n var delta = Vector.sub(pointAWorld, pointBWorld),\n currentLength = Vector.magnitude(delta);\n\n // prevent singularity\n if (currentLength < Constraint._minLength) {\n currentLength = Constraint._minLength;\n }\n\n // solve distance constraint with Gauss-Siedel method\n var difference = (currentLength - constraint.length) / currentLength,\n stiffness = constraint.stiffness < 1 ? constraint.stiffness * timeScale : constraint.stiffness,\n force = Vector.mult(delta, difference * stiffness),\n massTotal = (bodyA ? bodyA.inverseMass : 0) + (bodyB ? bodyB.inverseMass : 0),\n inertiaTotal = (bodyA ? bodyA.inverseInertia : 0) + (bodyB ? bodyB.inverseInertia : 0),\n resistanceTotal = massTotal + inertiaTotal,\n torque,\n share,\n normal,\n normalVelocity,\n relativeVelocity;\n\n if (constraint.damping) {\n var zero = Vector.create();\n normal = Vector.div(delta, currentLength);\n\n relativeVelocity = Vector.sub(\n bodyB && Vector.sub(bodyB.position, bodyB.positionPrev) || zero,\n bodyA && Vector.sub(bodyA.position, bodyA.positionPrev) || zero\n );\n\n normalVelocity = Vector.dot(normal, relativeVelocity);\n }\n\n if (bodyA && !bodyA.isStatic) {\n share = bodyA.inverseMass / massTotal;\n\n // keep track of applied impulses for post solving\n bodyA.constraintImpulse.x -= force.x * share;\n bodyA.constraintImpulse.y -= force.y * share;\n\n // apply forces\n bodyA.position.x -= force.x * share;\n bodyA.position.y -= force.y * share;\n\n // apply damping\n if (constraint.damping) {\n bodyA.positionPrev.x -= constraint.damping * normal.x * normalVelocity * share;\n bodyA.positionPrev.y -= constraint.damping * normal.y * normalVelocity * share;\n }\n\n // apply torque\n torque = (Vector.cross(pointA, force) / resistanceTotal) * Constraint._torqueDampen * bodyA.inverseInertia * (1 - constraint.angularStiffness);\n bodyA.constraintImpulse.angle -= torque;\n bodyA.angle -= torque;\n }\n\n if (bodyB && !bodyB.isStatic) {\n share = bodyB.inverseMass / massTotal;\n\n // keep track of applied impulses for post solving\n bodyB.constraintImpulse.x += force.x * share;\n bodyB.constraintImpulse.y += force.y * share;\n \n // apply forces\n bodyB.position.x += force.x * share;\n bodyB.position.y += force.y * share;\n\n // apply damping\n if (constraint.damping) {\n bodyB.positionPrev.x += constraint.damping * normal.x * normalVelocity * share;\n bodyB.positionPrev.y += constraint.damping * normal.y * normalVelocity * share;\n }\n\n // apply torque\n torque = (Vector.cross(pointB, force) / resistanceTotal) * Constraint._torqueDampen * bodyB.inverseInertia * (1 - constraint.angularStiffness);\n bodyB.constraintImpulse.angle += torque;\n bodyB.angle += torque;\n }\n\n };\n\n /**\n * Performs body updates required after solving constraints.\n * @private\n * @method postSolveAll\n * @param {body[]} bodies\n */\n Constraint.postSolveAll = function(bodies) {\n for (var i = 0; i < bodies.length; i++) {\n var body = bodies[i],\n impulse = body.constraintImpulse;\n\n if (body.isStatic || (impulse.x === 0 && impulse.y === 0 && impulse.angle === 0)) {\n continue;\n }\n\n Sleeping.set(body, false);\n\n // update geometry and reset\n for (var j = 0; j < body.parts.length; j++) {\n var part = body.parts[j];\n \n Vertices.translate(part.vertices, impulse);\n\n if (j > 0) {\n part.position.x += impulse.x;\n part.position.y += impulse.y;\n }\n\n if (impulse.angle !== 0) {\n Vertices.rotate(part.vertices, impulse.angle, body.position);\n Axes.rotate(part.axes, impulse.angle);\n if (j > 0) {\n Vector.rotateAbout(part.position, impulse.angle, body.position, part.position);\n }\n }\n\n Bounds.update(part.bounds, part.vertices, body.velocity);\n }\n\n // dampen the cached impulse for warming next step\n impulse.angle *= Constraint._warming;\n impulse.x *= Constraint._warming;\n impulse.y *= Constraint._warming;\n }\n };\n\n /**\n * Returns the world-space position of `constraint.pointA`, accounting for `constraint.bodyA`.\n * @method pointAWorld\n * @param {constraint} constraint\n * @returns {vector} the world-space position\n */\n Constraint.pointAWorld = function(constraint) {\n return {\n x: (constraint.bodyA ? constraint.bodyA.position.x : 0) + constraint.pointA.x,\n y: (constraint.bodyA ? constraint.bodyA.position.y : 0) + constraint.pointA.y\n };\n };\n\n /**\n * Returns the world-space position of `constraint.pointB`, accounting for `constraint.bodyB`.\n * @method pointBWorld\n * @param {constraint} constraint\n * @returns {vector} the world-space position\n */\n Constraint.pointBWorld = function(constraint) {\n return {\n x: (constraint.bodyB ? constraint.bodyB.position.x : 0) + constraint.pointB.x,\n y: (constraint.bodyB ? constraint.bodyB.position.y : 0) + constraint.pointB.y\n };\n };\n\n /*\n *\n * Properties Documentation\n *\n */\n\n /**\n * An integer `Number` uniquely identifying number generated in `Composite.create` by `Common.nextId`.\n *\n * @property id\n * @type number\n */\n\n /**\n * A `String` denoting the type of object.\n *\n * @property type\n * @type string\n * @default \"constraint\"\n * @readOnly\n */\n\n /**\n * An arbitrary `String` name to help the user identify and manage bodies.\n *\n * @property label\n * @type string\n * @default \"Constraint\"\n */\n\n /**\n * An `Object` that defines the rendering properties to be consumed by the module `Matter.Render`.\n *\n * @property render\n * @type object\n */\n\n /**\n * A flag that indicates if the constraint should be rendered.\n *\n * @property render.visible\n * @type boolean\n * @default true\n */\n\n /**\n * A `Number` that defines the line width to use when rendering the constraint outline.\n * A value of `0` means no outline will be rendered.\n *\n * @property render.lineWidth\n * @type number\n * @default 2\n */\n\n /**\n * A `String` that defines the stroke style to use when rendering the constraint outline.\n * It is the same as when using a canvas, so it accepts CSS style property values.\n *\n * @property render.strokeStyle\n * @type string\n * @default a random colour\n */\n\n /**\n * A `String` that defines the constraint rendering type. \n * The possible values are 'line', 'pin', 'spring'.\n * An appropriate render type will be automatically chosen unless one is given in options.\n *\n * @property render.type\n * @type string\n * @default 'line'\n */\n\n /**\n * A `Boolean` that defines if the constraint's anchor points should be rendered.\n *\n * @property render.anchors\n * @type boolean\n * @default true\n */\n\n /**\n * The first possible `Body` that this constraint is attached to.\n *\n * @property bodyA\n * @type body\n * @default null\n */\n\n /**\n * The second possible `Body` that this constraint is attached to.\n *\n * @property bodyB\n * @type body\n * @default null\n */\n\n /**\n * A `Vector` that specifies the offset of the constraint from center of the `constraint.bodyA` if defined, otherwise a world-space position.\n *\n * @property pointA\n * @type vector\n * @default { x: 0, y: 0 }\n */\n\n /**\n * A `Vector` that specifies the offset of the constraint from center of the `constraint.bodyB` if defined, otherwise a world-space position.\n *\n * @property pointB\n * @type vector\n * @default { x: 0, y: 0 }\n */\n\n /**\n * A `Number` that specifies the stiffness of the constraint, i.e. the rate at which it returns to its resting `constraint.length`.\n * A value of `1` means the constraint should be very stiff.\n * A value of `0.2` means the constraint acts like a soft spring.\n *\n * @property stiffness\n * @type number\n * @default 1\n */\n\n /**\n * A `Number` that specifies the damping of the constraint, \n * i.e. the amount of resistance applied to each body based on their velocities to limit the amount of oscillation.\n * Damping will only be apparent when the constraint also has a very low `stiffness`.\n * A value of `0.1` means the constraint will apply heavy damping, resulting in little to no oscillation.\n * A value of `0` means the constraint will apply no damping.\n *\n * @property damping\n * @type number\n * @default 0\n */\n\n /**\n * A `Number` that specifies the target resting length of the constraint. \n * It is calculated automatically in `Constraint.create` from initial positions of the `constraint.bodyA` and `constraint.bodyB`.\n *\n * @property length\n * @type number\n */\n\n /**\n * An object reserved for storing plugin-specific properties.\n *\n * @property plugin\n * @type {}\n */\n\n})();\n\n\n/***/ }),\n/* 11 */\n/***/ (function(module, exports, __webpack_require__) {\n\n/**\n* The `Matter.Axes` module contains methods for creating and manipulating sets of axes.\n*\n* @class Axes\n*/\n\nvar Axes = {};\n\nmodule.exports = Axes;\n\nvar Vector = __webpack_require__(2);\nvar Common = __webpack_require__(0);\n\n(function() {\n\n /**\n * Creates a new set of axes from the given vertices.\n * @method fromVertices\n * @param {vertices} vertices\n * @return {axes} A new axes from the given vertices\n */\n Axes.fromVertices = function(vertices) {\n var axes = {};\n\n // find the unique axes, using edge normal gradients\n for (var i = 0; i < vertices.length; i++) {\n var j = (i + 1) % vertices.length, \n normal = Vector.normalise({ \n x: vertices[j].y - vertices[i].y, \n y: vertices[i].x - vertices[j].x\n }),\n gradient = (normal.y === 0) ? Infinity : (normal.x / normal.y);\n \n // limit precision\n gradient = gradient.toFixed(3).toString();\n axes[gradient] = normal;\n }\n\n return Common.values(axes);\n };\n\n /**\n * Rotates a set of axes by the given angle.\n * @method rotate\n * @param {axes} axes\n * @param {number} angle\n */\n Axes.rotate = function(axes, angle) {\n if (angle === 0)\n return;\n \n var cos = Math.cos(angle),\n sin = Math.sin(angle);\n\n for (var i = 0; i < axes.length; i++) {\n var axis = axes[i],\n xx;\n xx = axis.x * cos - axis.y * sin;\n axis.y = axis.x * sin + axis.y * cos;\n axis.x = xx;\n }\n };\n\n})();\n\n\n/***/ }),\n/* 12 */\n/***/ (function(module, exports, __webpack_require__) {\n\n/**\n* The `Matter.Bodies` module contains factory methods for creating rigid body models \n* with commonly used body configurations (such as rectangles, circles and other polygons).\n*\n* See the included usage [examples](https://github.com/liabru/matter-js/tree/master/examples).\n*\n* @class Bodies\n*/\n\n// TODO: true circle bodies\n\nvar Bodies = {};\n\nmodule.exports = Bodies;\n\nvar Vertices = __webpack_require__(3);\nvar Common = __webpack_require__(0);\nvar Body = __webpack_require__(6);\nvar Bounds = __webpack_require__(1);\nvar Vector = __webpack_require__(2);\n\n(function() {\n\n /**\n * Creates a new rigid body model with a rectangle hull. \n * The options parameter is an object that specifies any properties you wish to override the defaults.\n * See the properties section of the `Matter.Body` module for detailed information on what you can pass via the `options` object.\n * @method rectangle\n * @param {number} x\n * @param {number} y\n * @param {number} width\n * @param {number} height\n * @param {object} [options]\n * @return {body} A new rectangle body\n */\n Bodies.rectangle = function(x, y, width, height, options) {\n options = options || {};\n\n var rectangle = { \n label: 'Rectangle Body',\n position: { x: x, y: y },\n vertices: Vertices.fromPath('L 0 0 L ' + width + ' 0 L ' + width + ' ' + height + ' L 0 ' + height)\n };\n\n if (options.chamfer) {\n var chamfer = options.chamfer;\n rectangle.vertices = Vertices.chamfer(rectangle.vertices, chamfer.radius, \n chamfer.quality, chamfer.qualityMin, chamfer.qualityMax);\n delete options.chamfer;\n }\n\n return Body.create(Common.extend({}, rectangle, options));\n };\n \n /**\n * Creates a new rigid body model with a trapezoid hull. \n * The options parameter is an object that specifies any properties you wish to override the defaults.\n * See the properties section of the `Matter.Body` module for detailed information on what you can pass via the `options` object.\n * @method trapezoid\n * @param {number} x\n * @param {number} y\n * @param {number} width\n * @param {number} height\n * @param {number} slope\n * @param {object} [options]\n * @return {body} A new trapezoid body\n */\n Bodies.trapezoid = function(x, y, width, height, slope, options) {\n options = options || {};\n\n slope *= 0.5;\n var roof = (1 - (slope * 2)) * width;\n \n var x1 = width * slope,\n x2 = x1 + roof,\n x3 = x2 + x1,\n verticesPath;\n\n if (slope < 0.5) {\n verticesPath = 'L 0 0 L ' + x1 + ' ' + (-height) + ' L ' + x2 + ' ' + (-height) + ' L ' + x3 + ' 0';\n } else {\n verticesPath = 'L 0 0 L ' + x2 + ' ' + (-height) + ' L ' + x3 + ' 0';\n }\n\n var trapezoid = { \n label: 'Trapezoid Body',\n position: { x: x, y: y },\n vertices: Vertices.fromPath(verticesPath)\n };\n\n if (options.chamfer) {\n var chamfer = options.chamfer;\n trapezoid.vertices = Vertices.chamfer(trapezoid.vertices, chamfer.radius, \n chamfer.quality, chamfer.qualityMin, chamfer.qualityMax);\n delete options.chamfer;\n }\n\n return Body.create(Common.extend({}, trapezoid, options));\n };\n\n /**\n * Creates a new rigid body model with a circle hull. \n * The options parameter is an object that specifies any properties you wish to override the defaults.\n * See the properties section of the `Matter.Body` module for detailed information on what you can pass via the `options` object.\n * @method circle\n * @param {number} x\n * @param {number} y\n * @param {number} radius\n * @param {object} [options]\n * @param {number} [maxSides]\n * @return {body} A new circle body\n */\n Bodies.circle = function(x, y, radius, options, maxSides) {\n options = options || {};\n\n var circle = {\n label: 'Circle Body',\n circleRadius: radius\n };\n \n // approximate circles with polygons until true circles implemented in SAT\n maxSides = maxSides || 25;\n var sides = Math.ceil(Math.max(10, Math.min(maxSides, radius)));\n\n // optimisation: always use even number of sides (half the number of unique axes)\n if (sides % 2 === 1)\n sides += 1;\n\n return Bodies.polygon(x, y, sides, radius, Common.extend({}, circle, options));\n };\n\n /**\n * Creates a new rigid body model with a regular polygon hull with the given number of sides. \n * The options parameter is an object that specifies any properties you wish to override the defaults.\n * See the properties section of the `Matter.Body` module for detailed information on what you can pass via the `options` object.\n * @method polygon\n * @param {number} x\n * @param {number} y\n * @param {number} sides\n * @param {number} radius\n * @param {object} [options]\n * @return {body} A new regular polygon body\n */\n Bodies.polygon = function(x, y, sides, radius, options) {\n options = options || {};\n\n if (sides < 3)\n return Bodies.circle(x, y, radius, options);\n\n var theta = 2 * Math.PI / sides,\n path = '',\n offset = theta * 0.5;\n\n for (var i = 0; i < sides; i += 1) {\n var angle = offset + (i * theta),\n xx = Math.cos(angle) * radius,\n yy = Math.sin(angle) * radius;\n\n path += 'L ' + xx.toFixed(3) + ' ' + yy.toFixed(3) + ' ';\n }\n\n var polygon = { \n label: 'Polygon Body',\n position: { x: x, y: y },\n vertices: Vertices.fromPath(path)\n };\n\n if (options.chamfer) {\n var chamfer = options.chamfer;\n polygon.vertices = Vertices.chamfer(polygon.vertices, chamfer.radius, \n chamfer.quality, chamfer.qualityMin, chamfer.qualityMax);\n delete options.chamfer;\n }\n\n return Body.create(Common.extend({}, polygon, options));\n };\n\n /**\n * Utility to create a compound body based on set(s) of vertices.\n * \n * _Note:_ To optionally enable automatic concave vertices decomposition the [poly-decomp](https://github.com/schteppe/poly-decomp.js) \n * package must be first installed and provided see `Common.setDecomp`, otherwise the convex hull of each vertex set will be used.\n * \n * The resulting vertices are reorientated about their centre of mass,\n * and offset such that `body.position` corresponds to this point.\n * \n * The resulting offset may be found if needed by subtracting `body.bounds` from the original input bounds.\n * To later move the centre of mass see `Body.setCentre`.\n * \n * Note that automatic conconcave decomposition results are not always optimal. \n * For best results, simplify the input vertices as much as possible first.\n * By default this function applies some addtional simplification to help.\n * \n * Some outputs may also require further manual processing afterwards to be robust.\n * In particular some parts may need to be overlapped to avoid collision gaps.\n * Thin parts and sharp points should be avoided or removed where possible.\n *\n * The options parameter object specifies any `Matter.Body` properties you wish to override the defaults.\n * \n * See the properties section of the `Matter.Body` module for detailed information on what you can pass via the `options` object.\n * @method fromVertices\n * @param {number} x\n * @param {number} y\n * @param {array} vertexSets One or more arrays of vertex points e.g. `[[{ x: 0, y: 0 }...], ...]`.\n * @param {object} [options] The body options.\n * @param {bool} [flagInternal=false] Optionally marks internal edges with `isInternal`.\n * @param {number} [removeCollinear=0.01] Threshold when simplifying vertices along the same edge.\n * @param {number} [minimumArea=10] Threshold when removing small parts.\n * @param {number} [removeDuplicatePoints=0.01] Threshold when simplifying nearby vertices.\n * @return {body}\n */\n Bodies.fromVertices = function(x, y, vertexSets, options, flagInternal, removeCollinear, minimumArea, removeDuplicatePoints) {\n var decomp = Common.getDecomp(),\n canDecomp,\n body,\n parts,\n isConvex,\n isConcave,\n vertices,\n i,\n j,\n k,\n v,\n z;\n\n // check decomp is as expected\n canDecomp = Boolean(decomp && decomp.quickDecomp);\n\n options = options || {};\n parts = [];\n\n flagInternal = typeof flagInternal !== 'undefined' ? flagInternal : false;\n removeCollinear = typeof removeCollinear !== 'undefined' ? removeCollinear : 0.01;\n minimumArea = typeof minimumArea !== 'undefined' ? minimumArea : 10;\n removeDuplicatePoints = typeof removeDuplicatePoints !== 'undefined' ? removeDuplicatePoints : 0.01;\n\n // ensure vertexSets is an array of arrays\n if (!Common.isArray(vertexSets[0])) {\n vertexSets = [vertexSets];\n }\n\n for (v = 0; v < vertexSets.length; v += 1) {\n vertices = vertexSets[v];\n isConvex = Vertices.isConvex(vertices);\n isConcave = !isConvex;\n\n if (isConcave && !canDecomp) {\n Common.warnOnce(\n 'Bodies.fromVertices: Install the \\'poly-decomp\\' library and use Common.setDecomp or provide \\'decomp\\' as a global to decompose concave vertices.'\n );\n }\n\n if (isConvex || !canDecomp) {\n if (isConvex) {\n vertices = Vertices.clockwiseSort(vertices);\n } else {\n // fallback to convex hull when decomposition is not possible\n vertices = Vertices.hull(vertices);\n }\n\n parts.push({\n position: { x: x, y: y },\n vertices: vertices\n });\n } else {\n // initialise a decomposition\n var concave = vertices.map(function(vertex) {\n return [vertex.x, vertex.y];\n });\n\n // vertices are concave and simple, we can decompose into parts\n decomp.makeCCW(concave);\n if (removeCollinear !== false)\n decomp.removeCollinearPoints(concave, removeCollinear);\n if (removeDuplicatePoints !== false && decomp.removeDuplicatePoints)\n decomp.removeDuplicatePoints(concave, removeDuplicatePoints);\n\n // use the quick decomposition algorithm (Bayazit)\n var decomposed = decomp.quickDecomp(concave);\n\n // for each decomposed chunk\n for (i = 0; i < decomposed.length; i++) {\n var chunk = decomposed[i];\n\n // convert vertices into the correct structure\n var chunkVertices = chunk.map(function(vertices) {\n return {\n x: vertices[0],\n y: vertices[1]\n };\n });\n\n // skip small chunks\n if (minimumArea > 0 && Vertices.area(chunkVertices) < minimumArea)\n continue;\n\n // create a compound part\n parts.push({\n position: Vertices.centre(chunkVertices),\n vertices: chunkVertices\n });\n }\n }\n }\n\n // create body parts\n for (i = 0; i < parts.length; i++) {\n parts[i] = Body.create(Common.extend(parts[i], options));\n }\n\n // flag internal edges (coincident part edges)\n if (flagInternal) {\n var coincident_max_dist = 5;\n\n for (i = 0; i < parts.length; i++) {\n var partA = parts[i];\n\n for (j = i + 1; j < parts.length; j++) {\n var partB = parts[j];\n\n if (Bounds.overlaps(partA.bounds, partB.bounds)) {\n var pav = partA.vertices,\n pbv = partB.vertices;\n\n // iterate vertices of both parts\n for (k = 0; k < partA.vertices.length; k++) {\n for (z = 0; z < partB.vertices.length; z++) {\n // find distances between the vertices\n var da = Vector.magnitudeSquared(Vector.sub(pav[(k + 1) % pav.length], pbv[z])),\n db = Vector.magnitudeSquared(Vector.sub(pav[k], pbv[(z + 1) % pbv.length]));\n\n // if both vertices are very close, consider the edge concident (internal)\n if (da < coincident_max_dist && db < coincident_max_dist) {\n pav[k].isInternal = true;\n pbv[z].isInternal = true;\n }\n }\n }\n\n }\n }\n }\n }\n\n if (parts.length > 1) {\n // create the parent body to be returned, that contains generated compound parts\n body = Body.create(Common.extend({ parts: parts.slice(0) }, options));\n\n // offset such that body.position is at the centre off mass\n Body.setPosition(body, { x: x, y: y });\n\n return body;\n } else {\n return parts[0];\n }\n };\n\n})();\n\n\n/***/ }),\n/* 13 */\n/***/ (function(module, exports, __webpack_require__) {\n\n/**\n* The `Matter.Mouse` module contains methods for creating and manipulating mouse inputs.\n*\n* @class Mouse\n*/\n\nvar Mouse = {};\n\nmodule.exports = Mouse;\n\nvar Common = __webpack_require__(0);\n\n(function() {\n\n /**\n * Creates a mouse input.\n * @method create\n * @param {HTMLElement} element\n * @return {mouse} A new mouse\n */\n Mouse.create = function(element) {\n var mouse = {};\n\n if (!element) {\n Common.log('Mouse.create: element was undefined, defaulting to document.body', 'warn');\n }\n \n mouse.element = element || document.body;\n mouse.absolute = { x: 0, y: 0 };\n mouse.position = { x: 0, y: 0 };\n mouse.mousedownPosition = { x: 0, y: 0 };\n mouse.mouseupPosition = { x: 0, y: 0 };\n mouse.offset = { x: 0, y: 0 };\n mouse.scale = { x: 1, y: 1 };\n mouse.wheelDelta = 0;\n mouse.button = -1;\n mouse.pixelRatio = parseInt(mouse.element.getAttribute('data-pixel-ratio'), 10) || 1;\n\n mouse.sourceEvents = {\n mousemove: null,\n mousedown: null,\n mouseup: null,\n mousewheel: null\n };\n \n mouse.mousemove = function(event) { \n var position = Mouse._getRelativeMousePosition(event, mouse.element, mouse.pixelRatio),\n touches = event.changedTouches;\n\n if (touches) {\n mouse.button = 0;\n event.preventDefault();\n }\n\n mouse.absolute.x = position.x;\n mouse.absolute.y = position.y;\n mouse.position.x = mouse.absolute.x * mouse.scale.x + mouse.offset.x;\n mouse.position.y = mouse.absolute.y * mouse.scale.y + mouse.offset.y;\n mouse.sourceEvents.mousemove = event;\n };\n \n mouse.mousedown = function(event) {\n var position = Mouse._getRelativeMousePosition(event, mouse.element, mouse.pixelRatio),\n touches = event.changedTouches;\n\n if (touches) {\n mouse.button = 0;\n event.preventDefault();\n } else {\n mouse.button = event.button;\n }\n\n mouse.absolute.x = position.x;\n mouse.absolute.y = position.y;\n mouse.position.x = mouse.absolute.x * mouse.scale.x + mouse.offset.x;\n mouse.position.y = mouse.absolute.y * mouse.scale.y + mouse.offset.y;\n mouse.mousedownPosition.x = mouse.position.x;\n mouse.mousedownPosition.y = mouse.position.y;\n mouse.sourceEvents.mousedown = event;\n };\n \n mouse.mouseup = function(event) {\n var position = Mouse._getRelativeMousePosition(event, mouse.element, mouse.pixelRatio),\n touches = event.changedTouches;\n\n if (touches) {\n event.preventDefault();\n }\n \n mouse.button = -1;\n mouse.absolute.x = position.x;\n mouse.absolute.y = position.y;\n mouse.position.x = mouse.absolute.x * mouse.scale.x + mouse.offset.x;\n mouse.position.y = mouse.absolute.y * mouse.scale.y + mouse.offset.y;\n mouse.mouseupPosition.x = mouse.position.x;\n mouse.mouseupPosition.y = mouse.position.y;\n mouse.sourceEvents.mouseup = event;\n };\n\n mouse.mousewheel = function(event) {\n mouse.wheelDelta = Math.max(-1, Math.min(1, event.wheelDelta || -event.detail));\n event.preventDefault();\n };\n\n Mouse.setElement(mouse, mouse.element);\n\n return mouse;\n };\n\n /**\n * Sets the element the mouse is bound to (and relative to).\n * @method setElement\n * @param {mouse} mouse\n * @param {HTMLElement} element\n */\n Mouse.setElement = function(mouse, element) {\n mouse.element = element;\n\n element.addEventListener('mousemove', mouse.mousemove);\n element.addEventListener('mousedown', mouse.mousedown);\n element.addEventListener('mouseup', mouse.mouseup);\n \n element.addEventListener('mousewheel', mouse.mousewheel);\n element.addEventListener('DOMMouseScroll', mouse.mousewheel);\n\n element.addEventListener('touchmove', mouse.mousemove);\n element.addEventListener('touchstart', mouse.mousedown);\n element.addEventListener('touchend', mouse.mouseup);\n };\n\n /**\n * Clears all captured source events.\n * @method clearSourceEvents\n * @param {mouse} mouse\n */\n Mouse.clearSourceEvents = function(mouse) {\n mouse.sourceEvents.mousemove = null;\n mouse.sourceEvents.mousedown = null;\n mouse.sourceEvents.mouseup = null;\n mouse.sourceEvents.mousewheel = null;\n mouse.wheelDelta = 0;\n };\n\n /**\n * Sets the mouse position offset.\n * @method setOffset\n * @param {mouse} mouse\n * @param {vector} offset\n */\n Mouse.setOffset = function(mouse, offset) {\n mouse.offset.x = offset.x;\n mouse.offset.y = offset.y;\n mouse.position.x = mouse.absolute.x * mouse.scale.x + mouse.offset.x;\n mouse.position.y = mouse.absolute.y * mouse.scale.y + mouse.offset.y;\n };\n\n /**\n * Sets the mouse position scale.\n * @method setScale\n * @param {mouse} mouse\n * @param {vector} scale\n */\n Mouse.setScale = function(mouse, scale) {\n mouse.scale.x = scale.x;\n mouse.scale.y = scale.y;\n mouse.position.x = mouse.absolute.x * mouse.scale.x + mouse.offset.x;\n mouse.position.y = mouse.absolute.y * mouse.scale.y + mouse.offset.y;\n };\n \n /**\n * Gets the mouse position relative to an element given a screen pixel ratio.\n * @method _getRelativeMousePosition\n * @private\n * @param {} event\n * @param {} element\n * @param {number} pixelRatio\n * @return {}\n */\n Mouse._getRelativeMousePosition = function(event, element, pixelRatio) {\n var elementBounds = element.getBoundingClientRect(),\n rootNode = (document.documentElement || document.body.parentNode || document.body),\n scrollX = (window.pageXOffset !== undefined) ? window.pageXOffset : rootNode.scrollLeft,\n scrollY = (window.pageYOffset !== undefined) ? window.pageYOffset : rootNode.scrollTop,\n touches = event.changedTouches,\n x, y;\n \n if (touches) {\n x = touches[0].pageX - elementBounds.left - scrollX;\n y = touches[0].pageY - elementBounds.top - scrollY;\n } else {\n x = event.pageX - elementBounds.left - scrollX;\n y = event.pageY - elementBounds.top - scrollY;\n }\n\n return { \n x: x / (element.clientWidth / (element.width || element.clientWidth) * pixelRatio),\n y: y / (element.clientHeight / (element.height || element.clientHeight) * pixelRatio)\n };\n };\n\n})();\n\n\n/***/ }),\n/* 14 */\n/***/ (function(module, exports, __webpack_require__) {\n\n/**\n* The `Matter.Detector` module contains methods for efficiently detecting collisions between a list of bodies using a broadphase algorithm.\n*\n* @class Detector\n*/\n\nvar Detector = {};\n\nmodule.exports = Detector;\n\nvar Common = __webpack_require__(0);\nvar Collision = __webpack_require__(8);\n\n(function() {\n\n /**\n * Creates a new collision detector.\n * @method create\n * @param {} options\n * @return {detector} A new collision detector\n */\n Detector.create = function(options) {\n var defaults = {\n bodies: [],\n pairs: null\n };\n\n return Common.extend(defaults, options);\n };\n\n /**\n * Sets the list of bodies in the detector.\n * @method setBodies\n * @param {detector} detector\n * @param {body[]} bodies\n */\n Detector.setBodies = function(detector, bodies) {\n detector.bodies = bodies.slice(0);\n };\n\n /**\n * Clears the detector including its list of bodies.\n * @method clear\n * @param {detector} detector\n */\n Detector.clear = function(detector) {\n detector.bodies = [];\n };\n\n /**\n * Efficiently finds all collisions among all the bodies in `detector.bodies` using a broadphase algorithm.\n * \n * _Note:_ The specific ordering of collisions returned is not guaranteed between releases and may change for performance reasons.\n * If a specific ordering is required then apply a sort to the resulting array.\n * @method collisions\n * @param {detector} detector\n * @return {collision[]} collisions\n */\n Detector.collisions = function(detector) {\n var collisions = [],\n pairs = detector.pairs,\n bodies = detector.bodies,\n bodiesLength = bodies.length,\n canCollide = Detector.canCollide,\n collides = Collision.collides,\n i,\n j;\n\n bodies.sort(Detector._compareBoundsX);\n\n for (i = 0; i < bodiesLength; i++) {\n var bodyA = bodies[i],\n boundsA = bodyA.bounds,\n boundXMax = bodyA.bounds.max.x,\n boundYMax = bodyA.bounds.max.y,\n boundYMin = bodyA.bounds.min.y,\n bodyAStatic = bodyA.isStatic || bodyA.isSleeping,\n partsALength = bodyA.parts.length,\n partsASingle = partsALength === 1;\n\n for (j = i + 1; j < bodiesLength; j++) {\n var bodyB = bodies[j],\n boundsB = bodyB.bounds;\n\n if (boundsB.min.x > boundXMax) {\n break;\n }\n\n if (boundYMax < boundsB.min.y || boundYMin > boundsB.max.y) {\n continue;\n }\n\n if (bodyAStatic && (bodyB.isStatic || bodyB.isSleeping)) {\n continue;\n }\n\n if (!canCollide(bodyA.collisionFilter, bodyB.collisionFilter)) {\n continue;\n }\n\n var partsBLength = bodyB.parts.length;\n\n if (partsASingle && partsBLength === 1) {\n var collision = collides(bodyA, bodyB, pairs);\n\n if (collision) {\n collisions.push(collision);\n }\n } else {\n var partsAStart = partsALength > 1 ? 1 : 0,\n partsBStart = partsBLength > 1 ? 1 : 0;\n \n for (var k = partsAStart; k < partsALength; k++) {\n var partA = bodyA.parts[k],\n boundsA = partA.bounds;\n\n for (var z = partsBStart; z < partsBLength; z++) {\n var partB = bodyB.parts[z],\n boundsB = partB.bounds;\n\n if (boundsA.min.x > boundsB.max.x || boundsA.max.x < boundsB.min.x\n || boundsA.max.y < boundsB.min.y || boundsA.min.y > boundsB.max.y) {\n continue;\n }\n\n var collision = collides(partA, partB, pairs);\n\n if (collision) {\n collisions.push(collision);\n }\n }\n }\n }\n }\n }\n\n return collisions;\n };\n\n /**\n * Returns `true` if both supplied collision filters will allow a collision to occur.\n * See `body.collisionFilter` for more information.\n * @method canCollide\n * @param {} filterA\n * @param {} filterB\n * @return {bool} `true` if collision can occur\n */\n Detector.canCollide = function(filterA, filterB) {\n if (filterA.group === filterB.group && filterA.group !== 0)\n return filterA.group > 0;\n\n return (filterA.mask & filterB.category) !== 0 && (filterB.mask & filterA.category) !== 0;\n };\n\n /**\n * The comparison function used in the broadphase algorithm.\n * Returns the signed delta of the bodies bounds on the x-axis.\n * @private\n * @method _sortCompare\n * @param {body} bodyA\n * @param {body} bodyB\n * @return {number} The signed delta used for sorting\n */\n Detector._compareBoundsX = function(bodyA, bodyB) {\n return bodyA.bounds.min.x - bodyB.bounds.min.x;\n };\n\n /*\n *\n * Properties Documentation\n *\n */\n\n /**\n * The array of `Matter.Body` between which the detector finds collisions.\n * \n * _Note:_ The order of bodies in this array _is not fixed_ and will be continually managed by the detector.\n * @property bodies\n * @type body[]\n * @default []\n */\n\n /**\n * Optional. A `Matter.Pairs` object from which previous collision objects may be reused. Intended for internal `Matter.Engine` usage.\n * @property pairs\n * @type {pairs|null}\n * @default null\n */\n\n})();\n\n\n/***/ }),\n/* 15 */\n/***/ (function(module, exports, __webpack_require__) {\n\n/**\n* The `Matter.Plugin` module contains functions for registering and installing plugins on modules.\n*\n* @class Plugin\n*/\n\nvar Plugin = {};\n\nmodule.exports = Plugin;\n\nvar Common = __webpack_require__(0);\n\n(function() {\n\n Plugin._registry = {};\n\n /**\n * Registers a plugin object so it can be resolved later by name.\n * @method register\n * @param plugin {} The plugin to register.\n * @return {object} The plugin.\n */\n Plugin.register = function(plugin) {\n if (!Plugin.isPlugin(plugin)) {\n Common.warn('Plugin.register:', Plugin.toString(plugin), 'does not implement all required fields.');\n }\n\n if (plugin.name in Plugin._registry) {\n var registered = Plugin._registry[plugin.name],\n pluginVersion = Plugin.versionParse(plugin.version).number,\n registeredVersion = Plugin.versionParse(registered.version).number;\n\n if (pluginVersion > registeredVersion) {\n Common.warn('Plugin.register:', Plugin.toString(registered), 'was upgraded to', Plugin.toString(plugin));\n Plugin._registry[plugin.name] = plugin;\n } else if (pluginVersion < registeredVersion) {\n Common.warn('Plugin.register:', Plugin.toString(registered), 'can not be downgraded to', Plugin.toString(plugin));\n } else if (plugin !== registered) {\n Common.warn('Plugin.register:', Plugin.toString(plugin), 'is already registered to different plugin object');\n }\n } else {\n Plugin._registry[plugin.name] = plugin;\n }\n\n return plugin;\n };\n\n /**\n * Resolves a dependency to a plugin object from the registry if it exists. \n * The `dependency` may contain a version, but only the name matters when resolving.\n * @method resolve\n * @param dependency {string} The dependency.\n * @return {object} The plugin if resolved, otherwise `undefined`.\n */\n Plugin.resolve = function(dependency) {\n return Plugin._registry[Plugin.dependencyParse(dependency).name];\n };\n\n /**\n * Returns a pretty printed plugin name and version.\n * @method toString\n * @param plugin {} The plugin.\n * @return {string} Pretty printed plugin name and version.\n */\n Plugin.toString = function(plugin) {\n return typeof plugin === 'string' ? plugin : (plugin.name || 'anonymous') + '@' + (plugin.version || plugin.range || '0.0.0');\n };\n\n /**\n * Returns `true` if the object meets the minimum standard to be considered a plugin.\n * This means it must define the following properties:\n * - `name`\n * - `version`\n * - `install`\n * @method isPlugin\n * @param obj {} The obj to test.\n * @return {boolean} `true` if the object can be considered a plugin otherwise `false`.\n */\n Plugin.isPlugin = function(obj) {\n return obj && obj.name && obj.version && obj.install;\n };\n\n /**\n * Returns `true` if a plugin with the given `name` been installed on `module`.\n * @method isUsed\n * @param module {} The module.\n * @param name {string} The plugin name.\n * @return {boolean} `true` if a plugin with the given `name` been installed on `module`, otherwise `false`.\n */\n Plugin.isUsed = function(module, name) {\n return module.used.indexOf(name) > -1;\n };\n\n /**\n * Returns `true` if `plugin.for` is applicable to `module` by comparing against `module.name` and `module.version`.\n * If `plugin.for` is not specified then it is assumed to be applicable.\n * The value of `plugin.for` is a string of the format `'module-name'` or `'module-name@version'`.\n * @method isFor\n * @param plugin {} The plugin.\n * @param module {} The module.\n * @return {boolean} `true` if `plugin.for` is applicable to `module`, otherwise `false`.\n */\n Plugin.isFor = function(plugin, module) {\n var parsed = plugin.for && Plugin.dependencyParse(plugin.for);\n return !plugin.for || (module.name === parsed.name && Plugin.versionSatisfies(module.version, parsed.range));\n };\n\n /**\n * Installs the plugins by calling `plugin.install` on each plugin specified in `plugins` if passed, otherwise `module.uses`.\n * For installing plugins on `Matter` see the convenience function `Matter.use`.\n * Plugins may be specified either by their name or a reference to the plugin object.\n * Plugins themselves may specify further dependencies, but each plugin is installed only once.\n * Order is important, a topological sort is performed to find the best resulting order of installation.\n * This sorting attempts to satisfy every dependency's requested ordering, but may not be exact in all cases.\n * This function logs the resulting status of each dependency in the console, along with any warnings.\n * - A green tick ✅ indicates a dependency was resolved and installed.\n * - An orange diamond 🔶 indicates a dependency was resolved but a warning was thrown for it or one if its dependencies.\n * - A red cross ❌ indicates a dependency could not be resolved.\n * Avoid calling this function multiple times on the same module unless you intend to manually control installation order.\n * @method use\n * @param module {} The module install plugins on.\n * @param [plugins=module.uses] {} The plugins to install on module (optional, defaults to `module.uses`).\n */\n Plugin.use = function(module, plugins) {\n module.uses = (module.uses || []).concat(plugins || []);\n\n if (module.uses.length === 0) {\n Common.warn('Plugin.use:', Plugin.toString(module), 'does not specify any dependencies to install.');\n return;\n }\n\n var dependencies = Plugin.dependencies(module),\n sortedDependencies = Common.topologicalSort(dependencies),\n status = [];\n\n for (var i = 0; i < sortedDependencies.length; i += 1) {\n if (sortedDependencies[i] === module.name) {\n continue;\n }\n\n var plugin = Plugin.resolve(sortedDependencies[i]);\n\n if (!plugin) {\n status.push('❌ ' + sortedDependencies[i]);\n continue;\n }\n\n if (Plugin.isUsed(module, plugin.name)) {\n continue;\n }\n\n if (!Plugin.isFor(plugin, module)) {\n Common.warn('Plugin.use:', Plugin.toString(plugin), 'is for', plugin.for, 'but installed on', Plugin.toString(module) + '.');\n plugin._warned = true;\n }\n\n if (plugin.install) {\n plugin.install(module);\n } else {\n Common.warn('Plugin.use:', Plugin.toString(plugin), 'does not specify an install function.');\n plugin._warned = true;\n }\n\n if (plugin._warned) {\n status.push('🔶 ' + Plugin.toString(plugin));\n delete plugin._warned;\n } else {\n status.push('✅ ' + Plugin.toString(plugin));\n }\n\n module.used.push(plugin.name);\n }\n\n if (status.length > 0) {\n Common.info(status.join(' '));\n }\n };\n\n /**\n * Recursively finds all of a module's dependencies and returns a flat dependency graph.\n * @method dependencies\n * @param module {} The module.\n * @return {object} A dependency graph.\n */\n Plugin.dependencies = function(module, tracked) {\n var parsedBase = Plugin.dependencyParse(module),\n name = parsedBase.name;\n\n tracked = tracked || {};\n\n if (name in tracked) {\n return;\n }\n\n module = Plugin.resolve(module) || module;\n\n tracked[name] = Common.map(module.uses || [], function(dependency) {\n if (Plugin.isPlugin(dependency)) {\n Plugin.register(dependency);\n }\n\n var parsed = Plugin.dependencyParse(dependency),\n resolved = Plugin.resolve(dependency);\n\n if (resolved && !Plugin.versionSatisfies(resolved.version, parsed.range)) {\n Common.warn(\n 'Plugin.dependencies:', Plugin.toString(resolved), 'does not satisfy',\n Plugin.toString(parsed), 'used by', Plugin.toString(parsedBase) + '.'\n );\n\n resolved._warned = true;\n module._warned = true;\n } else if (!resolved) {\n Common.warn(\n 'Plugin.dependencies:', Plugin.toString(dependency), 'used by',\n Plugin.toString(parsedBase), 'could not be resolved.'\n );\n\n module._warned = true;\n }\n\n return parsed.name;\n });\n\n for (var i = 0; i < tracked[name].length; i += 1) {\n Plugin.dependencies(tracked[name][i], tracked);\n }\n\n return tracked;\n };\n\n /**\n * Parses a dependency string into its components.\n * The `dependency` is a string of the format `'module-name'` or `'module-name@version'`.\n * See documentation for `Plugin.versionParse` for a description of the format.\n * This function can also handle dependencies that are already resolved (e.g. a module object).\n * @method dependencyParse\n * @param dependency {string} The dependency of the format `'module-name'` or `'module-name@version'`.\n * @return {object} The dependency parsed into its components.\n */\n Plugin.dependencyParse = function(dependency) {\n if (Common.isString(dependency)) {\n var pattern = /^[\\w-]+(@(\\*|[\\^~]?\\d+\\.\\d+\\.\\d+(-[0-9A-Za-z-+]+)?))?$/;\n\n if (!pattern.test(dependency)) {\n Common.warn('Plugin.dependencyParse:', dependency, 'is not a valid dependency string.');\n }\n\n return {\n name: dependency.split('@')[0],\n range: dependency.split('@')[1] || '*'\n };\n }\n\n return {\n name: dependency.name,\n range: dependency.range || dependency.version\n };\n };\n\n /**\n * Parses a version string into its components. \n * Versions are strictly of the format `x.y.z` (as in [semver](http://semver.org/)).\n * Versions may optionally have a prerelease tag in the format `x.y.z-alpha`.\n * Ranges are a strict subset of [npm ranges](https://docs.npmjs.com/misc/semver#advanced-range-syntax).\n * Only the following range types are supported:\n * - Tilde ranges e.g. `~1.2.3`\n * - Caret ranges e.g. `^1.2.3`\n * - Greater than ranges e.g. `>1.2.3`\n * - Greater than or equal ranges e.g. `>=1.2.3`\n * - Exact version e.g. `1.2.3`\n * - Any version `*`\n * @method versionParse\n * @param range {string} The version string.\n * @return {object} The version range parsed into its components.\n */\n Plugin.versionParse = function(range) {\n var pattern = /^(\\*)|(\\^|~|>=|>)?\\s*((\\d+)\\.(\\d+)\\.(\\d+))(-[0-9A-Za-z-+]+)?$/;\n\n if (!pattern.test(range)) {\n Common.warn('Plugin.versionParse:', range, 'is not a valid version or range.');\n }\n\n var parts = pattern.exec(range);\n var major = Number(parts[4]);\n var minor = Number(parts[5]);\n var patch = Number(parts[6]);\n\n return {\n isRange: Boolean(parts[1] || parts[2]),\n version: parts[3],\n range: range,\n operator: parts[1] || parts[2] || '',\n major: major,\n minor: minor,\n patch: patch,\n parts: [major, minor, patch],\n prerelease: parts[7],\n number: major * 1e8 + minor * 1e4 + patch\n };\n };\n\n /**\n * Returns `true` if `version` satisfies the given `range`.\n * See documentation for `Plugin.versionParse` for a description of the format.\n * If a version or range is not specified, then any version (`*`) is assumed to satisfy.\n * @method versionSatisfies\n * @param version {string} The version string.\n * @param range {string} The range string.\n * @return {boolean} `true` if `version` satisfies `range`, otherwise `false`.\n */\n Plugin.versionSatisfies = function(version, range) {\n range = range || '*';\n\n var r = Plugin.versionParse(range),\n v = Plugin.versionParse(version);\n\n if (r.isRange) {\n if (r.operator === '*' || version === '*') {\n return true;\n }\n\n if (r.operator === '>') {\n return v.number > r.number;\n }\n\n if (r.operator === '>=') {\n return v.number >= r.number;\n }\n\n if (r.operator === '~') {\n return v.major === r.major && v.minor === r.minor && v.patch >= r.patch;\n }\n\n if (r.operator === '^') {\n if (r.major > 0) {\n return v.major === r.major && v.number >= r.number;\n }\n\n if (r.minor > 0) {\n return v.minor === r.minor && v.patch >= r.patch;\n }\n\n return v.patch === r.patch;\n }\n }\n\n return version === range || version === '*';\n };\n\n})();\n\n\n/***/ }),\n/* 16 */\n/***/ (function(module, exports, __webpack_require__) {\n\n/**\n* The `Matter.Render` module is a simple canvas based renderer for visualising instances of `Matter.Engine`.\n* It is intended for development and debugging purposes, but may also be suitable for simple games.\n* It includes a number of drawing options including wireframe, vector with support for sprites and viewports.\n*\n* @class Render\n*/\n\nvar Render = {};\n\nmodule.exports = Render;\n\nvar Common = __webpack_require__(0);\nvar Composite = __webpack_require__(5);\nvar Bounds = __webpack_require__(1);\nvar Events = __webpack_require__(4);\nvar Vector = __webpack_require__(2);\nvar Mouse = __webpack_require__(13);\n\n(function() {\n\n var _requestAnimationFrame,\n _cancelAnimationFrame;\n\n if (typeof window !== 'undefined') {\n _requestAnimationFrame = window.requestAnimationFrame || window.webkitRequestAnimationFrame\n || window.mozRequestAnimationFrame || window.msRequestAnimationFrame\n || function(callback){ window.setTimeout(function() { callback(Common.now()); }, 1000 / 60); };\n\n _cancelAnimationFrame = window.cancelAnimationFrame || window.mozCancelAnimationFrame\n || window.webkitCancelAnimationFrame || window.msCancelAnimationFrame;\n }\n\n Render._goodFps = 30;\n Render._goodDelta = 1000 / 60;\n\n /**\n * Creates a new renderer. The options parameter is an object that specifies any properties you wish to override the defaults.\n * All properties have default values, and many are pre-calculated automatically based on other properties.\n * See the properties section below for detailed information on what you can pass via the `options` object.\n * @method create\n * @param {object} [options]\n * @return {render} A new renderer\n */\n Render.create = function(options) {\n var defaults = {\n controller: Render,\n engine: null,\n element: null,\n canvas: null,\n mouse: null,\n frameRequestId: null,\n timing: {\n historySize: 60,\n delta: 0,\n deltaHistory: [],\n lastTime: 0,\n lastTimestamp: 0,\n lastElapsed: 0,\n timestampElapsed: 0,\n timestampElapsedHistory: [],\n engineDeltaHistory: [],\n engineElapsedHistory: [],\n elapsedHistory: []\n },\n options: {\n width: 800,\n height: 600,\n pixelRatio: 1,\n background: '#14151f',\n wireframeBackground: '#14151f',\n hasBounds: !!options.bounds,\n enabled: true,\n wireframes: true,\n showSleeping: true,\n showDebug: false,\n showStats: false,\n showPerformance: false,\n showBounds: false,\n showVelocity: false,\n showCollisions: false,\n showSeparations: false,\n showAxes: false,\n showPositions: false,\n showAngleIndicator: false,\n showIds: false,\n showVertexNumbers: false,\n showConvexHulls: false,\n showInternalEdges: false,\n showMousePosition: false\n }\n };\n\n var render = Common.extend(defaults, options);\n\n if (render.canvas) {\n render.canvas.width = render.options.width || render.canvas.width;\n render.canvas.height = render.options.height || render.canvas.height;\n }\n\n render.mouse = options.mouse;\n render.engine = options.engine;\n render.canvas = render.canvas || _createCanvas(render.options.width, render.options.height);\n render.context = render.canvas.getContext('2d');\n render.textures = {};\n\n render.bounds = render.bounds || {\n min: {\n x: 0,\n y: 0\n },\n max: {\n x: render.canvas.width,\n y: render.canvas.height\n }\n };\n\n // for temporary back compatibility only\n render.options.showBroadphase = false;\n\n if (render.options.pixelRatio !== 1) {\n Render.setPixelRatio(render, render.options.pixelRatio);\n }\n\n if (Common.isElement(render.element)) {\n render.element.appendChild(render.canvas);\n } else if (!render.canvas.parentNode) {\n Common.log('Render.create: options.element was undefined, render.canvas was created but not appended', 'warn');\n }\n\n return render;\n };\n\n /**\n * Continuously updates the render canvas on the `requestAnimationFrame` event.\n * @method run\n * @param {render} render\n */\n Render.run = function(render) {\n (function loop(time){\n render.frameRequestId = _requestAnimationFrame(loop);\n \n _updateTiming(render, time);\n\n Render.world(render, time);\n\n if (render.options.showStats || render.options.showDebug) {\n Render.stats(render, render.context, time);\n }\n\n if (render.options.showPerformance || render.options.showDebug) {\n Render.performance(render, render.context, time);\n }\n })();\n };\n\n /**\n * Ends execution of `Render.run` on the given `render`, by canceling the animation frame request event loop.\n * @method stop\n * @param {render} render\n */\n Render.stop = function(render) {\n _cancelAnimationFrame(render.frameRequestId);\n };\n\n /**\n * Sets the pixel ratio of the renderer and updates the canvas.\n * To automatically detect the correct ratio, pass the string `'auto'` for `pixelRatio`.\n * @method setPixelRatio\n * @param {render} render\n * @param {number} pixelRatio\n */\n Render.setPixelRatio = function(render, pixelRatio) {\n var options = render.options,\n canvas = render.canvas;\n\n if (pixelRatio === 'auto') {\n pixelRatio = _getPixelRatio(canvas);\n }\n\n options.pixelRatio = pixelRatio;\n canvas.setAttribute('data-pixel-ratio', pixelRatio);\n canvas.width = options.width * pixelRatio;\n canvas.height = options.height * pixelRatio;\n canvas.style.width = options.width + 'px';\n canvas.style.height = options.height + 'px';\n };\n\n /**\n * Positions and sizes the viewport around the given object bounds.\n * Objects must have at least one of the following properties:\n * - `object.bounds`\n * - `object.position`\n * - `object.min` and `object.max`\n * - `object.x` and `object.y`\n * @method lookAt\n * @param {render} render\n * @param {object[]} objects\n * @param {vector} [padding]\n * @param {bool} [center=true]\n */\n Render.lookAt = function(render, objects, padding, center) {\n center = typeof center !== 'undefined' ? center : true;\n objects = Common.isArray(objects) ? objects : [objects];\n padding = padding || {\n x: 0,\n y: 0\n };\n\n // find bounds of all objects\n var bounds = {\n min: { x: Infinity, y: Infinity },\n max: { x: -Infinity, y: -Infinity }\n };\n\n for (var i = 0; i < objects.length; i += 1) {\n var object = objects[i],\n min = object.bounds ? object.bounds.min : (object.min || object.position || object),\n max = object.bounds ? object.bounds.max : (object.max || object.position || object);\n\n if (min && max) {\n if (min.x < bounds.min.x)\n bounds.min.x = min.x;\n\n if (max.x > bounds.max.x)\n bounds.max.x = max.x;\n\n if (min.y < bounds.min.y)\n bounds.min.y = min.y;\n\n if (max.y > bounds.max.y)\n bounds.max.y = max.y;\n }\n }\n\n // find ratios\n var width = (bounds.max.x - bounds.min.x) + 2 * padding.x,\n height = (bounds.max.y - bounds.min.y) + 2 * padding.y,\n viewHeight = render.canvas.height,\n viewWidth = render.canvas.width,\n outerRatio = viewWidth / viewHeight,\n innerRatio = width / height,\n scaleX = 1,\n scaleY = 1;\n\n // find scale factor\n if (innerRatio > outerRatio) {\n scaleY = innerRatio / outerRatio;\n } else {\n scaleX = outerRatio / innerRatio;\n }\n\n // enable bounds\n render.options.hasBounds = true;\n\n // position and size\n render.bounds.min.x = bounds.min.x;\n render.bounds.max.x = bounds.min.x + width * scaleX;\n render.bounds.min.y = bounds.min.y;\n render.bounds.max.y = bounds.min.y + height * scaleY;\n\n // center\n if (center) {\n render.bounds.min.x += width * 0.5 - (width * scaleX) * 0.5;\n render.bounds.max.x += width * 0.5 - (width * scaleX) * 0.5;\n render.bounds.min.y += height * 0.5 - (height * scaleY) * 0.5;\n render.bounds.max.y += height * 0.5 - (height * scaleY) * 0.5;\n }\n\n // padding\n render.bounds.min.x -= padding.x;\n render.bounds.max.x -= padding.x;\n render.bounds.min.y -= padding.y;\n render.bounds.max.y -= padding.y;\n\n // update mouse\n if (render.mouse) {\n Mouse.setScale(render.mouse, {\n x: (render.bounds.max.x - render.bounds.min.x) / render.canvas.width,\n y: (render.bounds.max.y - render.bounds.min.y) / render.canvas.height\n });\n\n Mouse.setOffset(render.mouse, render.bounds.min);\n }\n };\n\n /**\n * Applies viewport transforms based on `render.bounds` to a render context.\n * @method startViewTransform\n * @param {render} render\n */\n Render.startViewTransform = function(render) {\n var boundsWidth = render.bounds.max.x - render.bounds.min.x,\n boundsHeight = render.bounds.max.y - render.bounds.min.y,\n boundsScaleX = boundsWidth / render.options.width,\n boundsScaleY = boundsHeight / render.options.height;\n\n render.context.setTransform(\n render.options.pixelRatio / boundsScaleX, 0, 0, \n render.options.pixelRatio / boundsScaleY, 0, 0\n );\n \n render.context.translate(-render.bounds.min.x, -render.bounds.min.y);\n };\n\n /**\n * Resets all transforms on the render context.\n * @method endViewTransform\n * @param {render} render\n */\n Render.endViewTransform = function(render) {\n render.context.setTransform(render.options.pixelRatio, 0, 0, render.options.pixelRatio, 0, 0);\n };\n\n /**\n * Renders the given `engine`'s `Matter.World` object.\n * This is the entry point for all rendering and should be called every time the scene changes.\n * @method world\n * @param {render} render\n */\n Render.world = function(render, time) {\n var startTime = Common.now(),\n engine = render.engine,\n world = engine.world,\n canvas = render.canvas,\n context = render.context,\n options = render.options,\n timing = render.timing;\n\n var allBodies = Composite.allBodies(world),\n allConstraints = Composite.allConstraints(world),\n background = options.wireframes ? options.wireframeBackground : options.background,\n bodies = [],\n constraints = [],\n i;\n\n var event = {\n timestamp: engine.timing.timestamp\n };\n\n Events.trigger(render, 'beforeRender', event);\n\n // apply background if it has changed\n if (render.currentBackground !== background)\n _applyBackground(render, background);\n\n // clear the canvas with a transparent fill, to allow the canvas background to show\n context.globalCompositeOperation = 'source-in';\n context.fillStyle = \"transparent\";\n context.fillRect(0, 0, canvas.width, canvas.height);\n context.globalCompositeOperation = 'source-over';\n\n // handle bounds\n if (options.hasBounds) {\n // filter out bodies that are not in view\n for (i = 0; i < allBodies.length; i++) {\n var body = allBodies[i];\n if (Bounds.overlaps(body.bounds, render.bounds))\n bodies.push(body);\n }\n\n // filter out constraints that are not in view\n for (i = 0; i < allConstraints.length; i++) {\n var constraint = allConstraints[i],\n bodyA = constraint.bodyA,\n bodyB = constraint.bodyB,\n pointAWorld = constraint.pointA,\n pointBWorld = constraint.pointB;\n\n if (bodyA) pointAWorld = Vector.add(bodyA.position, constraint.pointA);\n if (bodyB) pointBWorld = Vector.add(bodyB.position, constraint.pointB);\n\n if (!pointAWorld || !pointBWorld)\n continue;\n\n if (Bounds.contains(render.bounds, pointAWorld) || Bounds.contains(render.bounds, pointBWorld))\n constraints.push(constraint);\n }\n\n // transform the view\n Render.startViewTransform(render);\n\n // update mouse\n if (render.mouse) {\n Mouse.setScale(render.mouse, {\n x: (render.bounds.max.x - render.bounds.min.x) / render.options.width,\n y: (render.bounds.max.y - render.bounds.min.y) / render.options.height\n });\n\n Mouse.setOffset(render.mouse, render.bounds.min);\n }\n } else {\n constraints = allConstraints;\n bodies = allBodies;\n\n if (render.options.pixelRatio !== 1) {\n render.context.setTransform(render.options.pixelRatio, 0, 0, render.options.pixelRatio, 0, 0);\n }\n }\n\n if (!options.wireframes || (engine.enableSleeping && options.showSleeping)) {\n // fully featured rendering of bodies\n Render.bodies(render, bodies, context);\n } else {\n if (options.showConvexHulls)\n Render.bodyConvexHulls(render, bodies, context);\n\n // optimised method for wireframes only\n Render.bodyWireframes(render, bodies, context);\n }\n\n if (options.showBounds)\n Render.bodyBounds(render, bodies, context);\n\n if (options.showAxes || options.showAngleIndicator)\n Render.bodyAxes(render, bodies, context);\n\n if (options.showPositions)\n Render.bodyPositions(render, bodies, context);\n\n if (options.showVelocity)\n Render.bodyVelocity(render, bodies, context);\n\n if (options.showIds)\n Render.bodyIds(render, bodies, context);\n\n if (options.showSeparations)\n Render.separations(render, engine.pairs.list, context);\n\n if (options.showCollisions)\n Render.collisions(render, engine.pairs.list, context);\n\n if (options.showVertexNumbers)\n Render.vertexNumbers(render, bodies, context);\n\n if (options.showMousePosition)\n Render.mousePosition(render, render.mouse, context);\n\n Render.constraints(constraints, context);\n\n if (options.hasBounds) {\n // revert view transforms\n Render.endViewTransform(render);\n }\n\n Events.trigger(render, 'afterRender', event);\n\n // log the time elapsed computing this update\n timing.lastElapsed = Common.now() - startTime;\n };\n\n /**\n * Renders statistics about the engine and world useful for debugging.\n * @private\n * @method stats\n * @param {render} render\n * @param {RenderingContext} context\n * @param {Number} time\n */\n Render.stats = function(render, context, time) {\n var engine = render.engine,\n world = engine.world,\n bodies = Composite.allBodies(world),\n parts = 0,\n width = 55,\n height = 44,\n x = 0,\n y = 0;\n \n // count parts\n for (var i = 0; i < bodies.length; i += 1) {\n parts += bodies[i].parts.length;\n }\n\n // sections\n var sections = {\n 'Part': parts,\n 'Body': bodies.length,\n 'Cons': Composite.allConstraints(world).length,\n 'Comp': Composite.allComposites(world).length,\n 'Pair': engine.pairs.list.length\n };\n\n // background\n context.fillStyle = '#0e0f19';\n context.fillRect(x, y, width * 5.5, height);\n\n context.font = '12px Arial';\n context.textBaseline = 'top';\n context.textAlign = 'right';\n\n // sections\n for (var key in sections) {\n var section = sections[key];\n // label\n context.fillStyle = '#aaa';\n context.fillText(key, x + width, y + 8);\n\n // value\n context.fillStyle = '#eee';\n context.fillText(section, x + width, y + 26);\n\n x += width;\n }\n };\n\n /**\n * Renders engine and render performance information.\n * @private\n * @method performance\n * @param {render} render\n * @param {RenderingContext} context\n */\n Render.performance = function(render, context) {\n var engine = render.engine,\n timing = render.timing,\n deltaHistory = timing.deltaHistory,\n elapsedHistory = timing.elapsedHistory,\n timestampElapsedHistory = timing.timestampElapsedHistory,\n engineDeltaHistory = timing.engineDeltaHistory,\n engineElapsedHistory = timing.engineElapsedHistory,\n lastEngineDelta = engine.timing.lastDelta;\n \n var deltaMean = _mean(deltaHistory),\n elapsedMean = _mean(elapsedHistory),\n engineDeltaMean = _mean(engineDeltaHistory),\n engineElapsedMean = _mean(engineElapsedHistory),\n timestampElapsedMean = _mean(timestampElapsedHistory),\n rateMean = (timestampElapsedMean / deltaMean) || 0,\n fps = (1000 / deltaMean) || 0;\n\n var graphHeight = 4,\n gap = 12,\n width = 60,\n height = 34,\n x = 10,\n y = 69;\n\n // background\n context.fillStyle = '#0e0f19';\n context.fillRect(0, 50, gap * 4 + width * 5 + 22, height);\n\n // show FPS\n Render.status(\n context, x, y, width, graphHeight, deltaHistory.length, \n Math.round(fps) + ' fps', \n fps / Render._goodFps,\n function(i) { return (deltaHistory[i] / deltaMean) - 1; }\n );\n\n // show engine delta\n Render.status(\n context, x + gap + width, y, width, graphHeight, engineDeltaHistory.length,\n lastEngineDelta.toFixed(2) + ' dt', \n Render._goodDelta / lastEngineDelta,\n function(i) { return (engineDeltaHistory[i] / engineDeltaMean) - 1; }\n );\n\n // show engine update time\n Render.status(\n context, x + (gap + width) * 2, y, width, graphHeight, engineElapsedHistory.length,\n engineElapsedMean.toFixed(2) + ' ut', \n 1 - (engineElapsedMean / Render._goodFps),\n function(i) { return (engineElapsedHistory[i] / engineElapsedMean) - 1; }\n );\n\n // show render time\n Render.status(\n context, x + (gap + width) * 3, y, width, graphHeight, elapsedHistory.length,\n elapsedMean.toFixed(2) + ' rt', \n 1 - (elapsedMean / Render._goodFps),\n function(i) { return (elapsedHistory[i] / elapsedMean) - 1; }\n );\n\n // show effective speed\n Render.status(\n context, x + (gap + width) * 4, y, width, graphHeight, timestampElapsedHistory.length, \n rateMean.toFixed(2) + ' x', \n rateMean * rateMean * rateMean,\n function(i) { return (((timestampElapsedHistory[i] / deltaHistory[i]) / rateMean) || 0) - 1; }\n );\n };\n\n /**\n * Renders a label, indicator and a chart.\n * @private\n * @method status\n * @param {RenderingContext} context\n * @param {number} x\n * @param {number} y\n * @param {number} width\n * @param {number} height\n * @param {number} count\n * @param {string} label\n * @param {string} indicator\n * @param {function} plotY\n */\n Render.status = function(context, x, y, width, height, count, label, indicator, plotY) {\n // background\n context.strokeStyle = '#888';\n context.fillStyle = '#444';\n context.lineWidth = 1;\n context.fillRect(x, y + 7, width, 1);\n\n // chart\n context.beginPath();\n context.moveTo(x, y + 7 - height * Common.clamp(0.4 * plotY(0), -2, 2));\n for (var i = 0; i < width; i += 1) {\n context.lineTo(x + i, y + 7 - (i < count ? height * Common.clamp(0.4 * plotY(i), -2, 2) : 0));\n }\n context.stroke();\n\n // indicator\n context.fillStyle = 'hsl(' + Common.clamp(25 + 95 * indicator, 0, 120) + ',100%,60%)';\n context.fillRect(x, y - 7, 4, 4);\n\n // label\n context.font = '12px Arial';\n context.textBaseline = 'middle';\n context.textAlign = 'right';\n context.fillStyle = '#eee';\n context.fillText(label, x + width, y - 5);\n };\n\n /**\n * Description\n * @private\n * @method constraints\n * @param {constraint[]} constraints\n * @param {RenderingContext} context\n */\n Render.constraints = function(constraints, context) {\n var c = context;\n\n for (var i = 0; i < constraints.length; i++) {\n var constraint = constraints[i];\n\n if (!constraint.render.visible || !constraint.pointA || !constraint.pointB)\n continue;\n\n var bodyA = constraint.bodyA,\n bodyB = constraint.bodyB,\n start,\n end;\n\n if (bodyA) {\n start = Vector.add(bodyA.position, constraint.pointA);\n } else {\n start = constraint.pointA;\n }\n\n if (constraint.render.type === 'pin') {\n c.beginPath();\n c.arc(start.x, start.y, 3, 0, 2 * Math.PI);\n c.closePath();\n } else {\n if (bodyB) {\n end = Vector.add(bodyB.position, constraint.pointB);\n } else {\n end = constraint.pointB;\n }\n\n c.beginPath();\n c.moveTo(start.x, start.y);\n\n if (constraint.render.type === 'spring') {\n var delta = Vector.sub(end, start),\n normal = Vector.perp(Vector.normalise(delta)),\n coils = Math.ceil(Common.clamp(constraint.length / 5, 12, 20)),\n offset;\n\n for (var j = 1; j < coils; j += 1) {\n offset = j % 2 === 0 ? 1 : -1;\n\n c.lineTo(\n start.x + delta.x * (j / coils) + normal.x * offset * 4,\n start.y + delta.y * (j / coils) + normal.y * offset * 4\n );\n }\n }\n\n c.lineTo(end.x, end.y);\n }\n\n if (constraint.render.lineWidth) {\n c.lineWidth = constraint.render.lineWidth;\n c.strokeStyle = constraint.render.strokeStyle;\n c.stroke();\n }\n\n if (constraint.render.anchors) {\n c.fillStyle = constraint.render.strokeStyle;\n c.beginPath();\n c.arc(start.x, start.y, 3, 0, 2 * Math.PI);\n c.arc(end.x, end.y, 3, 0, 2 * Math.PI);\n c.closePath();\n c.fill();\n }\n }\n };\n\n /**\n * Description\n * @private\n * @method bodies\n * @param {render} render\n * @param {body[]} bodies\n * @param {RenderingContext} context\n */\n Render.bodies = function(render, bodies, context) {\n var c = context,\n engine = render.engine,\n options = render.options,\n showInternalEdges = options.showInternalEdges || !options.wireframes,\n body,\n part,\n i,\n k;\n\n for (i = 0; i < bodies.length; i++) {\n body = bodies[i];\n\n if (!body.render.visible)\n continue;\n\n // handle compound parts\n for (k = body.parts.length > 1 ? 1 : 0; k < body.parts.length; k++) {\n part = body.parts[k];\n\n if (!part.render.visible)\n continue;\n\n if (options.showSleeping && body.isSleeping) {\n c.globalAlpha = 0.5 * part.render.opacity;\n } else if (part.render.opacity !== 1) {\n c.globalAlpha = part.render.opacity;\n }\n\n if (part.render.sprite && part.render.sprite.texture && !options.wireframes) {\n // part sprite\n var sprite = part.render.sprite,\n texture = _getTexture(render, sprite.texture);\n\n c.translate(part.position.x, part.position.y);\n c.rotate(part.angle);\n\n c.drawImage(\n texture,\n texture.width * -sprite.xOffset * sprite.xScale,\n texture.height * -sprite.yOffset * sprite.yScale,\n texture.width * sprite.xScale,\n texture.height * sprite.yScale\n );\n\n // revert translation, hopefully faster than save / restore\n c.rotate(-part.angle);\n c.translate(-part.position.x, -part.position.y);\n } else {\n // part polygon\n if (part.circleRadius) {\n c.beginPath();\n c.arc(part.position.x, part.position.y, part.circleRadius, 0, 2 * Math.PI);\n } else {\n c.beginPath();\n c.moveTo(part.vertices[0].x, part.vertices[0].y);\n\n for (var j = 1; j < part.vertices.length; j++) {\n if (!part.vertices[j - 1].isInternal || showInternalEdges) {\n c.lineTo(part.vertices[j].x, part.vertices[j].y);\n } else {\n c.moveTo(part.vertices[j].x, part.vertices[j].y);\n }\n\n if (part.vertices[j].isInternal && !showInternalEdges) {\n c.moveTo(part.vertices[(j + 1) % part.vertices.length].x, part.vertices[(j + 1) % part.vertices.length].y);\n }\n }\n\n c.lineTo(part.vertices[0].x, part.vertices[0].y);\n c.closePath();\n }\n\n if (!options.wireframes) {\n c.fillStyle = part.render.fillStyle;\n\n if (part.render.lineWidth) {\n c.lineWidth = part.render.lineWidth;\n c.strokeStyle = part.render.strokeStyle;\n c.stroke();\n }\n\n c.fill();\n } else {\n c.lineWidth = 1;\n c.strokeStyle = '#bbb';\n c.stroke();\n }\n }\n\n c.globalAlpha = 1;\n }\n }\n };\n\n /**\n * Optimised method for drawing body wireframes in one pass\n * @private\n * @method bodyWireframes\n * @param {render} render\n * @param {body[]} bodies\n * @param {RenderingContext} context\n */\n Render.bodyWireframes = function(render, bodies, context) {\n var c = context,\n showInternalEdges = render.options.showInternalEdges,\n body,\n part,\n i,\n j,\n k;\n\n c.beginPath();\n\n // render all bodies\n for (i = 0; i < bodies.length; i++) {\n body = bodies[i];\n\n if (!body.render.visible)\n continue;\n\n // handle compound parts\n for (k = body.parts.length > 1 ? 1 : 0; k < body.parts.length; k++) {\n part = body.parts[k];\n\n c.moveTo(part.vertices[0].x, part.vertices[0].y);\n\n for (j = 1; j < part.vertices.length; j++) {\n if (!part.vertices[j - 1].isInternal || showInternalEdges) {\n c.lineTo(part.vertices[j].x, part.vertices[j].y);\n } else {\n c.moveTo(part.vertices[j].x, part.vertices[j].y);\n }\n\n if (part.vertices[j].isInternal && !showInternalEdges) {\n c.moveTo(part.vertices[(j + 1) % part.vertices.length].x, part.vertices[(j + 1) % part.vertices.length].y);\n }\n }\n\n c.lineTo(part.vertices[0].x, part.vertices[0].y);\n }\n }\n\n c.lineWidth = 1;\n c.strokeStyle = '#bbb';\n c.stroke();\n };\n\n /**\n * Optimised method for drawing body convex hull wireframes in one pass\n * @private\n * @method bodyConvexHulls\n * @param {render} render\n * @param {body[]} bodies\n * @param {RenderingContext} context\n */\n Render.bodyConvexHulls = function(render, bodies, context) {\n var c = context,\n body,\n part,\n i,\n j,\n k;\n\n c.beginPath();\n\n // render convex hulls\n for (i = 0; i < bodies.length; i++) {\n body = bodies[i];\n\n if (!body.render.visible || body.parts.length === 1)\n continue;\n\n c.moveTo(body.vertices[0].x, body.vertices[0].y);\n\n for (j = 1; j < body.vertices.length; j++) {\n c.lineTo(body.vertices[j].x, body.vertices[j].y);\n }\n\n c.lineTo(body.vertices[0].x, body.vertices[0].y);\n }\n\n c.lineWidth = 1;\n c.strokeStyle = 'rgba(255,255,255,0.2)';\n c.stroke();\n };\n\n /**\n * Renders body vertex numbers.\n * @private\n * @method vertexNumbers\n * @param {render} render\n * @param {body[]} bodies\n * @param {RenderingContext} context\n */\n Render.vertexNumbers = function(render, bodies, context) {\n var c = context,\n i,\n j,\n k;\n\n for (i = 0; i < bodies.length; i++) {\n var parts = bodies[i].parts;\n for (k = parts.length > 1 ? 1 : 0; k < parts.length; k++) {\n var part = parts[k];\n for (j = 0; j < part.vertices.length; j++) {\n c.fillStyle = 'rgba(255,255,255,0.2)';\n c.fillText(i + '_' + j, part.position.x + (part.vertices[j].x - part.position.x) * 0.8, part.position.y + (part.vertices[j].y - part.position.y) * 0.8);\n }\n }\n }\n };\n\n /**\n * Renders mouse position.\n * @private\n * @method mousePosition\n * @param {render} render\n * @param {mouse} mouse\n * @param {RenderingContext} context\n */\n Render.mousePosition = function(render, mouse, context) {\n var c = context;\n c.fillStyle = 'rgba(255,255,255,0.8)';\n c.fillText(mouse.position.x + ' ' + mouse.position.y, mouse.position.x + 5, mouse.position.y - 5);\n };\n\n /**\n * Draws body bounds\n * @private\n * @method bodyBounds\n * @param {render} render\n * @param {body[]} bodies\n * @param {RenderingContext} context\n */\n Render.bodyBounds = function(render, bodies, context) {\n var c = context,\n engine = render.engine,\n options = render.options;\n\n c.beginPath();\n\n for (var i = 0; i < bodies.length; i++) {\n var body = bodies[i];\n\n if (body.render.visible) {\n var parts = bodies[i].parts;\n for (var j = parts.length > 1 ? 1 : 0; j < parts.length; j++) {\n var part = parts[j];\n c.rect(part.bounds.min.x, part.bounds.min.y, part.bounds.max.x - part.bounds.min.x, part.bounds.max.y - part.bounds.min.y);\n }\n }\n }\n\n if (options.wireframes) {\n c.strokeStyle = 'rgba(255,255,255,0.08)';\n } else {\n c.strokeStyle = 'rgba(0,0,0,0.1)';\n }\n\n c.lineWidth = 1;\n c.stroke();\n };\n\n /**\n * Draws body angle indicators and axes\n * @private\n * @method bodyAxes\n * @param {render} render\n * @param {body[]} bodies\n * @param {RenderingContext} context\n */\n Render.bodyAxes = function(render, bodies, context) {\n var c = context,\n engine = render.engine,\n options = render.options,\n part,\n i,\n j,\n k;\n\n c.beginPath();\n\n for (i = 0; i < bodies.length; i++) {\n var body = bodies[i],\n parts = body.parts;\n\n if (!body.render.visible)\n continue;\n\n if (options.showAxes) {\n // render all axes\n for (j = parts.length > 1 ? 1 : 0; j < parts.length; j++) {\n part = parts[j];\n for (k = 0; k < part.axes.length; k++) {\n var axis = part.axes[k];\n c.moveTo(part.position.x, part.position.y);\n c.lineTo(part.position.x + axis.x * 20, part.position.y + axis.y * 20);\n }\n }\n } else {\n for (j = parts.length > 1 ? 1 : 0; j < parts.length; j++) {\n part = parts[j];\n for (k = 0; k < part.axes.length; k++) {\n // render a single axis indicator\n c.moveTo(part.position.x, part.position.y);\n c.lineTo((part.vertices[0].x + part.vertices[part.vertices.length-1].x) / 2,\n (part.vertices[0].y + part.vertices[part.vertices.length-1].y) / 2);\n }\n }\n }\n }\n\n if (options.wireframes) {\n c.strokeStyle = 'indianred';\n c.lineWidth = 1;\n } else {\n c.strokeStyle = 'rgba(255, 255, 255, 0.4)';\n c.globalCompositeOperation = 'overlay';\n c.lineWidth = 2;\n }\n\n c.stroke();\n c.globalCompositeOperation = 'source-over';\n };\n\n /**\n * Draws body positions\n * @private\n * @method bodyPositions\n * @param {render} render\n * @param {body[]} bodies\n * @param {RenderingContext} context\n */\n Render.bodyPositions = function(render, bodies, context) {\n var c = context,\n engine = render.engine,\n options = render.options,\n body,\n part,\n i,\n k;\n\n c.beginPath();\n\n // render current positions\n for (i = 0; i < bodies.length; i++) {\n body = bodies[i];\n\n if (!body.render.visible)\n continue;\n\n // handle compound parts\n for (k = 0; k < body.parts.length; k++) {\n part = body.parts[k];\n c.arc(part.position.x, part.position.y, 3, 0, 2 * Math.PI, false);\n c.closePath();\n }\n }\n\n if (options.wireframes) {\n c.fillStyle = 'indianred';\n } else {\n c.fillStyle = 'rgba(0,0,0,0.5)';\n }\n c.fill();\n\n c.beginPath();\n\n // render previous positions\n for (i = 0; i < bodies.length; i++) {\n body = bodies[i];\n if (body.render.visible) {\n c.arc(body.positionPrev.x, body.positionPrev.y, 2, 0, 2 * Math.PI, false);\n c.closePath();\n }\n }\n\n c.fillStyle = 'rgba(255,165,0,0.8)';\n c.fill();\n };\n\n /**\n * Draws body velocity\n * @private\n * @method bodyVelocity\n * @param {render} render\n * @param {body[]} bodies\n * @param {RenderingContext} context\n */\n Render.bodyVelocity = function(render, bodies, context) {\n var c = context;\n\n c.beginPath();\n\n for (var i = 0; i < bodies.length; i++) {\n var body = bodies[i];\n\n if (!body.render.visible)\n continue;\n\n c.moveTo(body.position.x, body.position.y);\n c.lineTo(body.position.x + (body.position.x - body.positionPrev.x) * 2, body.position.y + (body.position.y - body.positionPrev.y) * 2);\n }\n\n c.lineWidth = 3;\n c.strokeStyle = 'cornflowerblue';\n c.stroke();\n };\n\n /**\n * Draws body ids\n * @private\n * @method bodyIds\n * @param {render} render\n * @param {body[]} bodies\n * @param {RenderingContext} context\n */\n Render.bodyIds = function(render, bodies, context) {\n var c = context,\n i,\n j;\n\n for (i = 0; i < bodies.length; i++) {\n if (!bodies[i].render.visible)\n continue;\n\n var parts = bodies[i].parts;\n for (j = parts.length > 1 ? 1 : 0; j < parts.length; j++) {\n var part = parts[j];\n c.font = \"12px Arial\";\n c.fillStyle = 'rgba(255,255,255,0.5)';\n c.fillText(part.id, part.position.x + 10, part.position.y - 10);\n }\n }\n };\n\n /**\n * Description\n * @private\n * @method collisions\n * @param {render} render\n * @param {pair[]} pairs\n * @param {RenderingContext} context\n */\n Render.collisions = function(render, pairs, context) {\n var c = context,\n options = render.options,\n pair,\n collision,\n corrected,\n bodyA,\n bodyB,\n i,\n j;\n\n c.beginPath();\n\n // render collision positions\n for (i = 0; i < pairs.length; i++) {\n pair = pairs[i];\n\n if (!pair.isActive)\n continue;\n\n collision = pair.collision;\n for (j = 0; j < pair.activeContacts.length; j++) {\n var contact = pair.activeContacts[j],\n vertex = contact.vertex;\n c.rect(vertex.x - 1.5, vertex.y - 1.5, 3.5, 3.5);\n }\n }\n\n if (options.wireframes) {\n c.fillStyle = 'rgba(255,255,255,0.7)';\n } else {\n c.fillStyle = 'orange';\n }\n c.fill();\n\n c.beginPath();\n\n // render collision normals\n for (i = 0; i < pairs.length; i++) {\n pair = pairs[i];\n\n if (!pair.isActive)\n continue;\n\n collision = pair.collision;\n\n if (pair.activeContacts.length > 0) {\n var normalPosX = pair.activeContacts[0].vertex.x,\n normalPosY = pair.activeContacts[0].vertex.y;\n\n if (pair.activeContacts.length === 2) {\n normalPosX = (pair.activeContacts[0].vertex.x + pair.activeContacts[1].vertex.x) / 2;\n normalPosY = (pair.activeContacts[0].vertex.y + pair.activeContacts[1].vertex.y) / 2;\n }\n\n if (collision.bodyB === collision.supports[0].body || collision.bodyA.isStatic === true) {\n c.moveTo(normalPosX - collision.normal.x * 8, normalPosY - collision.normal.y * 8);\n } else {\n c.moveTo(normalPosX + collision.normal.x * 8, normalPosY + collision.normal.y * 8);\n }\n\n c.lineTo(normalPosX, normalPosY);\n }\n }\n\n if (options.wireframes) {\n c.strokeStyle = 'rgba(255,165,0,0.7)';\n } else {\n c.strokeStyle = 'orange';\n }\n\n c.lineWidth = 1;\n c.stroke();\n };\n\n /**\n * Description\n * @private\n * @method separations\n * @param {render} render\n * @param {pair[]} pairs\n * @param {RenderingContext} context\n */\n Render.separations = function(render, pairs, context) {\n var c = context,\n options = render.options,\n pair,\n collision,\n corrected,\n bodyA,\n bodyB,\n i,\n j;\n\n c.beginPath();\n\n // render separations\n for (i = 0; i < pairs.length; i++) {\n pair = pairs[i];\n\n if (!pair.isActive)\n continue;\n\n collision = pair.collision;\n bodyA = collision.bodyA;\n bodyB = collision.bodyB;\n\n var k = 1;\n\n if (!bodyB.isStatic && !bodyA.isStatic) k = 0.5;\n if (bodyB.isStatic) k = 0;\n\n c.moveTo(bodyB.position.x, bodyB.position.y);\n c.lineTo(bodyB.position.x - collision.penetration.x * k, bodyB.position.y - collision.penetration.y * k);\n\n k = 1;\n\n if (!bodyB.isStatic && !bodyA.isStatic) k = 0.5;\n if (bodyA.isStatic) k = 0;\n\n c.moveTo(bodyA.position.x, bodyA.position.y);\n c.lineTo(bodyA.position.x + collision.penetration.x * k, bodyA.position.y + collision.penetration.y * k);\n }\n\n if (options.wireframes) {\n c.strokeStyle = 'rgba(255,165,0,0.5)';\n } else {\n c.strokeStyle = 'orange';\n }\n c.stroke();\n };\n\n /**\n * Description\n * @private\n * @method inspector\n * @param {inspector} inspector\n * @param {RenderingContext} context\n */\n Render.inspector = function(inspector, context) {\n var engine = inspector.engine,\n selected = inspector.selected,\n render = inspector.render,\n options = render.options,\n bounds;\n\n if (options.hasBounds) {\n var boundsWidth = render.bounds.max.x - render.bounds.min.x,\n boundsHeight = render.bounds.max.y - render.bounds.min.y,\n boundsScaleX = boundsWidth / render.options.width,\n boundsScaleY = boundsHeight / render.options.height;\n\n context.scale(1 / boundsScaleX, 1 / boundsScaleY);\n context.translate(-render.bounds.min.x, -render.bounds.min.y);\n }\n\n for (var i = 0; i < selected.length; i++) {\n var item = selected[i].data;\n\n context.translate(0.5, 0.5);\n context.lineWidth = 1;\n context.strokeStyle = 'rgba(255,165,0,0.9)';\n context.setLineDash([1,2]);\n\n switch (item.type) {\n\n case 'body':\n\n // render body selections\n bounds = item.bounds;\n context.beginPath();\n context.rect(Math.floor(bounds.min.x - 3), Math.floor(bounds.min.y - 3),\n Math.floor(bounds.max.x - bounds.min.x + 6), Math.floor(bounds.max.y - bounds.min.y + 6));\n context.closePath();\n context.stroke();\n\n break;\n\n case 'constraint':\n\n // render constraint selections\n var point = item.pointA;\n if (item.bodyA)\n point = item.pointB;\n context.beginPath();\n context.arc(point.x, point.y, 10, 0, 2 * Math.PI);\n context.closePath();\n context.stroke();\n\n break;\n\n }\n\n context.setLineDash([]);\n context.translate(-0.5, -0.5);\n }\n\n // render selection region\n if (inspector.selectStart !== null) {\n context.translate(0.5, 0.5);\n context.lineWidth = 1;\n context.strokeStyle = 'rgba(255,165,0,0.6)';\n context.fillStyle = 'rgba(255,165,0,0.1)';\n bounds = inspector.selectBounds;\n context.beginPath();\n context.rect(Math.floor(bounds.min.x), Math.floor(bounds.min.y),\n Math.floor(bounds.max.x - bounds.min.x), Math.floor(bounds.max.y - bounds.min.y));\n context.closePath();\n context.stroke();\n context.fill();\n context.translate(-0.5, -0.5);\n }\n\n if (options.hasBounds)\n context.setTransform(1, 0, 0, 1, 0, 0);\n };\n\n /**\n * Updates render timing.\n * @method _updateTiming\n * @private\n * @param {render} render\n * @param {number} time\n */\n var _updateTiming = function(render, time) {\n var engine = render.engine,\n timing = render.timing,\n historySize = timing.historySize,\n timestamp = engine.timing.timestamp;\n\n timing.delta = time - timing.lastTime || Render._goodDelta;\n timing.lastTime = time;\n\n timing.timestampElapsed = timestamp - timing.lastTimestamp || 0;\n timing.lastTimestamp = timestamp;\n\n timing.deltaHistory.unshift(timing.delta);\n timing.deltaHistory.length = Math.min(timing.deltaHistory.length, historySize);\n\n timing.engineDeltaHistory.unshift(engine.timing.lastDelta);\n timing.engineDeltaHistory.length = Math.min(timing.engineDeltaHistory.length, historySize);\n\n timing.timestampElapsedHistory.unshift(timing.timestampElapsed);\n timing.timestampElapsedHistory.length = Math.min(timing.timestampElapsedHistory.length, historySize);\n\n timing.engineElapsedHistory.unshift(engine.timing.lastElapsed);\n timing.engineElapsedHistory.length = Math.min(timing.engineElapsedHistory.length, historySize);\n\n timing.elapsedHistory.unshift(timing.lastElapsed);\n timing.elapsedHistory.length = Math.min(timing.elapsedHistory.length, historySize);\n };\n\n /**\n * Returns the mean value of the given numbers.\n * @method _mean\n * @private\n * @param {Number[]} values\n * @return {Number} the mean of given values\n */\n var _mean = function(values) {\n var result = 0;\n for (var i = 0; i < values.length; i += 1) {\n result += values[i];\n }\n return (result / values.length) || 0;\n };\n\n /**\n * @method _createCanvas\n * @private\n * @param {} width\n * @param {} height\n * @return canvas\n */\n var _createCanvas = function(width, height) {\n var canvas = document.createElement('canvas');\n canvas.width = width;\n canvas.height = height;\n canvas.oncontextmenu = function() { return false; };\n canvas.onselectstart = function() { return false; };\n return canvas;\n };\n\n /**\n * Gets the pixel ratio of the canvas.\n * @method _getPixelRatio\n * @private\n * @param {HTMLElement} canvas\n * @return {Number} pixel ratio\n */\n var _getPixelRatio = function(canvas) {\n var context = canvas.getContext('2d'),\n devicePixelRatio = window.devicePixelRatio || 1,\n backingStorePixelRatio = context.webkitBackingStorePixelRatio || context.mozBackingStorePixelRatio\n || context.msBackingStorePixelRatio || context.oBackingStorePixelRatio\n || context.backingStorePixelRatio || 1;\n\n return devicePixelRatio / backingStorePixelRatio;\n };\n\n /**\n * Gets the requested texture (an Image) via its path\n * @method _getTexture\n * @private\n * @param {render} render\n * @param {string} imagePath\n * @return {Image} texture\n */\n var _getTexture = function(render, imagePath) {\n var image = render.textures[imagePath];\n\n if (image)\n return image;\n\n image = render.textures[imagePath] = new Image();\n image.src = imagePath;\n\n return image;\n };\n\n /**\n * Applies the background to the canvas using CSS.\n * @method applyBackground\n * @private\n * @param {render} render\n * @param {string} background\n */\n var _applyBackground = function(render, background) {\n var cssBackground = background;\n\n if (/(jpg|gif|png)$/.test(background))\n cssBackground = 'url(' + background + ')';\n\n render.canvas.style.background = cssBackground;\n render.canvas.style.backgroundSize = \"contain\";\n render.currentBackground = background;\n };\n\n /*\n *\n * Events Documentation\n *\n */\n\n /**\n * Fired before rendering\n *\n * @event beforeRender\n * @param {} event An event object\n * @param {number} event.timestamp The engine.timing.timestamp of the event\n * @param {} event.source The source object of the event\n * @param {} event.name The name of the event\n */\n\n /**\n * Fired after rendering\n *\n * @event afterRender\n * @param {} event An event object\n * @param {number} event.timestamp The engine.timing.timestamp of the event\n * @param {} event.source The source object of the event\n * @param {} event.name The name of the event\n */\n\n /*\n *\n * Properties Documentation\n *\n */\n\n /**\n * A back-reference to the `Matter.Render` module.\n *\n * @property controller\n * @type render\n */\n\n /**\n * A reference to the `Matter.Engine` instance to be used.\n *\n * @property engine\n * @type engine\n */\n\n /**\n * A reference to the element where the canvas is to be inserted (if `render.canvas` has not been specified)\n *\n * @property element\n * @type HTMLElement\n * @default null\n */\n\n /**\n * The canvas element to render to. If not specified, one will be created if `render.element` has been specified.\n *\n * @property canvas\n * @type HTMLCanvasElement\n * @default null\n */\n\n /**\n * A `Bounds` object that specifies the drawing view region.\n * Rendering will be automatically transformed and scaled to fit within the canvas size (`render.options.width` and `render.options.height`).\n * This allows for creating views that can pan or zoom around the scene.\n * You must also set `render.options.hasBounds` to `true` to enable bounded rendering.\n *\n * @property bounds\n * @type bounds\n */\n\n /**\n * The 2d rendering context from the `render.canvas` element.\n *\n * @property context\n * @type CanvasRenderingContext2D\n */\n\n /**\n * The sprite texture cache.\n *\n * @property textures\n * @type {}\n */\n\n /**\n * The mouse to render if `render.options.showMousePosition` is enabled.\n *\n * @property mouse\n * @type mouse\n * @default null\n */\n\n /**\n * The configuration options of the renderer.\n *\n * @property options\n * @type {}\n */\n\n /**\n * The target width in pixels of the `render.canvas` to be created.\n * See also the `options.pixelRatio` property to change render quality.\n *\n * @property options.width\n * @type number\n * @default 800\n */\n\n /**\n * The target height in pixels of the `render.canvas` to be created.\n * See also the `options.pixelRatio` property to change render quality.\n *\n * @property options.height\n * @type number\n * @default 600\n */\n\n /**\n * The [pixel ratio](https://developer.mozilla.org/en-US/docs/Web/API/Window/devicePixelRatio) to use when rendering.\n *\n * @property options.pixelRatio\n * @type number\n * @default 1\n */\n\n /**\n * A CSS background color string to use when `render.options.wireframes` is disabled.\n * This may be also set to `'transparent'` or equivalent.\n *\n * @property options.background\n * @type string\n * @default '#14151f'\n */\n\n /**\n * A CSS background color string to use when `render.options.wireframes` is enabled.\n * This may be also set to `'transparent'` or equivalent.\n *\n * @property options.wireframeBackground\n * @type string\n * @default '#14151f'\n */\n\n /**\n * A flag that specifies if `render.bounds` should be used when rendering.\n *\n * @property options.hasBounds\n * @type boolean\n * @default false\n */\n\n /**\n * A flag to enable or disable all debug information overlays together. \n * This includes and has priority over the values of:\n *\n * - `render.options.showStats`\n * - `render.options.showPerformance`\n *\n * @property options.showDebug\n * @type boolean\n * @default false\n */\n\n /**\n * A flag to enable or disable the engine stats info overlay. \n * From left to right, the values shown are:\n *\n * - body parts total\n * - body total\n * - constraints total\n * - composites total\n * - collision pairs total\n *\n * @property options.showStats\n * @type boolean\n * @default false\n */\n\n /**\n * A flag to enable or disable performance charts. \n * From left to right, the values shown are:\n *\n * - average render frequency (e.g. 60 fps)\n * - exact engine delta time used for last update (e.g. 16.66ms)\n * - average engine execution duration (e.g. 5.00ms)\n * - average render execution duration (e.g. 0.40ms)\n * - average effective play speed (e.g. '1.00x' is 'real-time')\n *\n * Each value is recorded over a fixed sample of past frames (60 frames).\n *\n * A chart shown below each value indicates the variance from the average over the sample.\n * The more stable or fixed the value is the flatter the chart will appear.\n *\n * @property options.showPerformance\n * @type boolean\n * @default false\n */\n \n /**\n * A flag to enable or disable rendering entirely.\n *\n * @property options.enabled\n * @type boolean\n * @default false\n */\n\n /**\n * A flag to toggle wireframe rendering otherwise solid fill rendering is used.\n *\n * @property options.wireframes\n * @type boolean\n * @default true\n */\n\n /**\n * A flag to enable or disable sleeping bodies indicators.\n *\n * @property options.showSleeping\n * @type boolean\n * @default true\n */\n\n /**\n * A flag to enable or disable the debug information overlay.\n *\n * @property options.showDebug\n * @type boolean\n * @default false\n */\n\n /**\n * A flag to enable or disable the collision broadphase debug overlay.\n *\n * @deprecated no longer implemented\n * @property options.showBroadphase\n * @type boolean\n * @default false\n */\n\n /**\n * A flag to enable or disable the body bounds debug overlay.\n *\n * @property options.showBounds\n * @type boolean\n * @default false\n */\n\n /**\n * A flag to enable or disable the body velocity debug overlay.\n *\n * @property options.showVelocity\n * @type boolean\n * @default false\n */\n\n /**\n * A flag to enable or disable the body collisions debug overlay.\n *\n * @property options.showCollisions\n * @type boolean\n * @default false\n */\n\n /**\n * A flag to enable or disable the collision resolver separations debug overlay.\n *\n * @property options.showSeparations\n * @type boolean\n * @default false\n */\n\n /**\n * A flag to enable or disable the body axes debug overlay.\n *\n * @property options.showAxes\n * @type boolean\n * @default false\n */\n\n /**\n * A flag to enable or disable the body positions debug overlay.\n *\n * @property options.showPositions\n * @type boolean\n * @default false\n */\n\n /**\n * A flag to enable or disable the body angle debug overlay.\n *\n * @property options.showAngleIndicator\n * @type boolean\n * @default false\n */\n\n /**\n * A flag to enable or disable the body and part ids debug overlay.\n *\n * @property options.showIds\n * @type boolean\n * @default false\n */\n\n /**\n * A flag to enable or disable the body vertex numbers debug overlay.\n *\n * @property options.showVertexNumbers\n * @type boolean\n * @default false\n */\n\n /**\n * A flag to enable or disable the body convex hulls debug overlay.\n *\n * @property options.showConvexHulls\n * @type boolean\n * @default false\n */\n\n /**\n * A flag to enable or disable the body internal edges debug overlay.\n *\n * @property options.showInternalEdges\n * @type boolean\n * @default false\n */\n\n /**\n * A flag to enable or disable the mouse position debug overlay.\n *\n * @property options.showMousePosition\n * @type boolean\n * @default false\n */\n\n})();\n\n\n/***/ }),\n/* 17 */\n/***/ (function(module, exports) {\n\n/**\n* The `Matter.Contact` module contains methods for creating and manipulating collision contacts.\n*\n* @class Contact\n*/\n\nvar Contact = {};\n\nmodule.exports = Contact;\n\n(function() {\n\n /**\n * Creates a new contact.\n * @method create\n * @param {vertex} vertex\n * @return {contact} A new contact\n */\n Contact.create = function(vertex) {\n return {\n vertex: vertex,\n normalImpulse: 0,\n tangentImpulse: 0\n };\n };\n\n})();\n\n\n/***/ }),\n/* 18 */\n/***/ (function(module, exports, __webpack_require__) {\n\n/**\n* The `Matter.Engine` module contains methods for creating and manipulating engines.\n* An engine is a controller that manages updating the simulation of the world.\n* See `Matter.Runner` for an optional game loop utility.\n*\n* See the included usage [examples](https://github.com/liabru/matter-js/tree/master/examples).\n*\n* @class Engine\n*/\n\nvar Engine = {};\n\nmodule.exports = Engine;\n\nvar Sleeping = __webpack_require__(7);\nvar Resolver = __webpack_require__(19);\nvar Detector = __webpack_require__(14);\nvar Pairs = __webpack_require__(20);\nvar Events = __webpack_require__(4);\nvar Composite = __webpack_require__(5);\nvar Constraint = __webpack_require__(10);\nvar Common = __webpack_require__(0);\nvar Body = __webpack_require__(6);\n\n(function() {\n\n /**\n * Creates a new engine. The options parameter is an object that specifies any properties you wish to override the defaults.\n * All properties have default values, and many are pre-calculated automatically based on other properties.\n * See the properties section below for detailed information on what you can pass via the `options` object.\n * @method create\n * @param {object} [options]\n * @return {engine} engine\n */\n Engine.create = function(options) {\n options = options || {};\n\n var defaults = {\n positionIterations: 6,\n velocityIterations: 4,\n constraintIterations: 2,\n enableSleeping: false,\n events: [],\n plugin: {},\n gravity: {\n x: 0,\n y: 1,\n scale: 0.001\n },\n timing: {\n timestamp: 0,\n timeScale: 1,\n lastDelta: 0,\n lastElapsed: 0\n }\n };\n\n var engine = Common.extend(defaults, options);\n\n engine.world = options.world || Composite.create({ label: 'World' });\n engine.pairs = options.pairs || Pairs.create();\n engine.detector = options.detector || Detector.create();\n\n // for temporary back compatibility only\n engine.grid = { buckets: [] };\n engine.world.gravity = engine.gravity;\n engine.broadphase = engine.grid;\n engine.metrics = {};\n \n return engine;\n };\n\n /**\n * Moves the simulation forward in time by `delta` ms.\n * The `correction` argument is an optional `Number` that specifies the time correction factor to apply to the update.\n * This can help improve the accuracy of the simulation in cases where `delta` is changing between updates.\n * The value of `correction` is defined as `delta / lastDelta`, i.e. the percentage change of `delta` over the last step.\n * Therefore the value is always `1` (no correction) when `delta` constant (or when no correction is desired, which is the default).\n * See the paper on Time Corrected Verlet for more information.\n *\n * Triggers `beforeUpdate` and `afterUpdate` events.\n * Triggers `collisionStart`, `collisionActive` and `collisionEnd` events.\n * @method update\n * @param {engine} engine\n * @param {number} [delta=16.666]\n * @param {number} [correction=1]\n */\n Engine.update = function(engine, delta, correction) {\n var startTime = Common.now();\n\n delta = delta || 1000 / 60;\n correction = correction || 1;\n\n var world = engine.world,\n detector = engine.detector,\n pairs = engine.pairs,\n timing = engine.timing,\n timestamp = timing.timestamp,\n i;\n\n // increment timestamp\n timing.timestamp += delta * timing.timeScale;\n timing.lastDelta = delta * timing.timeScale;\n\n // create an event object\n var event = {\n timestamp: timing.timestamp\n };\n\n Events.trigger(engine, 'beforeUpdate', event);\n\n // get all bodies and all constraints in the world\n var allBodies = Composite.allBodies(world),\n allConstraints = Composite.allConstraints(world);\n\n // update the detector bodies if they have changed\n if (world.isModified) {\n Detector.setBodies(detector, allBodies);\n }\n\n // reset all composite modified flags\n if (world.isModified) {\n Composite.setModified(world, false, false, true);\n }\n\n // update sleeping if enabled\n if (engine.enableSleeping)\n Sleeping.update(allBodies, timing.timeScale);\n\n // apply gravity to all bodies\n Engine._bodiesApplyGravity(allBodies, engine.gravity);\n\n // update all body position and rotation by integration\n Engine._bodiesUpdate(allBodies, delta, timing.timeScale, correction, world.bounds);\n\n // update all constraints (first pass)\n Constraint.preSolveAll(allBodies);\n for (i = 0; i < engine.constraintIterations; i++) {\n Constraint.solveAll(allConstraints, timing.timeScale);\n }\n Constraint.postSolveAll(allBodies);\n\n // find all collisions\n detector.pairs = engine.pairs;\n var collisions = Detector.collisions(detector);\n\n // update collision pairs\n Pairs.update(pairs, collisions, timestamp);\n\n // wake up bodies involved in collisions\n if (engine.enableSleeping)\n Sleeping.afterCollisions(pairs.list, timing.timeScale);\n\n // trigger collision events\n if (pairs.collisionStart.length > 0)\n Events.trigger(engine, 'collisionStart', { pairs: pairs.collisionStart });\n\n // iteratively resolve position between collisions\n Resolver.preSolvePosition(pairs.list);\n for (i = 0; i < engine.positionIterations; i++) {\n Resolver.solvePosition(pairs.list, timing.timeScale);\n }\n Resolver.postSolvePosition(allBodies);\n\n // update all constraints (second pass)\n Constraint.preSolveAll(allBodies);\n for (i = 0; i < engine.constraintIterations; i++) {\n Constraint.solveAll(allConstraints, timing.timeScale);\n }\n Constraint.postSolveAll(allBodies);\n\n // iteratively resolve velocity between collisions\n Resolver.preSolveVelocity(pairs.list);\n for (i = 0; i < engine.velocityIterations; i++) {\n Resolver.solveVelocity(pairs.list, timing.timeScale);\n }\n\n // trigger collision events\n if (pairs.collisionActive.length > 0)\n Events.trigger(engine, 'collisionActive', { pairs: pairs.collisionActive });\n\n if (pairs.collisionEnd.length > 0)\n Events.trigger(engine, 'collisionEnd', { pairs: pairs.collisionEnd });\n\n // clear force buffers\n Engine._bodiesClearForces(allBodies);\n\n Events.trigger(engine, 'afterUpdate', event);\n\n // log the time elapsed computing this update\n engine.timing.lastElapsed = Common.now() - startTime;\n\n return engine;\n };\n \n /**\n * Merges two engines by keeping the configuration of `engineA` but replacing the world with the one from `engineB`.\n * @method merge\n * @param {engine} engineA\n * @param {engine} engineB\n */\n Engine.merge = function(engineA, engineB) {\n Common.extend(engineA, engineB);\n \n if (engineB.world) {\n engineA.world = engineB.world;\n\n Engine.clear(engineA);\n\n var bodies = Composite.allBodies(engineA.world);\n\n for (var i = 0; i < bodies.length; i++) {\n var body = bodies[i];\n Sleeping.set(body, false);\n body.id = Common.nextId();\n }\n }\n };\n\n /**\n * Clears the engine pairs and detector.\n * @method clear\n * @param {engine} engine\n */\n Engine.clear = function(engine) {\n Pairs.clear(engine.pairs);\n Detector.clear(engine.detector);\n };\n\n /**\n * Zeroes the `body.force` and `body.torque` force buffers.\n * @method _bodiesClearForces\n * @private\n * @param {body[]} bodies\n */\n Engine._bodiesClearForces = function(bodies) {\n for (var i = 0; i < bodies.length; i++) {\n var body = bodies[i];\n\n // reset force buffers\n body.force.x = 0;\n body.force.y = 0;\n body.torque = 0;\n }\n };\n\n /**\n * Applys a mass dependant force to all given bodies.\n * @method _bodiesApplyGravity\n * @private\n * @param {body[]} bodies\n * @param {vector} gravity\n */\n Engine._bodiesApplyGravity = function(bodies, gravity) {\n var gravityScale = typeof gravity.scale !== 'undefined' ? gravity.scale : 0.001;\n\n if ((gravity.x === 0 && gravity.y === 0) || gravityScale === 0) {\n return;\n }\n \n for (var i = 0; i < bodies.length; i++) {\n var body = bodies[i];\n\n if (body.isStatic || body.isSleeping)\n continue;\n\n // apply gravity\n body.force.y += body.mass * gravity.y * gravityScale;\n body.force.x += body.mass * gravity.x * gravityScale;\n }\n };\n\n /**\n * Applys `Body.update` to all given `bodies`.\n * @method _bodiesUpdate\n * @private\n * @param {body[]} bodies\n * @param {number} deltaTime \n * The amount of time elapsed between updates\n * @param {number} timeScale\n * @param {number} correction \n * The Verlet correction factor (deltaTime / lastDeltaTime)\n * @param {bounds} worldBounds\n */\n Engine._bodiesUpdate = function(bodies, deltaTime, timeScale, correction, worldBounds) {\n for (var i = 0; i < bodies.length; i++) {\n var body = bodies[i];\n\n if (body.isStatic || body.isSleeping)\n continue;\n\n Body.update(body, deltaTime, timeScale, correction);\n }\n };\n\n /**\n * A deprecated alias for `Runner.run`, use `Matter.Runner.run(engine)` instead and see `Matter.Runner` for more information.\n * @deprecated use Matter.Runner.run(engine) instead\n * @method run\n * @param {engine} engine\n */\n\n /**\n * Fired just before an update\n *\n * @event beforeUpdate\n * @param {object} event An event object\n * @param {number} event.timestamp The engine.timing.timestamp of the event\n * @param {engine} event.source The source object of the event\n * @param {string} event.name The name of the event\n */\n\n /**\n * Fired after engine update and all collision events\n *\n * @event afterUpdate\n * @param {object} event An event object\n * @param {number} event.timestamp The engine.timing.timestamp of the event\n * @param {engine} event.source The source object of the event\n * @param {string} event.name The name of the event\n */\n\n /**\n * Fired after engine update, provides a list of all pairs that have started to collide in the current tick (if any)\n *\n * @event collisionStart\n * @param {object} event An event object\n * @param {pair[]} event.pairs List of affected pairs\n * @param {number} event.timestamp The engine.timing.timestamp of the event\n * @param {engine} event.source The source object of the event\n * @param {string} event.name The name of the event\n */\n\n /**\n * Fired after engine update, provides a list of all pairs that are colliding in the current tick (if any)\n *\n * @event collisionActive\n * @param {object} event An event object\n * @param {pair[]} event.pairs List of affected pairs\n * @param {number} event.timestamp The engine.timing.timestamp of the event\n * @param {engine} event.source The source object of the event\n * @param {string} event.name The name of the event\n */\n\n /**\n * Fired after engine update, provides a list of all pairs that have ended collision in the current tick (if any)\n *\n * @event collisionEnd\n * @param {object} event An event object\n * @param {pair[]} event.pairs List of affected pairs\n * @param {number} event.timestamp The engine.timing.timestamp of the event\n * @param {engine} event.source The source object of the event\n * @param {string} event.name The name of the event\n */\n\n /*\n *\n * Properties Documentation\n *\n */\n\n /**\n * An integer `Number` that specifies the number of position iterations to perform each update.\n * The higher the value, the higher quality the simulation will be at the expense of performance.\n *\n * @property positionIterations\n * @type number\n * @default 6\n */\n\n /**\n * An integer `Number` that specifies the number of velocity iterations to perform each update.\n * The higher the value, the higher quality the simulation will be at the expense of performance.\n *\n * @property velocityIterations\n * @type number\n * @default 4\n */\n\n /**\n * An integer `Number` that specifies the number of constraint iterations to perform each update.\n * The higher the value, the higher quality the simulation will be at the expense of performance.\n * The default value of `2` is usually very adequate.\n *\n * @property constraintIterations\n * @type number\n * @default 2\n */\n\n /**\n * A flag that specifies whether the engine should allow sleeping via the `Matter.Sleeping` module.\n * Sleeping can improve stability and performance, but often at the expense of accuracy.\n *\n * @property enableSleeping\n * @type boolean\n * @default false\n */\n\n /**\n * An `Object` containing properties regarding the timing systems of the engine. \n *\n * @property timing\n * @type object\n */\n\n /**\n * A `Number` that specifies the global scaling factor of time for all bodies.\n * A value of `0` freezes the simulation.\n * A value of `0.1` gives a slow-motion effect.\n * A value of `1.2` gives a speed-up effect.\n *\n * @property timing.timeScale\n * @type number\n * @default 1\n */\n\n /**\n * A `Number` that specifies the current simulation-time in milliseconds starting from `0`. \n * It is incremented on every `Engine.update` by the given `delta` argument. \n *\n * @property timing.timestamp\n * @type number\n * @default 0\n */\n\n /**\n * A `Number` that represents the total execution time elapsed during the last `Engine.update` in milliseconds.\n * It is updated by timing from the start of the last `Engine.update` call until it ends.\n *\n * This value will also include the total execution time of all event handlers directly or indirectly triggered by the engine update.\n *\n * @property timing.lastElapsed\n * @type number\n * @default 0\n */\n\n /**\n * A `Number` that represents the `delta` value used in the last engine update.\n *\n * @property timing.lastDelta\n * @type number\n * @default 0\n */\n\n /**\n * A `Matter.Detector` instance.\n *\n * @property detector\n * @type detector\n * @default a Matter.Detector instance\n */\n\n /**\n * A `Matter.Grid` instance.\n *\n * @deprecated replaced by `engine.detector`\n * @property grid\n * @type grid\n * @default a Matter.Grid instance\n */\n\n /**\n * Replaced by and now alias for `engine.grid`.\n *\n * @deprecated replaced by `engine.detector`\n * @property broadphase\n * @type grid\n * @default a Matter.Grid instance\n */\n\n /**\n * The root `Matter.Composite` instance that will contain all bodies, constraints and other composites to be simulated by this engine.\n *\n * @property world\n * @type composite\n * @default a Matter.Composite instance\n */\n\n /**\n * An object reserved for storing plugin-specific properties.\n *\n * @property plugin\n * @type {}\n */\n\n /**\n * The gravity to apply on all bodies in `engine.world`.\n *\n * @property gravity\n * @type object\n */\n\n /**\n * The gravity x component.\n *\n * @property gravity.x\n * @type object\n * @default 0\n */\n\n /**\n * The gravity y component.\n *\n * @property gravity.y\n * @type object\n * @default 1\n */\n\n /**\n * The gravity scale factor.\n *\n * @property gravity.scale\n * @type object\n * @default 0.001\n */\n\n})();\n\n\n/***/ }),\n/* 19 */\n/***/ (function(module, exports, __webpack_require__) {\n\n/**\n* The `Matter.Resolver` module contains methods for resolving collision pairs.\n*\n* @class Resolver\n*/\n\nvar Resolver = {};\n\nmodule.exports = Resolver;\n\nvar Vertices = __webpack_require__(3);\nvar Bounds = __webpack_require__(1);\n\n(function() {\n\n Resolver._restingThresh = 4;\n Resolver._restingThreshTangent = 6;\n Resolver._positionDampen = 0.9;\n Resolver._positionWarming = 0.8;\n Resolver._frictionNormalMultiplier = 5;\n\n /**\n * Prepare pairs for position solving.\n * @method preSolvePosition\n * @param {pair[]} pairs\n */\n Resolver.preSolvePosition = function(pairs) {\n var i,\n pair,\n activeCount,\n pairsLength = pairs.length;\n\n // find total contacts on each body\n for (i = 0; i < pairsLength; i++) {\n pair = pairs[i];\n \n if (!pair.isActive)\n continue;\n \n activeCount = pair.activeContacts.length;\n pair.collision.parentA.totalContacts += activeCount;\n pair.collision.parentB.totalContacts += activeCount;\n }\n };\n\n /**\n * Find a solution for pair positions.\n * @method solvePosition\n * @param {pair[]} pairs\n * @param {number} timeScale\n */\n Resolver.solvePosition = function(pairs, timeScale) {\n var i,\n pair,\n collision,\n bodyA,\n bodyB,\n normal,\n contactShare,\n positionImpulse,\n positionDampen = Resolver._positionDampen,\n pairsLength = pairs.length;\n\n // find impulses required to resolve penetration\n for (i = 0; i < pairsLength; i++) {\n pair = pairs[i];\n \n if (!pair.isActive || pair.isSensor)\n continue;\n\n collision = pair.collision;\n bodyA = collision.parentA;\n bodyB = collision.parentB;\n normal = collision.normal;\n\n // get current separation between body edges involved in collision\n pair.separation = \n normal.x * (bodyB.positionImpulse.x + collision.penetration.x - bodyA.positionImpulse.x)\n + normal.y * (bodyB.positionImpulse.y + collision.penetration.y - bodyA.positionImpulse.y);\n }\n \n for (i = 0; i < pairsLength; i++) {\n pair = pairs[i];\n\n if (!pair.isActive || pair.isSensor)\n continue;\n \n collision = pair.collision;\n bodyA = collision.parentA;\n bodyB = collision.parentB;\n normal = collision.normal;\n positionImpulse = (pair.separation - pair.slop) * timeScale;\n\n if (bodyA.isStatic || bodyB.isStatic)\n positionImpulse *= 2;\n \n if (!(bodyA.isStatic || bodyA.isSleeping)) {\n contactShare = positionDampen / bodyA.totalContacts;\n bodyA.positionImpulse.x += normal.x * positionImpulse * contactShare;\n bodyA.positionImpulse.y += normal.y * positionImpulse * contactShare;\n }\n\n if (!(bodyB.isStatic || bodyB.isSleeping)) {\n contactShare = positionDampen / bodyB.totalContacts;\n bodyB.positionImpulse.x -= normal.x * positionImpulse * contactShare;\n bodyB.positionImpulse.y -= normal.y * positionImpulse * contactShare;\n }\n }\n };\n\n /**\n * Apply position resolution.\n * @method postSolvePosition\n * @param {body[]} bodies\n */\n Resolver.postSolvePosition = function(bodies) {\n var positionWarming = Resolver._positionWarming,\n bodiesLength = bodies.length,\n verticesTranslate = Vertices.translate,\n boundsUpdate = Bounds.update;\n\n for (var i = 0; i < bodiesLength; i++) {\n var body = bodies[i],\n positionImpulse = body.positionImpulse,\n positionImpulseX = positionImpulse.x,\n positionImpulseY = positionImpulse.y,\n velocity = body.velocity;\n\n // reset contact count\n body.totalContacts = 0;\n\n if (positionImpulseX !== 0 || positionImpulseY !== 0) {\n // update body geometry\n for (var j = 0; j < body.parts.length; j++) {\n var part = body.parts[j];\n verticesTranslate(part.vertices, positionImpulse);\n boundsUpdate(part.bounds, part.vertices, velocity);\n part.position.x += positionImpulseX;\n part.position.y += positionImpulseY;\n }\n\n // move the body without changing velocity\n body.positionPrev.x += positionImpulseX;\n body.positionPrev.y += positionImpulseY;\n\n if (positionImpulseX * velocity.x + positionImpulseY * velocity.y < 0) {\n // reset cached impulse if the body has velocity along it\n positionImpulse.x = 0;\n positionImpulse.y = 0;\n } else {\n // warm the next iteration\n positionImpulse.x *= positionWarming;\n positionImpulse.y *= positionWarming;\n }\n }\n }\n };\n\n /**\n * Prepare pairs for velocity solving.\n * @method preSolveVelocity\n * @param {pair[]} pairs\n */\n Resolver.preSolveVelocity = function(pairs) {\n var pairsLength = pairs.length,\n i,\n j;\n \n for (i = 0; i < pairsLength; i++) {\n var pair = pairs[i];\n \n if (!pair.isActive || pair.isSensor)\n continue;\n \n var contacts = pair.activeContacts,\n contactsLength = contacts.length,\n collision = pair.collision,\n bodyA = collision.parentA,\n bodyB = collision.parentB,\n normal = collision.normal,\n tangent = collision.tangent;\n \n // resolve each contact\n for (j = 0; j < contactsLength; j++) {\n var contact = contacts[j],\n contactVertex = contact.vertex,\n normalImpulse = contact.normalImpulse,\n tangentImpulse = contact.tangentImpulse;\n \n if (normalImpulse !== 0 || tangentImpulse !== 0) {\n // total impulse from contact\n var impulseX = normal.x * normalImpulse + tangent.x * tangentImpulse,\n impulseY = normal.y * normalImpulse + tangent.y * tangentImpulse;\n \n // apply impulse from contact\n if (!(bodyA.isStatic || bodyA.isSleeping)) {\n bodyA.positionPrev.x += impulseX * bodyA.inverseMass;\n bodyA.positionPrev.y += impulseY * bodyA.inverseMass;\n bodyA.anglePrev += bodyA.inverseInertia * (\n (contactVertex.x - bodyA.position.x) * impulseY\n - (contactVertex.y - bodyA.position.y) * impulseX\n );\n }\n \n if (!(bodyB.isStatic || bodyB.isSleeping)) {\n bodyB.positionPrev.x -= impulseX * bodyB.inverseMass;\n bodyB.positionPrev.y -= impulseY * bodyB.inverseMass;\n bodyB.anglePrev -= bodyB.inverseInertia * (\n (contactVertex.x - bodyB.position.x) * impulseY \n - (contactVertex.y - bodyB.position.y) * impulseX\n );\n }\n }\n }\n }\n };\n\n /**\n * Find a solution for pair velocities.\n * @method solveVelocity\n * @param {pair[]} pairs\n * @param {number} timeScale\n */\n Resolver.solveVelocity = function(pairs, timeScale) {\n var timeScaleSquared = timeScale * timeScale,\n restingThresh = Resolver._restingThresh * timeScaleSquared,\n frictionNormalMultiplier = Resolver._frictionNormalMultiplier,\n restingThreshTangent = Resolver._restingThreshTangent * timeScaleSquared,\n NumberMaxValue = Number.MAX_VALUE,\n pairsLength = pairs.length,\n tangentImpulse,\n maxFriction,\n i,\n j;\n\n for (i = 0; i < pairsLength; i++) {\n var pair = pairs[i];\n \n if (!pair.isActive || pair.isSensor)\n continue;\n \n var collision = pair.collision,\n bodyA = collision.parentA,\n bodyB = collision.parentB,\n bodyAVelocity = bodyA.velocity,\n bodyBVelocity = bodyB.velocity,\n normalX = collision.normal.x,\n normalY = collision.normal.y,\n tangentX = collision.tangent.x,\n tangentY = collision.tangent.y,\n contacts = pair.activeContacts,\n contactsLength = contacts.length,\n contactShare = 1 / contactsLength,\n inverseMassTotal = bodyA.inverseMass + bodyB.inverseMass,\n friction = pair.friction * pair.frictionStatic * frictionNormalMultiplier * timeScaleSquared;\n\n // update body velocities\n bodyAVelocity.x = bodyA.position.x - bodyA.positionPrev.x;\n bodyAVelocity.y = bodyA.position.y - bodyA.positionPrev.y;\n bodyBVelocity.x = bodyB.position.x - bodyB.positionPrev.x;\n bodyBVelocity.y = bodyB.position.y - bodyB.positionPrev.y;\n bodyA.angularVelocity = bodyA.angle - bodyA.anglePrev;\n bodyB.angularVelocity = bodyB.angle - bodyB.anglePrev;\n\n // resolve each contact\n for (j = 0; j < contactsLength; j++) {\n var contact = contacts[j],\n contactVertex = contact.vertex;\n\n var offsetAX = contactVertex.x - bodyA.position.x,\n offsetAY = contactVertex.y - bodyA.position.y,\n offsetBX = contactVertex.x - bodyB.position.x,\n offsetBY = contactVertex.y - bodyB.position.y;\n \n var velocityPointAX = bodyAVelocity.x - offsetAY * bodyA.angularVelocity,\n velocityPointAY = bodyAVelocity.y + offsetAX * bodyA.angularVelocity,\n velocityPointBX = bodyBVelocity.x - offsetBY * bodyB.angularVelocity,\n velocityPointBY = bodyBVelocity.y + offsetBX * bodyB.angularVelocity;\n\n var relativeVelocityX = velocityPointAX - velocityPointBX,\n relativeVelocityY = velocityPointAY - velocityPointBY;\n\n var normalVelocity = normalX * relativeVelocityX + normalY * relativeVelocityY,\n tangentVelocity = tangentX * relativeVelocityX + tangentY * relativeVelocityY;\n\n // coulomb friction\n var normalOverlap = pair.separation + normalVelocity;\n var normalForce = Math.min(normalOverlap, 1);\n normalForce = normalOverlap < 0 ? 0 : normalForce;\n \n var frictionLimit = normalForce * friction;\n\n if (tangentVelocity > frictionLimit || -tangentVelocity > frictionLimit) {\n maxFriction = tangentVelocity > 0 ? tangentVelocity : -tangentVelocity;\n tangentImpulse = pair.friction * (tangentVelocity > 0 ? 1 : -1) * timeScaleSquared;\n \n if (tangentImpulse < -maxFriction) {\n tangentImpulse = -maxFriction;\n } else if (tangentImpulse > maxFriction) {\n tangentImpulse = maxFriction;\n }\n } else {\n tangentImpulse = tangentVelocity;\n maxFriction = NumberMaxValue;\n }\n\n // account for mass, inertia and contact offset\n var oAcN = offsetAX * normalY - offsetAY * normalX,\n oBcN = offsetBX * normalY - offsetBY * normalX,\n share = contactShare / (inverseMassTotal + bodyA.inverseInertia * oAcN * oAcN + bodyB.inverseInertia * oBcN * oBcN);\n\n // raw impulses\n var normalImpulse = (1 + pair.restitution) * normalVelocity * share;\n tangentImpulse *= share;\n\n // handle high velocity and resting collisions separately\n if (normalVelocity * normalVelocity > restingThresh && normalVelocity < 0) {\n // high normal velocity so clear cached contact normal impulse\n contact.normalImpulse = 0;\n } else {\n // solve resting collision constraints using Erin Catto's method (GDC08)\n // impulse constraint tends to 0\n var contactNormalImpulse = contact.normalImpulse;\n contact.normalImpulse += normalImpulse;\n contact.normalImpulse = Math.min(contact.normalImpulse, 0);\n normalImpulse = contact.normalImpulse - contactNormalImpulse;\n }\n\n // handle high velocity and resting collisions separately\n if (tangentVelocity * tangentVelocity > restingThreshTangent) {\n // high tangent velocity so clear cached contact tangent impulse\n contact.tangentImpulse = 0;\n } else {\n // solve resting collision constraints using Erin Catto's method (GDC08)\n // tangent impulse tends to -tangentSpeed or +tangentSpeed\n var contactTangentImpulse = contact.tangentImpulse;\n contact.tangentImpulse += tangentImpulse;\n if (contact.tangentImpulse < -maxFriction) contact.tangentImpulse = -maxFriction;\n if (contact.tangentImpulse > maxFriction) contact.tangentImpulse = maxFriction;\n tangentImpulse = contact.tangentImpulse - contactTangentImpulse;\n }\n\n // total impulse from contact\n var impulseX = normalX * normalImpulse + tangentX * tangentImpulse,\n impulseY = normalY * normalImpulse + tangentY * tangentImpulse;\n \n // apply impulse from contact\n if (!(bodyA.isStatic || bodyA.isSleeping)) {\n bodyA.positionPrev.x += impulseX * bodyA.inverseMass;\n bodyA.positionPrev.y += impulseY * bodyA.inverseMass;\n bodyA.anglePrev += (offsetAX * impulseY - offsetAY * impulseX) * bodyA.inverseInertia;\n }\n\n if (!(bodyB.isStatic || bodyB.isSleeping)) {\n bodyB.positionPrev.x -= impulseX * bodyB.inverseMass;\n bodyB.positionPrev.y -= impulseY * bodyB.inverseMass;\n bodyB.anglePrev -= (offsetBX * impulseY - offsetBY * impulseX) * bodyB.inverseInertia;\n }\n }\n }\n };\n\n})();\n\n\n/***/ }),\n/* 20 */\n/***/ (function(module, exports, __webpack_require__) {\n\n/**\n* The `Matter.Pairs` module contains methods for creating and manipulating collision pair sets.\n*\n* @class Pairs\n*/\n\nvar Pairs = {};\n\nmodule.exports = Pairs;\n\nvar Pair = __webpack_require__(9);\nvar Common = __webpack_require__(0);\n\n(function() {\n\n /**\n * Creates a new pairs structure.\n * @method create\n * @param {object} options\n * @return {pairs} A new pairs structure\n */\n Pairs.create = function(options) {\n return Common.extend({ \n table: {},\n list: [],\n collisionStart: [],\n collisionActive: [],\n collisionEnd: []\n }, options);\n };\n\n /**\n * Updates pairs given a list of collisions.\n * @method update\n * @param {object} pairs\n * @param {collision[]} collisions\n * @param {number} timestamp\n */\n Pairs.update = function(pairs, collisions, timestamp) {\n var pairsList = pairs.list,\n pairsListLength = pairsList.length,\n pairsTable = pairs.table,\n collisionsLength = collisions.length,\n collisionStart = pairs.collisionStart,\n collisionEnd = pairs.collisionEnd,\n collisionActive = pairs.collisionActive,\n collision,\n pairIndex,\n pair,\n i;\n\n // clear collision state arrays, but maintain old reference\n collisionStart.length = 0;\n collisionEnd.length = 0;\n collisionActive.length = 0;\n\n for (i = 0; i < pairsListLength; i++) {\n pairsList[i].confirmedActive = false;\n }\n\n for (i = 0; i < collisionsLength; i++) {\n collision = collisions[i];\n pair = collision.pair;\n\n if (pair) {\n // pair already exists (but may or may not be active)\n if (pair.isActive) {\n // pair exists and is active\n collisionActive.push(pair);\n } else {\n // pair exists but was inactive, so a collision has just started again\n collisionStart.push(pair);\n }\n\n // update the pair\n Pair.update(pair, collision, timestamp);\n pair.confirmedActive = true;\n } else {\n // pair did not exist, create a new pair\n pair = Pair.create(collision, timestamp);\n pairsTable[pair.id] = pair;\n\n // push the new pair\n collisionStart.push(pair);\n pairsList.push(pair);\n }\n }\n\n // find pairs that are no longer active\n var removePairIndex = [];\n pairsListLength = pairsList.length;\n\n for (i = 0; i < pairsListLength; i++) {\n pair = pairsList[i];\n \n if (!pair.confirmedActive) {\n Pair.setActive(pair, false, timestamp);\n collisionEnd.push(pair);\n\n if (!pair.collision.bodyA.isSleeping && !pair.collision.bodyB.isSleeping) {\n removePairIndex.push(i);\n }\n }\n }\n\n // remove inactive pairs\n for (i = 0; i < removePairIndex.length; i++) {\n pairIndex = removePairIndex[i] - i;\n pair = pairsList[pairIndex];\n pairsList.splice(pairIndex, 1);\n delete pairsTable[pair.id];\n }\n };\n\n /**\n * Clears the given pairs structure.\n * @method clear\n * @param {pairs} pairs\n * @return {pairs} pairs\n */\n Pairs.clear = function(pairs) {\n pairs.table = {};\n pairs.list.length = 0;\n pairs.collisionStart.length = 0;\n pairs.collisionActive.length = 0;\n pairs.collisionEnd.length = 0;\n return pairs;\n };\n\n})();\n\n\n/***/ }),\n/* 21 */\n/***/ (function(module, exports, __webpack_require__) {\n\nvar Matter = module.exports = __webpack_require__(22);\r\n\r\nMatter.Axes = __webpack_require__(11);\r\nMatter.Bodies = __webpack_require__(12);\r\nMatter.Body = __webpack_require__(6);\r\nMatter.Bounds = __webpack_require__(1);\r\nMatter.Collision = __webpack_require__(8);\r\nMatter.Common = __webpack_require__(0);\r\nMatter.Composite = __webpack_require__(5);\r\nMatter.Composites = __webpack_require__(23);\r\nMatter.Constraint = __webpack_require__(10);\r\nMatter.Contact = __webpack_require__(17);\r\nMatter.Detector = __webpack_require__(14);\r\nMatter.Engine = __webpack_require__(18);\r\nMatter.Events = __webpack_require__(4);\r\nMatter.Grid = __webpack_require__(24);\r\nMatter.Mouse = __webpack_require__(13);\r\nMatter.MouseConstraint = __webpack_require__(25);\r\nMatter.Pair = __webpack_require__(9);\r\nMatter.Pairs = __webpack_require__(20);\r\nMatter.Plugin = __webpack_require__(15);\r\nMatter.Query = __webpack_require__(26);\r\nMatter.Render = __webpack_require__(16);\r\nMatter.Resolver = __webpack_require__(19);\r\nMatter.Runner = __webpack_require__(27);\r\nMatter.SAT = __webpack_require__(28);\r\nMatter.Sleeping = __webpack_require__(7);\r\nMatter.Svg = __webpack_require__(29);\r\nMatter.Vector = __webpack_require__(2);\r\nMatter.Vertices = __webpack_require__(3);\r\nMatter.World = __webpack_require__(30);\r\n\r\n// temporary back compatibility\r\nMatter.Engine.run = Matter.Runner.run;\r\nMatter.Common.deprecated(Matter.Engine, 'run', 'Engine.run ➤ use Matter.Runner.run(engine) instead');\r\n\n\n/***/ }),\n/* 22 */\n/***/ (function(module, exports, __webpack_require__) {\n\n/**\r\n* The `Matter` module is the top level namespace. It also includes a function for installing plugins on top of the library.\r\n*\r\n* @class Matter\r\n*/\r\n\r\nvar Matter = {};\r\n\r\nmodule.exports = Matter;\r\n\r\nvar Plugin = __webpack_require__(15);\r\nvar Common = __webpack_require__(0);\r\n\r\n(function() {\r\n\r\n /**\r\n * The library name.\r\n * @property name\r\n * @readOnly\r\n * @type {String}\r\n */\r\n Matter.name = 'matter-js';\r\n\r\n /**\r\n * The library version.\r\n * @property version\r\n * @readOnly\r\n * @type {String}\r\n */\r\n Matter.version = true ? \"0.18.0\" : undefined;\r\n\r\n /**\r\n * A list of plugin dependencies to be installed. These are normally set and installed through `Matter.use`.\r\n * Alternatively you may set `Matter.uses` manually and install them by calling `Plugin.use(Matter)`.\r\n * @property uses\r\n * @type {Array}\r\n */\r\n Matter.uses = [];\r\n\r\n /**\r\n * The plugins that have been installed through `Matter.Plugin.install`. Read only.\r\n * @property used\r\n * @readOnly\r\n * @type {Array}\r\n */\r\n Matter.used = [];\r\n\r\n /**\r\n * Installs the given plugins on the `Matter` namespace.\r\n * This is a short-hand for `Plugin.use`, see it for more information.\r\n * Call this function once at the start of your code, with all of the plugins you wish to install as arguments.\r\n * Avoid calling this function multiple times unless you intend to manually control installation order.\r\n * @method use\r\n * @param ...plugin {Function} The plugin(s) to install on `base` (multi-argument).\r\n */\r\n Matter.use = function() {\r\n Plugin.use(Matter, Array.prototype.slice.call(arguments));\r\n };\r\n\r\n /**\r\n * Chains a function to excute before the original function on the given `path` relative to `Matter`.\r\n * See also docs for `Common.chain`.\r\n * @method before\r\n * @param {string} path The path relative to `Matter`\r\n * @param {function} func The function to chain before the original\r\n * @return {function} The chained function that replaced the original\r\n */\r\n Matter.before = function(path, func) {\r\n path = path.replace(/^Matter./, '');\r\n return Common.chainPathBefore(Matter, path, func);\r\n };\r\n\r\n /**\r\n * Chains a function to excute after the original function on the given `path` relative to `Matter`.\r\n * See also docs for `Common.chain`.\r\n * @method after\r\n * @param {string} path The path relative to `Matter`\r\n * @param {function} func The function to chain after the original\r\n * @return {function} The chained function that replaced the original\r\n */\r\n Matter.after = function(path, func) {\r\n path = path.replace(/^Matter./, '');\r\n return Common.chainPathAfter(Matter, path, func);\r\n };\r\n\r\n})();\r\n\n\n/***/ }),\n/* 23 */\n/***/ (function(module, exports, __webpack_require__) {\n\n/**\n* The `Matter.Composites` module contains factory methods for creating composite bodies\n* with commonly used configurations (such as stacks and chains).\n*\n* See the included usage [examples](https://github.com/liabru/matter-js/tree/master/examples).\n*\n* @class Composites\n*/\n\nvar Composites = {};\n\nmodule.exports = Composites;\n\nvar Composite = __webpack_require__(5);\nvar Constraint = __webpack_require__(10);\nvar Common = __webpack_require__(0);\nvar Body = __webpack_require__(6);\nvar Bodies = __webpack_require__(12);\nvar deprecated = Common.deprecated;\n\n(function() {\n\n /**\n * Create a new composite containing bodies created in the callback in a grid arrangement.\n * This function uses the body's bounds to prevent overlaps.\n * @method stack\n * @param {number} xx\n * @param {number} yy\n * @param {number} columns\n * @param {number} rows\n * @param {number} columnGap\n * @param {number} rowGap\n * @param {function} callback\n * @return {composite} A new composite containing objects created in the callback\n */\n Composites.stack = function(xx, yy, columns, rows, columnGap, rowGap, callback) {\n var stack = Composite.create({ label: 'Stack' }),\n x = xx,\n y = yy,\n lastBody,\n i = 0;\n\n for (var row = 0; row < rows; row++) {\n var maxHeight = 0;\n \n for (var column = 0; column < columns; column++) {\n var body = callback(x, y, column, row, lastBody, i);\n \n if (body) {\n var bodyHeight = body.bounds.max.y - body.bounds.min.y,\n bodyWidth = body.bounds.max.x - body.bounds.min.x; \n\n if (bodyHeight > maxHeight)\n maxHeight = bodyHeight;\n \n Body.translate(body, { x: bodyWidth * 0.5, y: bodyHeight * 0.5 });\n\n x = body.bounds.max.x + columnGap;\n\n Composite.addBody(stack, body);\n \n lastBody = body;\n i += 1;\n } else {\n x += columnGap;\n }\n }\n \n y += maxHeight + rowGap;\n x = xx;\n }\n\n return stack;\n };\n \n /**\n * Chains all bodies in the given composite together using constraints.\n * @method chain\n * @param {composite} composite\n * @param {number} xOffsetA\n * @param {number} yOffsetA\n * @param {number} xOffsetB\n * @param {number} yOffsetB\n * @param {object} options\n * @return {composite} A new composite containing objects chained together with constraints\n */\n Composites.chain = function(composite, xOffsetA, yOffsetA, xOffsetB, yOffsetB, options) {\n var bodies = composite.bodies;\n \n for (var i = 1; i < bodies.length; i++) {\n var bodyA = bodies[i - 1],\n bodyB = bodies[i],\n bodyAHeight = bodyA.bounds.max.y - bodyA.bounds.min.y,\n bodyAWidth = bodyA.bounds.max.x - bodyA.bounds.min.x, \n bodyBHeight = bodyB.bounds.max.y - bodyB.bounds.min.y,\n bodyBWidth = bodyB.bounds.max.x - bodyB.bounds.min.x;\n \n var defaults = {\n bodyA: bodyA,\n pointA: { x: bodyAWidth * xOffsetA, y: bodyAHeight * yOffsetA },\n bodyB: bodyB,\n pointB: { x: bodyBWidth * xOffsetB, y: bodyBHeight * yOffsetB }\n };\n \n var constraint = Common.extend(defaults, options);\n \n Composite.addConstraint(composite, Constraint.create(constraint));\n }\n\n composite.label += ' Chain';\n \n return composite;\n };\n\n /**\n * Connects bodies in the composite with constraints in a grid pattern, with optional cross braces.\n * @method mesh\n * @param {composite} composite\n * @param {number} columns\n * @param {number} rows\n * @param {boolean} crossBrace\n * @param {object} options\n * @return {composite} The composite containing objects meshed together with constraints\n */\n Composites.mesh = function(composite, columns, rows, crossBrace, options) {\n var bodies = composite.bodies,\n row,\n col,\n bodyA,\n bodyB,\n bodyC;\n \n for (row = 0; row < rows; row++) {\n for (col = 1; col < columns; col++) {\n bodyA = bodies[(col - 1) + (row * columns)];\n bodyB = bodies[col + (row * columns)];\n Composite.addConstraint(composite, Constraint.create(Common.extend({ bodyA: bodyA, bodyB: bodyB }, options)));\n }\n\n if (row > 0) {\n for (col = 0; col < columns; col++) {\n bodyA = bodies[col + ((row - 1) * columns)];\n bodyB = bodies[col + (row * columns)];\n Composite.addConstraint(composite, Constraint.create(Common.extend({ bodyA: bodyA, bodyB: bodyB }, options)));\n\n if (crossBrace && col > 0) {\n bodyC = bodies[(col - 1) + ((row - 1) * columns)];\n Composite.addConstraint(composite, Constraint.create(Common.extend({ bodyA: bodyC, bodyB: bodyB }, options)));\n }\n\n if (crossBrace && col < columns - 1) {\n bodyC = bodies[(col + 1) + ((row - 1) * columns)];\n Composite.addConstraint(composite, Constraint.create(Common.extend({ bodyA: bodyC, bodyB: bodyB }, options)));\n }\n }\n }\n }\n\n composite.label += ' Mesh';\n \n return composite;\n };\n \n /**\n * Create a new composite containing bodies created in the callback in a pyramid arrangement.\n * This function uses the body's bounds to prevent overlaps.\n * @method pyramid\n * @param {number} xx\n * @param {number} yy\n * @param {number} columns\n * @param {number} rows\n * @param {number} columnGap\n * @param {number} rowGap\n * @param {function} callback\n * @return {composite} A new composite containing objects created in the callback\n */\n Composites.pyramid = function(xx, yy, columns, rows, columnGap, rowGap, callback) {\n return Composites.stack(xx, yy, columns, rows, columnGap, rowGap, function(x, y, column, row, lastBody, i) {\n var actualRows = Math.min(rows, Math.ceil(columns / 2)),\n lastBodyWidth = lastBody ? lastBody.bounds.max.x - lastBody.bounds.min.x : 0;\n \n if (row > actualRows)\n return;\n \n // reverse row order\n row = actualRows - row;\n \n var start = row,\n end = columns - 1 - row;\n\n if (column < start || column > end)\n return;\n \n // retroactively fix the first body's position, since width was unknown\n if (i === 1) {\n Body.translate(lastBody, { x: (column + (columns % 2 === 1 ? 1 : -1)) * lastBodyWidth, y: 0 });\n }\n\n var xOffset = lastBody ? column * lastBodyWidth : 0;\n \n return callback(xx + xOffset + column * columnGap, y, column, row, lastBody, i);\n });\n };\n\n /**\n * This has now moved to the [newtonsCradle example](https://github.com/liabru/matter-js/blob/master/examples/newtonsCradle.js), follow that instead as this function is deprecated here.\n * @deprecated moved to newtonsCradle example\n * @method newtonsCradle\n * @param {number} xx\n * @param {number} yy\n * @param {number} number\n * @param {number} size\n * @param {number} length\n * @return {composite} A new composite newtonsCradle body\n */\n Composites.newtonsCradle = function(xx, yy, number, size, length) {\n var newtonsCradle = Composite.create({ label: 'Newtons Cradle' });\n\n for (var i = 0; i < number; i++) {\n var separation = 1.9,\n circle = Bodies.circle(xx + i * (size * separation), yy + length, size, \n { inertia: Infinity, restitution: 1, friction: 0, frictionAir: 0.0001, slop: 1 }),\n constraint = Constraint.create({ pointA: { x: xx + i * (size * separation), y: yy }, bodyB: circle });\n\n Composite.addBody(newtonsCradle, circle);\n Composite.addConstraint(newtonsCradle, constraint);\n }\n\n return newtonsCradle;\n };\n\n deprecated(Composites, 'newtonsCradle', 'Composites.newtonsCradle ➤ moved to newtonsCradle example');\n \n /**\n * This has now moved to the [car example](https://github.com/liabru/matter-js/blob/master/examples/car.js), follow that instead as this function is deprecated here.\n * @deprecated moved to car example\n * @method car\n * @param {number} xx\n * @param {number} yy\n * @param {number} width\n * @param {number} height\n * @param {number} wheelSize\n * @return {composite} A new composite car body\n */\n Composites.car = function(xx, yy, width, height, wheelSize) {\n var group = Body.nextGroup(true),\n wheelBase = 20,\n wheelAOffset = -width * 0.5 + wheelBase,\n wheelBOffset = width * 0.5 - wheelBase,\n wheelYOffset = 0;\n \n var car = Composite.create({ label: 'Car' }),\n body = Bodies.rectangle(xx, yy, width, height, { \n collisionFilter: {\n group: group\n },\n chamfer: {\n radius: height * 0.5\n },\n density: 0.0002\n });\n \n var wheelA = Bodies.circle(xx + wheelAOffset, yy + wheelYOffset, wheelSize, { \n collisionFilter: {\n group: group\n },\n friction: 0.8\n });\n \n var wheelB = Bodies.circle(xx + wheelBOffset, yy + wheelYOffset, wheelSize, { \n collisionFilter: {\n group: group\n },\n friction: 0.8\n });\n \n var axelA = Constraint.create({\n bodyB: body,\n pointB: { x: wheelAOffset, y: wheelYOffset },\n bodyA: wheelA,\n stiffness: 1,\n length: 0\n });\n \n var axelB = Constraint.create({\n bodyB: body,\n pointB: { x: wheelBOffset, y: wheelYOffset },\n bodyA: wheelB,\n stiffness: 1,\n length: 0\n });\n \n Composite.addBody(car, body);\n Composite.addBody(car, wheelA);\n Composite.addBody(car, wheelB);\n Composite.addConstraint(car, axelA);\n Composite.addConstraint(car, axelB);\n\n return car;\n };\n\n deprecated(Composites, 'car', 'Composites.car ➤ moved to car example');\n\n /**\n * This has now moved to the [softBody example](https://github.com/liabru/matter-js/blob/master/examples/softBody.js)\n * and the [cloth example](https://github.com/liabru/matter-js/blob/master/examples/cloth.js), follow those instead as this function is deprecated here.\n * @deprecated moved to softBody and cloth examples\n * @method softBody\n * @param {number} xx\n * @param {number} yy\n * @param {number} columns\n * @param {number} rows\n * @param {number} columnGap\n * @param {number} rowGap\n * @param {boolean} crossBrace\n * @param {number} particleRadius\n * @param {} particleOptions\n * @param {} constraintOptions\n * @return {composite} A new composite softBody\n */\n Composites.softBody = function(xx, yy, columns, rows, columnGap, rowGap, crossBrace, particleRadius, particleOptions, constraintOptions) {\n particleOptions = Common.extend({ inertia: Infinity }, particleOptions);\n constraintOptions = Common.extend({ stiffness: 0.2, render: { type: 'line', anchors: false } }, constraintOptions);\n\n var softBody = Composites.stack(xx, yy, columns, rows, columnGap, rowGap, function(x, y) {\n return Bodies.circle(x, y, particleRadius, particleOptions);\n });\n\n Composites.mesh(softBody, columns, rows, crossBrace, constraintOptions);\n\n softBody.label = 'Soft Body';\n\n return softBody;\n };\n\n deprecated(Composites, 'softBody', 'Composites.softBody ➤ moved to softBody and cloth examples');\n})();\n\n\n/***/ }),\n/* 24 */\n/***/ (function(module, exports, __webpack_require__) {\n\n/**\n* This module has now been replaced by `Matter.Detector`.\n*\n* All usage should be migrated to `Matter.Detector` or another alternative.\n* For back-compatibility purposes this module will remain for a short term and then later removed in a future release.\n*\n* The `Matter.Grid` module contains methods for creating and manipulating collision broadphase grid structures.\n*\n* @class Grid\n* @deprecated\n*/\n\nvar Grid = {};\n\nmodule.exports = Grid;\n\nvar Pair = __webpack_require__(9);\nvar Common = __webpack_require__(0);\nvar deprecated = Common.deprecated;\n\n(function() {\n\n /**\n * Creates a new grid.\n * @deprecated replaced by Matter.Detector\n * @method create\n * @param {} options\n * @return {grid} A new grid\n */\n Grid.create = function(options) {\n var defaults = {\n buckets: {},\n pairs: {},\n pairsList: [],\n bucketWidth: 48,\n bucketHeight: 48\n };\n\n return Common.extend(defaults, options);\n };\n\n /**\n * The width of a single grid bucket.\n *\n * @property bucketWidth\n * @type number\n * @default 48\n */\n\n /**\n * The height of a single grid bucket.\n *\n * @property bucketHeight\n * @type number\n * @default 48\n */\n\n /**\n * Updates the grid.\n * @deprecated replaced by Matter.Detector\n * @method update\n * @param {grid} grid\n * @param {body[]} bodies\n * @param {engine} engine\n * @param {boolean} forceUpdate\n */\n Grid.update = function(grid, bodies, engine, forceUpdate) {\n var i, col, row,\n world = engine.world,\n buckets = grid.buckets,\n bucket,\n bucketId,\n gridChanged = false;\n\n for (i = 0; i < bodies.length; i++) {\n var body = bodies[i];\n\n if (body.isSleeping && !forceUpdate)\n continue;\n\n // temporary back compatibility bounds check\n if (world.bounds && (body.bounds.max.x < world.bounds.min.x || body.bounds.min.x > world.bounds.max.x\n || body.bounds.max.y < world.bounds.min.y || body.bounds.min.y > world.bounds.max.y))\n continue;\n\n var newRegion = Grid._getRegion(grid, body);\n\n // if the body has changed grid region\n if (!body.region || newRegion.id !== body.region.id || forceUpdate) {\n\n if (!body.region || forceUpdate)\n body.region = newRegion;\n\n var union = Grid._regionUnion(newRegion, body.region);\n\n // update grid buckets affected by region change\n // iterate over the union of both regions\n for (col = union.startCol; col <= union.endCol; col++) {\n for (row = union.startRow; row <= union.endRow; row++) {\n bucketId = Grid._getBucketId(col, row);\n bucket = buckets[bucketId];\n\n var isInsideNewRegion = (col >= newRegion.startCol && col <= newRegion.endCol\n && row >= newRegion.startRow && row <= newRegion.endRow);\n\n var isInsideOldRegion = (col >= body.region.startCol && col <= body.region.endCol\n && row >= body.region.startRow && row <= body.region.endRow);\n\n // remove from old region buckets\n if (!isInsideNewRegion && isInsideOldRegion) {\n if (isInsideOldRegion) {\n if (bucket)\n Grid._bucketRemoveBody(grid, bucket, body);\n }\n }\n\n // add to new region buckets\n if (body.region === newRegion || (isInsideNewRegion && !isInsideOldRegion) || forceUpdate) {\n if (!bucket)\n bucket = Grid._createBucket(buckets, bucketId);\n Grid._bucketAddBody(grid, bucket, body);\n }\n }\n }\n\n // set the new region\n body.region = newRegion;\n\n // flag changes so we can update pairs\n gridChanged = true;\n }\n }\n\n // update pairs list only if pairs changed (i.e. a body changed region)\n if (gridChanged)\n grid.pairsList = Grid._createActivePairsList(grid);\n };\n\n deprecated(Grid, 'update', 'Grid.update ➤ replaced by Matter.Detector');\n\n /**\n * Clears the grid.\n * @deprecated replaced by Matter.Detector\n * @method clear\n * @param {grid} grid\n */\n Grid.clear = function(grid) {\n grid.buckets = {};\n grid.pairs = {};\n grid.pairsList = [];\n };\n\n deprecated(Grid, 'clear', 'Grid.clear ➤ replaced by Matter.Detector');\n\n /**\n * Finds the union of two regions.\n * @method _regionUnion\n * @deprecated replaced by Matter.Detector\n * @private\n * @param {} regionA\n * @param {} regionB\n * @return {} region\n */\n Grid._regionUnion = function(regionA, regionB) {\n var startCol = Math.min(regionA.startCol, regionB.startCol),\n endCol = Math.max(regionA.endCol, regionB.endCol),\n startRow = Math.min(regionA.startRow, regionB.startRow),\n endRow = Math.max(regionA.endRow, regionB.endRow);\n\n return Grid._createRegion(startCol, endCol, startRow, endRow);\n };\n\n /**\n * Gets the region a given body falls in for a given grid.\n * @method _getRegion\n * @deprecated replaced by Matter.Detector\n * @private\n * @param {} grid\n * @param {} body\n * @return {} region\n */\n Grid._getRegion = function(grid, body) {\n var bounds = body.bounds,\n startCol = Math.floor(bounds.min.x / grid.bucketWidth),\n endCol = Math.floor(bounds.max.x / grid.bucketWidth),\n startRow = Math.floor(bounds.min.y / grid.bucketHeight),\n endRow = Math.floor(bounds.max.y / grid.bucketHeight);\n\n return Grid._createRegion(startCol, endCol, startRow, endRow);\n };\n\n /**\n * Creates a region.\n * @method _createRegion\n * @deprecated replaced by Matter.Detector\n * @private\n * @param {} startCol\n * @param {} endCol\n * @param {} startRow\n * @param {} endRow\n * @return {} region\n */\n Grid._createRegion = function(startCol, endCol, startRow, endRow) {\n return { \n id: startCol + ',' + endCol + ',' + startRow + ',' + endRow,\n startCol: startCol, \n endCol: endCol, \n startRow: startRow, \n endRow: endRow \n };\n };\n\n /**\n * Gets the bucket id at the given position.\n * @method _getBucketId\n * @deprecated replaced by Matter.Detector\n * @private\n * @param {} column\n * @param {} row\n * @return {string} bucket id\n */\n Grid._getBucketId = function(column, row) {\n return 'C' + column + 'R' + row;\n };\n\n /**\n * Creates a bucket.\n * @method _createBucket\n * @deprecated replaced by Matter.Detector\n * @private\n * @param {} buckets\n * @param {} bucketId\n * @return {} bucket\n */\n Grid._createBucket = function(buckets, bucketId) {\n var bucket = buckets[bucketId] = [];\n return bucket;\n };\n\n /**\n * Adds a body to a bucket.\n * @method _bucketAddBody\n * @deprecated replaced by Matter.Detector\n * @private\n * @param {} grid\n * @param {} bucket\n * @param {} body\n */\n Grid._bucketAddBody = function(grid, bucket, body) {\n var gridPairs = grid.pairs,\n pairId = Pair.id,\n bucketLength = bucket.length,\n i;\n\n // add new pairs\n for (i = 0; i < bucketLength; i++) {\n var bodyB = bucket[i];\n\n if (body.id === bodyB.id || (body.isStatic && bodyB.isStatic))\n continue;\n\n // keep track of the number of buckets the pair exists in\n // important for Grid.update to work\n var id = pairId(body, bodyB),\n pair = gridPairs[id];\n\n if (pair) {\n pair[2] += 1;\n } else {\n gridPairs[id] = [body, bodyB, 1];\n }\n }\n\n // add to bodies (after pairs, otherwise pairs with self)\n bucket.push(body);\n };\n\n /**\n * Removes a body from a bucket.\n * @method _bucketRemoveBody\n * @deprecated replaced by Matter.Detector\n * @private\n * @param {} grid\n * @param {} bucket\n * @param {} body\n */\n Grid._bucketRemoveBody = function(grid, bucket, body) {\n var gridPairs = grid.pairs,\n pairId = Pair.id,\n i;\n\n // remove from bucket\n bucket.splice(Common.indexOf(bucket, body), 1);\n\n var bucketLength = bucket.length;\n\n // update pair counts\n for (i = 0; i < bucketLength; i++) {\n // keep track of the number of buckets the pair exists in\n // important for _createActivePairsList to work\n var pair = gridPairs[pairId(body, bucket[i])];\n\n if (pair)\n pair[2] -= 1;\n }\n };\n\n /**\n * Generates a list of the active pairs in the grid.\n * @method _createActivePairsList\n * @deprecated replaced by Matter.Detector\n * @private\n * @param {} grid\n * @return [] pairs\n */\n Grid._createActivePairsList = function(grid) {\n var pair,\n gridPairs = grid.pairs,\n pairKeys = Common.keys(gridPairs),\n pairKeysLength = pairKeys.length,\n pairs = [],\n k;\n\n // iterate over grid.pairs\n for (k = 0; k < pairKeysLength; k++) {\n pair = gridPairs[pairKeys[k]];\n\n // if pair exists in at least one bucket\n // it is a pair that needs further collision testing so push it\n if (pair[2] > 0) {\n pairs.push(pair);\n } else {\n delete gridPairs[pairKeys[k]];\n }\n }\n\n return pairs;\n };\n \n})();\n\n\n/***/ }),\n/* 25 */\n/***/ (function(module, exports, __webpack_require__) {\n\n/**\n* The `Matter.MouseConstraint` module contains methods for creating mouse constraints.\n* Mouse constraints are used for allowing user interaction, providing the ability to move bodies via the mouse or touch.\n*\n* See the included usage [examples](https://github.com/liabru/matter-js/tree/master/examples).\n*\n* @class MouseConstraint\n*/\n\nvar MouseConstraint = {};\n\nmodule.exports = MouseConstraint;\n\nvar Vertices = __webpack_require__(3);\nvar Sleeping = __webpack_require__(7);\nvar Mouse = __webpack_require__(13);\nvar Events = __webpack_require__(4);\nvar Detector = __webpack_require__(14);\nvar Constraint = __webpack_require__(10);\nvar Composite = __webpack_require__(5);\nvar Common = __webpack_require__(0);\nvar Bounds = __webpack_require__(1);\n\n(function() {\n\n /**\n * Creates a new mouse constraint.\n * All properties have default values, and many are pre-calculated automatically based on other properties.\n * See the properties section below for detailed information on what you can pass via the `options` object.\n * @method create\n * @param {engine} engine\n * @param {} options\n * @return {MouseConstraint} A new MouseConstraint\n */\n MouseConstraint.create = function(engine, options) {\n var mouse = (engine ? engine.mouse : null) || (options ? options.mouse : null);\n\n if (!mouse) {\n if (engine && engine.render && engine.render.canvas) {\n mouse = Mouse.create(engine.render.canvas);\n } else if (options && options.element) {\n mouse = Mouse.create(options.element);\n } else {\n mouse = Mouse.create();\n Common.warn('MouseConstraint.create: options.mouse was undefined, options.element was undefined, may not function as expected');\n }\n }\n\n var constraint = Constraint.create({ \n label: 'Mouse Constraint',\n pointA: mouse.position,\n pointB: { x: 0, y: 0 },\n length: 0.01, \n stiffness: 0.1,\n angularStiffness: 1,\n render: {\n strokeStyle: '#90EE90',\n lineWidth: 3\n }\n });\n\n var defaults = {\n type: 'mouseConstraint',\n mouse: mouse,\n element: null,\n body: null,\n constraint: constraint,\n collisionFilter: {\n category: 0x0001,\n mask: 0xFFFFFFFF,\n group: 0\n }\n };\n\n var mouseConstraint = Common.extend(defaults, options);\n\n Events.on(engine, 'beforeUpdate', function() {\n var allBodies = Composite.allBodies(engine.world);\n MouseConstraint.update(mouseConstraint, allBodies);\n MouseConstraint._triggerEvents(mouseConstraint);\n });\n\n return mouseConstraint;\n };\n\n /**\n * Updates the given mouse constraint.\n * @private\n * @method update\n * @param {MouseConstraint} mouseConstraint\n * @param {body[]} bodies\n */\n MouseConstraint.update = function(mouseConstraint, bodies) {\n var mouse = mouseConstraint.mouse,\n constraint = mouseConstraint.constraint,\n body = mouseConstraint.body;\n\n if (mouse.button === 0) {\n if (!constraint.bodyB) {\n for (var i = 0; i < bodies.length; i++) {\n body = bodies[i];\n if (Bounds.contains(body.bounds, mouse.position) \n && Detector.canCollide(body.collisionFilter, mouseConstraint.collisionFilter)) {\n for (var j = body.parts.length > 1 ? 1 : 0; j < body.parts.length; j++) {\n var part = body.parts[j];\n if (Vertices.contains(part.vertices, mouse.position)) {\n constraint.pointA = mouse.position;\n constraint.bodyB = mouseConstraint.body = body;\n constraint.pointB = { x: mouse.position.x - body.position.x, y: mouse.position.y - body.position.y };\n constraint.angleB = body.angle;\n\n Sleeping.set(body, false);\n Events.trigger(mouseConstraint, 'startdrag', { mouse: mouse, body: body });\n\n break;\n }\n }\n }\n }\n } else {\n Sleeping.set(constraint.bodyB, false);\n constraint.pointA = mouse.position;\n }\n } else {\n constraint.bodyB = mouseConstraint.body = null;\n constraint.pointB = null;\n\n if (body)\n Events.trigger(mouseConstraint, 'enddrag', { mouse: mouse, body: body });\n }\n };\n\n /**\n * Triggers mouse constraint events.\n * @method _triggerEvents\n * @private\n * @param {mouse} mouseConstraint\n */\n MouseConstraint._triggerEvents = function(mouseConstraint) {\n var mouse = mouseConstraint.mouse,\n mouseEvents = mouse.sourceEvents;\n\n if (mouseEvents.mousemove)\n Events.trigger(mouseConstraint, 'mousemove', { mouse: mouse });\n\n if (mouseEvents.mousedown)\n Events.trigger(mouseConstraint, 'mousedown', { mouse: mouse });\n\n if (mouseEvents.mouseup)\n Events.trigger(mouseConstraint, 'mouseup', { mouse: mouse });\n\n // reset the mouse state ready for the next step\n Mouse.clearSourceEvents(mouse);\n };\n\n /*\n *\n * Events Documentation\n *\n */\n\n /**\n * Fired when the mouse has moved (or a touch moves) during the last step\n *\n * @event mousemove\n * @param {} event An event object\n * @param {mouse} event.mouse The engine's mouse instance\n * @param {} event.source The source object of the event\n * @param {} event.name The name of the event\n */\n\n /**\n * Fired when the mouse is down (or a touch has started) during the last step\n *\n * @event mousedown\n * @param {} event An event object\n * @param {mouse} event.mouse The engine's mouse instance\n * @param {} event.source The source object of the event\n * @param {} event.name The name of the event\n */\n\n /**\n * Fired when the mouse is up (or a touch has ended) during the last step\n *\n * @event mouseup\n * @param {} event An event object\n * @param {mouse} event.mouse The engine's mouse instance\n * @param {} event.source The source object of the event\n * @param {} event.name The name of the event\n */\n\n /**\n * Fired when the user starts dragging a body\n *\n * @event startdrag\n * @param {} event An event object\n * @param {mouse} event.mouse The engine's mouse instance\n * @param {body} event.body The body being dragged\n * @param {} event.source The source object of the event\n * @param {} event.name The name of the event\n */\n\n /**\n * Fired when the user ends dragging a body\n *\n * @event enddrag\n * @param {} event An event object\n * @param {mouse} event.mouse The engine's mouse instance\n * @param {body} event.body The body that has stopped being dragged\n * @param {} event.source The source object of the event\n * @param {} event.name The name of the event\n */\n\n /*\n *\n * Properties Documentation\n *\n */\n\n /**\n * A `String` denoting the type of object.\n *\n * @property type\n * @type string\n * @default \"constraint\"\n * @readOnly\n */\n\n /**\n * The `Mouse` instance in use. If not supplied in `MouseConstraint.create`, one will be created.\n *\n * @property mouse\n * @type mouse\n * @default mouse\n */\n\n /**\n * The `Body` that is currently being moved by the user, or `null` if no body.\n *\n * @property body\n * @type body\n * @default null\n */\n\n /**\n * The `Constraint` object that is used to move the body during interaction.\n *\n * @property constraint\n * @type constraint\n */\n\n /**\n * An `Object` that specifies the collision filter properties.\n * The collision filter allows the user to define which types of body this mouse constraint can interact with.\n * See `body.collisionFilter` for more information.\n *\n * @property collisionFilter\n * @type object\n */\n\n})();\n\n\n/***/ }),\n/* 26 */\n/***/ (function(module, exports, __webpack_require__) {\n\n/**\n* The `Matter.Query` module contains methods for performing collision queries.\n*\n* See the included usage [examples](https://github.com/liabru/matter-js/tree/master/examples).\n*\n* @class Query\n*/\n\nvar Query = {};\n\nmodule.exports = Query;\n\nvar Vector = __webpack_require__(2);\nvar Collision = __webpack_require__(8);\nvar Bounds = __webpack_require__(1);\nvar Bodies = __webpack_require__(12);\nvar Vertices = __webpack_require__(3);\n\n(function() {\n\n /**\n * Returns a list of collisions between `body` and `bodies`.\n * @method collides\n * @param {body} body\n * @param {body[]} bodies\n * @return {collision[]} Collisions\n */\n Query.collides = function(body, bodies) {\n var collisions = [],\n bodiesLength = bodies.length,\n bounds = body.bounds,\n collides = Collision.collides,\n overlaps = Bounds.overlaps;\n\n for (var i = 0; i < bodiesLength; i++) {\n var bodyA = bodies[i],\n partsALength = bodyA.parts.length,\n partsAStart = partsALength === 1 ? 0 : 1;\n \n if (overlaps(bodyA.bounds, bounds)) {\n for (var j = partsAStart; j < partsALength; j++) {\n var part = bodyA.parts[j];\n\n if (overlaps(part.bounds, bounds)) {\n var collision = collides(part, body);\n\n if (collision) {\n collisions.push(collision);\n break;\n }\n }\n }\n }\n }\n\n return collisions;\n };\n\n /**\n * Casts a ray segment against a set of bodies and returns all collisions, ray width is optional. Intersection points are not provided.\n * @method ray\n * @param {body[]} bodies\n * @param {vector} startPoint\n * @param {vector} endPoint\n * @param {number} [rayWidth]\n * @return {collision[]} Collisions\n */\n Query.ray = function(bodies, startPoint, endPoint, rayWidth) {\n rayWidth = rayWidth || 1e-100;\n\n var rayAngle = Vector.angle(startPoint, endPoint),\n rayLength = Vector.magnitude(Vector.sub(startPoint, endPoint)),\n rayX = (endPoint.x + startPoint.x) * 0.5,\n rayY = (endPoint.y + startPoint.y) * 0.5,\n ray = Bodies.rectangle(rayX, rayY, rayLength, rayWidth, { angle: rayAngle }),\n collisions = Query.collides(ray, bodies);\n\n for (var i = 0; i < collisions.length; i += 1) {\n var collision = collisions[i];\n collision.body = collision.bodyB = collision.bodyA; \n }\n\n return collisions;\n };\n\n /**\n * Returns all bodies whose bounds are inside (or outside if set) the given set of bounds, from the given set of bodies.\n * @method region\n * @param {body[]} bodies\n * @param {bounds} bounds\n * @param {bool} [outside=false]\n * @return {body[]} The bodies matching the query\n */\n Query.region = function(bodies, bounds, outside) {\n var result = [];\n\n for (var i = 0; i < bodies.length; i++) {\n var body = bodies[i],\n overlaps = Bounds.overlaps(body.bounds, bounds);\n if ((overlaps && !outside) || (!overlaps && outside))\n result.push(body);\n }\n\n return result;\n };\n\n /**\n * Returns all bodies whose vertices contain the given point, from the given set of bodies.\n * @method point\n * @param {body[]} bodies\n * @param {vector} point\n * @return {body[]} The bodies matching the query\n */\n Query.point = function(bodies, point) {\n var result = [];\n\n for (var i = 0; i < bodies.length; i++) {\n var body = bodies[i];\n \n if (Bounds.contains(body.bounds, point)) {\n for (var j = body.parts.length === 1 ? 0 : 1; j < body.parts.length; j++) {\n var part = body.parts[j];\n\n if (Bounds.contains(part.bounds, point)\n && Vertices.contains(part.vertices, point)) {\n result.push(body);\n break;\n }\n }\n }\n }\n\n return result;\n };\n\n})();\n\n\n/***/ }),\n/* 27 */\n/***/ (function(module, exports, __webpack_require__) {\n\n/**\n* The `Matter.Runner` module is an optional utility which provides a game loop, \n* that handles continuously updating a `Matter.Engine` for you within a browser.\n* It is intended for development and debugging purposes, but may also be suitable for simple games.\n* If you are using your own game loop instead, then you do not need the `Matter.Runner` module.\n* Instead just call `Engine.update(engine, delta)` in your own loop.\n*\n* See the included usage [examples](https://github.com/liabru/matter-js/tree/master/examples).\n*\n* @class Runner\n*/\n\nvar Runner = {};\n\nmodule.exports = Runner;\n\nvar Events = __webpack_require__(4);\nvar Engine = __webpack_require__(18);\nvar Common = __webpack_require__(0);\n\n(function() {\n\n var _requestAnimationFrame,\n _cancelAnimationFrame;\n\n if (typeof window !== 'undefined') {\n _requestAnimationFrame = window.requestAnimationFrame || window.webkitRequestAnimationFrame\n || window.mozRequestAnimationFrame || window.msRequestAnimationFrame;\n \n _cancelAnimationFrame = window.cancelAnimationFrame || window.mozCancelAnimationFrame \n || window.webkitCancelAnimationFrame || window.msCancelAnimationFrame;\n }\n\n if (!_requestAnimationFrame) {\n var _frameTimeout;\n\n _requestAnimationFrame = function(callback){ \n _frameTimeout = setTimeout(function() { \n callback(Common.now()); \n }, 1000 / 60);\n };\n\n _cancelAnimationFrame = function() {\n clearTimeout(_frameTimeout);\n };\n }\n\n /**\n * Creates a new Runner. The options parameter is an object that specifies any properties you wish to override the defaults.\n * @method create\n * @param {} options\n */\n Runner.create = function(options) {\n var defaults = {\n fps: 60,\n correction: 1,\n deltaSampleSize: 60,\n counterTimestamp: 0,\n frameCounter: 0,\n deltaHistory: [],\n timePrev: null,\n timeScalePrev: 1,\n frameRequestId: null,\n isFixed: false,\n enabled: true\n };\n\n var runner = Common.extend(defaults, options);\n\n runner.delta = runner.delta || 1000 / runner.fps;\n runner.deltaMin = runner.deltaMin || 1000 / runner.fps;\n runner.deltaMax = runner.deltaMax || 1000 / (runner.fps * 0.5);\n runner.fps = 1000 / runner.delta;\n\n return runner;\n };\n\n /**\n * Continuously ticks a `Matter.Engine` by calling `Runner.tick` on the `requestAnimationFrame` event.\n * @method run\n * @param {engine} engine\n */\n Runner.run = function(runner, engine) {\n // create runner if engine is first argument\n if (typeof runner.positionIterations !== 'undefined') {\n engine = runner;\n runner = Runner.create();\n }\n\n (function render(time){\n runner.frameRequestId = _requestAnimationFrame(render);\n\n if (time && runner.enabled) {\n Runner.tick(runner, engine, time);\n }\n })();\n\n return runner;\n };\n\n /**\n * A game loop utility that updates the engine and renderer by one step (a 'tick').\n * Features delta smoothing, time correction and fixed or dynamic timing.\n * Consider just `Engine.update(engine, delta)` if you're using your own loop.\n * @method tick\n * @param {runner} runner\n * @param {engine} engine\n * @param {number} time\n */\n Runner.tick = function(runner, engine, time) {\n var timing = engine.timing,\n correction = 1,\n delta;\n\n // create an event object\n var event = {\n timestamp: timing.timestamp\n };\n\n Events.trigger(runner, 'beforeTick', event);\n\n if (runner.isFixed) {\n // fixed timestep\n delta = runner.delta;\n } else {\n // dynamic timestep based on wall clock between calls\n delta = (time - runner.timePrev) || runner.delta;\n runner.timePrev = time;\n\n // optimistically filter delta over a few frames, to improve stability\n runner.deltaHistory.push(delta);\n runner.deltaHistory = runner.deltaHistory.slice(-runner.deltaSampleSize);\n delta = Math.min.apply(null, runner.deltaHistory);\n \n // limit delta\n delta = delta < runner.deltaMin ? runner.deltaMin : delta;\n delta = delta > runner.deltaMax ? runner.deltaMax : delta;\n\n // correction for delta\n correction = delta / runner.delta;\n\n // update engine timing object\n runner.delta = delta;\n }\n\n // time correction for time scaling\n if (runner.timeScalePrev !== 0)\n correction *= timing.timeScale / runner.timeScalePrev;\n\n if (timing.timeScale === 0)\n correction = 0;\n\n runner.timeScalePrev = timing.timeScale;\n runner.correction = correction;\n\n // fps counter\n runner.frameCounter += 1;\n if (time - runner.counterTimestamp >= 1000) {\n runner.fps = runner.frameCounter * ((time - runner.counterTimestamp) / 1000);\n runner.counterTimestamp = time;\n runner.frameCounter = 0;\n }\n\n Events.trigger(runner, 'tick', event);\n\n // update\n Events.trigger(runner, 'beforeUpdate', event);\n Engine.update(engine, delta, correction);\n Events.trigger(runner, 'afterUpdate', event);\n\n Events.trigger(runner, 'afterTick', event);\n };\n\n /**\n * Ends execution of `Runner.run` on the given `runner`, by canceling the animation frame request event loop.\n * If you wish to only temporarily pause the engine, see `engine.enabled` instead.\n * @method stop\n * @param {runner} runner\n */\n Runner.stop = function(runner) {\n _cancelAnimationFrame(runner.frameRequestId);\n };\n\n /**\n * Alias for `Runner.run`.\n * @method start\n * @param {runner} runner\n * @param {engine} engine\n */\n Runner.start = function(runner, engine) {\n Runner.run(runner, engine);\n };\n\n /*\n *\n * Events Documentation\n *\n */\n\n /**\n * Fired at the start of a tick, before any updates to the engine or timing\n *\n * @event beforeTick\n * @param {} event An event object\n * @param {number} event.timestamp The engine.timing.timestamp of the event\n * @param {} event.source The source object of the event\n * @param {} event.name The name of the event\n */\n\n /**\n * Fired after engine timing updated, but just before update\n *\n * @event tick\n * @param {} event An event object\n * @param {number} event.timestamp The engine.timing.timestamp of the event\n * @param {} event.source The source object of the event\n * @param {} event.name The name of the event\n */\n\n /**\n * Fired at the end of a tick, after engine update and after rendering\n *\n * @event afterTick\n * @param {} event An event object\n * @param {number} event.timestamp The engine.timing.timestamp of the event\n * @param {} event.source The source object of the event\n * @param {} event.name The name of the event\n */\n\n /**\n * Fired before update\n *\n * @event beforeUpdate\n * @param {} event An event object\n * @param {number} event.timestamp The engine.timing.timestamp of the event\n * @param {} event.source The source object of the event\n * @param {} event.name The name of the event\n */\n\n /**\n * Fired after update\n *\n * @event afterUpdate\n * @param {} event An event object\n * @param {number} event.timestamp The engine.timing.timestamp of the event\n * @param {} event.source The source object of the event\n * @param {} event.name The name of the event\n */\n\n /*\n *\n * Properties Documentation\n *\n */\n\n /**\n * A flag that specifies whether the runner is running or not.\n *\n * @property enabled\n * @type boolean\n * @default true\n */\n\n /**\n * A `Boolean` that specifies if the runner should use a fixed timestep (otherwise it is variable).\n * If timing is fixed, then the apparent simulation speed will change depending on the frame rate (but behaviour will be deterministic).\n * If the timing is variable, then the apparent simulation speed will be constant (approximately, but at the cost of determininism).\n *\n * @property isFixed\n * @type boolean\n * @default false\n */\n\n /**\n * A `Number` that specifies the time step between updates in milliseconds.\n * If `engine.timing.isFixed` is set to `true`, then `delta` is fixed.\n * If it is `false`, then `delta` can dynamically change to maintain the correct apparent simulation speed.\n *\n * @property delta\n * @type number\n * @default 1000 / 60\n */\n\n})();\n\n\n/***/ }),\n/* 28 */\n/***/ (function(module, exports, __webpack_require__) {\n\n/**\n* This module has now been replaced by `Matter.Collision`.\n*\n* All usage should be migrated to `Matter.Collision`.\n* For back-compatibility purposes this module will remain for a short term and then later removed in a future release.\n*\n* The `Matter.SAT` module contains methods for detecting collisions using the Separating Axis Theorem.\n*\n* @class SAT\n* @deprecated\n*/\n\nvar SAT = {};\n\nmodule.exports = SAT;\n\nvar Collision = __webpack_require__(8);\nvar Common = __webpack_require__(0);\nvar deprecated = Common.deprecated;\n\n(function() {\n\n /**\n * Detect collision between two bodies using the Separating Axis Theorem.\n * @deprecated replaced by Collision.collides\n * @method collides\n * @param {body} bodyA\n * @param {body} bodyB\n * @return {collision} collision\n */\n SAT.collides = function(bodyA, bodyB) {\n return Collision.collides(bodyA, bodyB);\n };\n\n deprecated(SAT, 'collides', 'SAT.collides ➤ replaced by Collision.collides');\n\n})();\n\n\n/***/ }),\n/* 29 */\n/***/ (function(module, exports, __webpack_require__) {\n\n/**\n* The `Matter.Svg` module contains methods for converting SVG images into an array of vector points.\n*\n* To use this module you also need the SVGPathSeg polyfill: https://github.com/progers/pathseg\n*\n* See the included usage [examples](https://github.com/liabru/matter-js/tree/master/examples).\n*\n* @class Svg\n*/\n\nvar Svg = {};\n\nmodule.exports = Svg;\n\nvar Bounds = __webpack_require__(1);\nvar Common = __webpack_require__(0);\n\n(function() {\n\n /**\n * Converts an SVG path into an array of vector points.\n * If the input path forms a concave shape, you must decompose the result into convex parts before use.\n * See `Bodies.fromVertices` which provides support for this.\n * Note that this function is not guaranteed to support complex paths (such as those with holes).\n * You must load the `pathseg.js` polyfill on newer browsers.\n * @method pathToVertices\n * @param {SVGPathElement} path\n * @param {Number} [sampleLength=15]\n * @return {Vector[]} points\n */\n Svg.pathToVertices = function(path, sampleLength) {\n if (typeof window !== 'undefined' && !('SVGPathSeg' in window)) {\n Common.warn('Svg.pathToVertices: SVGPathSeg not defined, a polyfill is required.');\n }\n\n // https://github.com/wout/svg.topoly.js/blob/master/svg.topoly.js\n var i, il, total, point, segment, segments, \n segmentsQueue, lastSegment, \n lastPoint, segmentIndex, points = [],\n lx, ly, length = 0, x = 0, y = 0;\n\n sampleLength = sampleLength || 15;\n\n var addPoint = function(px, py, pathSegType) {\n // all odd-numbered path types are relative except PATHSEG_CLOSEPATH (1)\n var isRelative = pathSegType % 2 === 1 && pathSegType > 1;\n\n // when the last point doesn't equal the current point add the current point\n if (!lastPoint || px != lastPoint.x || py != lastPoint.y) {\n if (lastPoint && isRelative) {\n lx = lastPoint.x;\n ly = lastPoint.y;\n } else {\n lx = 0;\n ly = 0;\n }\n\n var point = {\n x: lx + px,\n y: ly + py\n };\n\n // set last point\n if (isRelative || !lastPoint) {\n lastPoint = point;\n }\n\n points.push(point);\n\n x = lx + px;\n y = ly + py;\n }\n };\n\n var addSegmentPoint = function(segment) {\n var segType = segment.pathSegTypeAsLetter.toUpperCase();\n\n // skip path ends\n if (segType === 'Z') \n return;\n\n // map segment to x and y\n switch (segType) {\n\n case 'M':\n case 'L':\n case 'T':\n case 'C':\n case 'S':\n case 'Q':\n x = segment.x;\n y = segment.y;\n break;\n case 'H':\n x = segment.x;\n break;\n case 'V':\n y = segment.y;\n break;\n }\n\n addPoint(x, y, segment.pathSegType);\n };\n\n // ensure path is absolute\n Svg._svgPathToAbsolute(path);\n\n // get total length\n total = path.getTotalLength();\n\n // queue segments\n segments = [];\n for (i = 0; i < path.pathSegList.numberOfItems; i += 1)\n segments.push(path.pathSegList.getItem(i));\n\n segmentsQueue = segments.concat();\n\n // sample through path\n while (length < total) {\n // get segment at position\n segmentIndex = path.getPathSegAtLength(length);\n segment = segments[segmentIndex];\n\n // new segment\n if (segment != lastSegment) {\n while (segmentsQueue.length && segmentsQueue[0] != segment)\n addSegmentPoint(segmentsQueue.shift());\n\n lastSegment = segment;\n }\n\n // add points in between when curving\n // TODO: adaptive sampling\n switch (segment.pathSegTypeAsLetter.toUpperCase()) {\n\n case 'C':\n case 'T':\n case 'S':\n case 'Q':\n case 'A':\n point = path.getPointAtLength(length);\n addPoint(point.x, point.y, 0);\n break;\n\n }\n\n // increment by sample value\n length += sampleLength;\n }\n\n // add remaining segments not passed by sampling\n for (i = 0, il = segmentsQueue.length; i < il; ++i)\n addSegmentPoint(segmentsQueue[i]);\n\n return points;\n };\n\n Svg._svgPathToAbsolute = function(path) {\n // http://phrogz.net/convert-svg-path-to-all-absolute-commands\n // Copyright (c) Gavin Kistner\n // http://phrogz.net/js/_ReuseLicense.txt\n // Modifications: tidy formatting and naming\n var x0, y0, x1, y1, x2, y2, segs = path.pathSegList,\n x = 0, y = 0, len = segs.numberOfItems;\n\n for (var i = 0; i < len; ++i) {\n var seg = segs.getItem(i),\n segType = seg.pathSegTypeAsLetter;\n\n if (/[MLHVCSQTA]/.test(segType)) {\n if ('x' in seg) x = seg.x;\n if ('y' in seg) y = seg.y;\n } else {\n if ('x1' in seg) x1 = x + seg.x1;\n if ('x2' in seg) x2 = x + seg.x2;\n if ('y1' in seg) y1 = y + seg.y1;\n if ('y2' in seg) y2 = y + seg.y2;\n if ('x' in seg) x += seg.x;\n if ('y' in seg) y += seg.y;\n\n switch (segType) {\n\n case 'm':\n segs.replaceItem(path.createSVGPathSegMovetoAbs(x, y), i);\n break;\n case 'l':\n segs.replaceItem(path.createSVGPathSegLinetoAbs(x, y), i);\n break;\n case 'h':\n segs.replaceItem(path.createSVGPathSegLinetoHorizontalAbs(x), i);\n break;\n case 'v':\n segs.replaceItem(path.createSVGPathSegLinetoVerticalAbs(y), i);\n break;\n case 'c':\n segs.replaceItem(path.createSVGPathSegCurvetoCubicAbs(x, y, x1, y1, x2, y2), i);\n break;\n case 's':\n segs.replaceItem(path.createSVGPathSegCurvetoCubicSmoothAbs(x, y, x2, y2), i);\n break;\n case 'q':\n segs.replaceItem(path.createSVGPathSegCurvetoQuadraticAbs(x, y, x1, y1), i);\n break;\n case 't':\n segs.replaceItem(path.createSVGPathSegCurvetoQuadraticSmoothAbs(x, y), i);\n break;\n case 'a':\n segs.replaceItem(path.createSVGPathSegArcAbs(x, y, seg.r1, seg.r2, seg.angle, seg.largeArcFlag, seg.sweepFlag), i);\n break;\n case 'z':\n case 'Z':\n x = x0;\n y = y0;\n break;\n\n }\n }\n\n if (segType == 'M' || segType == 'm') {\n x0 = x;\n y0 = y;\n }\n }\n };\n\n})();\n\n/***/ }),\n/* 30 */\n/***/ (function(module, exports, __webpack_require__) {\n\n/**\n* This module has now been replaced by `Matter.Composite`.\n*\n* All usage should be migrated to the equivalent functions found on `Matter.Composite`.\n* For example `World.add(world, body)` now becomes `Composite.add(world, body)`.\n*\n* The property `world.gravity` has been moved to `engine.gravity`.\n*\n* For back-compatibility purposes this module will remain as a direct alias to `Matter.Composite` in the short term during migration.\n* Eventually this alias module will be marked as deprecated and then later removed in a future release.\n*\n* @class World\n*/\n\nvar World = {};\n\nmodule.exports = World;\n\nvar Composite = __webpack_require__(5);\nvar Common = __webpack_require__(0);\n\n(function() {\n\n /**\n * See above, aliases for back compatibility only\n */\n World.create = Composite.create;\n World.add = Composite.add;\n World.remove = Composite.remove;\n World.clear = Composite.clear;\n World.addComposite = Composite.addComposite;\n World.addBody = Composite.addBody;\n World.addConstraint = Composite.addConstraint;\n\n})();\n\n\n/***/ })\n/******/ ]);\n});","import type { ObserverInstanceCallback } from './index';\n\nconst observerMap = new Map<\n string,\n {\n id: string;\n observer: IntersectionObserver;\n elements: Map>;\n }\n>();\n\nconst RootIds: WeakMap = new WeakMap();\nlet rootId = 0;\n\nlet unsupportedValue: boolean | undefined = undefined;\n\n/**\n * What should be the default behavior if the IntersectionObserver is unsupported?\n * Ideally the polyfill has been loaded, you can have the following happen:\n * - `undefined`: Throw an error\n * - `true` or `false`: Set the `inView` value to this regardless of intersection state\n * **/\nexport function defaultFallbackInView(inView: boolean | undefined) {\n unsupportedValue = inView;\n}\n\n/**\n * Generate a unique ID for the root element\n * @param root\n */\nfunction getRootId(root: IntersectionObserverInit['root']) {\n if (!root) return '0';\n if (RootIds.has(root)) return RootIds.get(root);\n rootId += 1;\n RootIds.set(root, rootId.toString());\n return RootIds.get(root);\n}\n\n/**\n * Convert the options to a string Id, based on the values.\n * Ensures we can reuse the same observer when observing elements with the same options.\n * @param options\n */\nexport function optionsToId(options: IntersectionObserverInit) {\n return Object.keys(options)\n .sort()\n .filter((key) => options[key] !== undefined)\n .map((key) => {\n return `${key}_${\n key === 'root' ? getRootId(options.root) : options[key]\n }`;\n })\n .toString();\n}\n\nfunction createObserver(options: IntersectionObserverInit) {\n // Create a unique ID for this observer instance, based on the root, root margin and threshold.\n let id = optionsToId(options);\n let instance = observerMap.get(id);\n\n if (!instance) {\n // Create a map of elements this observer is going to observe. Each element has a list of callbacks that should be triggered, once it comes into view.\n const elements = new Map>();\n let thresholds: number[] | readonly number[];\n\n const observer = new IntersectionObserver((entries) => {\n entries.forEach((entry) => {\n // While it would be nice if you could just look at isIntersecting to determine if the component is inside the viewport, browsers can't agree on how to use it.\n // -Firefox ignores `threshold` when considering `isIntersecting`, so it will never be false again if `threshold` is > 0\n const inView =\n entry.isIntersecting &&\n thresholds.some((threshold) => entry.intersectionRatio >= threshold);\n\n // @ts-ignore support IntersectionObserver v2\n if (options.trackVisibility && typeof entry.isVisible === 'undefined') {\n // The browser doesn't support Intersection Observer v2, falling back to v1 behavior.\n // @ts-ignore\n entry.isVisible = inView;\n }\n\n elements.get(entry.target)?.forEach((callback) => {\n callback(inView, entry);\n });\n });\n }, options);\n\n // Ensure we have a valid thresholds array. If not, use the threshold from the options\n thresholds =\n observer.thresholds ||\n (Array.isArray(options.threshold)\n ? options.threshold\n : [options.threshold || 0]);\n\n instance = {\n id,\n observer,\n elements,\n };\n\n observerMap.set(id, instance);\n }\n\n return instance;\n}\n\n/**\n * @param element - DOM Element to observe\n * @param callback - Callback function to trigger when intersection status changes\n * @param options - Intersection Observer options\n * @param fallbackInView - Fallback inView value.\n * @return Function - Cleanup function that should be triggered to unregister the observer\n */\nexport function observe(\n element: Element,\n callback: ObserverInstanceCallback,\n options: IntersectionObserverInit = {},\n fallbackInView = unsupportedValue,\n) {\n if (\n typeof window.IntersectionObserver === 'undefined' &&\n fallbackInView !== undefined\n ) {\n const bounds = element.getBoundingClientRect();\n callback(fallbackInView, {\n isIntersecting: fallbackInView,\n target: element,\n intersectionRatio:\n typeof options.threshold === 'number' ? options.threshold : 0,\n time: 0,\n boundingClientRect: bounds,\n intersectionRect: bounds,\n rootBounds: bounds,\n });\n return () => {\n // Nothing to cleanup\n };\n }\n // An observer with the same options can be reused, so lets use this fact\n const { id, observer, elements } = createObserver(options);\n\n // Register the callback listener for this element\n let callbacks = elements.get(element) || [];\n if (!elements.has(element)) {\n elements.set(element, callbacks);\n }\n\n callbacks.push(callback);\n observer.observe(element);\n\n return function unobserve() {\n // Remove the callback from the callback list\n callbacks.splice(callbacks.indexOf(callback), 1);\n\n if (callbacks.length === 0) {\n // No more callback exists for element, so destroy it\n elements.delete(element);\n observer.unobserve(element);\n }\n\n if (elements.size === 0) {\n // No more elements are being observer by this instance, so destroy it\n observer.disconnect();\n observerMap.delete(id);\n }\n };\n}\n","import * as React from 'react';\nimport type { IntersectionObserverProps, PlainChildrenProps } from './index';\nimport { observe } from './observe';\n\ntype State = {\n inView: boolean;\n entry?: IntersectionObserverEntry;\n};\n\nfunction isPlainChildren(\n props: IntersectionObserverProps | PlainChildrenProps,\n): props is PlainChildrenProps {\n return typeof props.children !== 'function';\n}\n\n/**\n ## Render props\n\n To use the `` component, you pass it a function. It will be called\n whenever the state changes, with the new value of `inView`. In addition to the\n `inView` prop, children also receive a `ref` that should be set on the\n containing DOM element. This is the element that the IntersectionObserver will\n monitor.\n\n If you need it, you can also access the\n [`IntersectionObserverEntry`](https://developer.mozilla.org/en-US/docs/Web/API/IntersectionObserverEntry)\n on `entry`, giving you access to all the details about the current intersection\n state.\n\n ```jsx\n import { InView } from 'react-intersection-observer';\n\n const Component = () => (\n \n {({ inView, ref, entry }) => (\n
\n

{`Header inside viewport ${inView}.`}

\n
\n )}\n
\n );\n\n export default Component;\n ```\n\n ## Plain children\n\n You can pass any element to the ``, and it will handle creating the\n wrapping DOM element. Add a handler to the `onChange` method, and control the\n state in your own component. Any extra props you add to `` will be\n passed to the HTML element, allowing you set the `className`, `style`, etc.\n\n ```jsx\n import { InView } from 'react-intersection-observer';\n\n const Component = () => (\n console.log('Inview:', inView)}>\n

Plain children are always rendered. Use onChange to monitor state.

\n
\n );\n\n export default Component;\n ```\n */\nexport class InView extends React.Component<\n IntersectionObserverProps | PlainChildrenProps,\n State\n> {\n constructor(props: IntersectionObserverProps | PlainChildrenProps) {\n super(props);\n this.state = {\n inView: !!props.initialInView,\n entry: undefined,\n };\n }\n\n componentDidUpdate(prevProps: IntersectionObserverProps) {\n // If a IntersectionObserver option changed, reinit the observer\n if (\n prevProps.rootMargin !== this.props.rootMargin ||\n prevProps.root !== this.props.root ||\n prevProps.threshold !== this.props.threshold ||\n prevProps.skip !== this.props.skip ||\n prevProps.trackVisibility !== this.props.trackVisibility ||\n prevProps.delay !== this.props.delay\n ) {\n this.unobserve();\n this.observeNode();\n }\n }\n\n componentWillUnmount() {\n this.unobserve();\n this.node = null;\n }\n\n node: Element | null = null;\n _unobserveCb: (() => void) | null = null;\n\n observeNode() {\n if (!this.node || this.props.skip) return;\n const {\n threshold,\n root,\n rootMargin,\n trackVisibility,\n delay,\n fallbackInView,\n } = this.props;\n\n this._unobserveCb = observe(\n this.node,\n this.handleChange,\n {\n threshold,\n root,\n rootMargin,\n // @ts-ignore\n trackVisibility,\n // @ts-ignore\n delay,\n },\n fallbackInView,\n );\n }\n\n unobserve() {\n if (this._unobserveCb) {\n this._unobserveCb();\n this._unobserveCb = null;\n }\n }\n\n handleNode = (node?: Element | null) => {\n if (this.node) {\n // Clear the old observer, before we start observing a new element\n this.unobserve();\n\n if (!node && !this.props.triggerOnce && !this.props.skip) {\n // Reset the state if we get a new node, and we aren't ignoring updates\n this.setState({ inView: !!this.props.initialInView, entry: undefined });\n }\n }\n\n this.node = node ? node : null;\n this.observeNode();\n };\n\n handleChange = (inView: boolean, entry: IntersectionObserverEntry) => {\n if (inView && this.props.triggerOnce) {\n // If `triggerOnce` is true, we should stop observing the element.\n this.unobserve();\n }\n if (!isPlainChildren(this.props)) {\n // Store the current State, so we can pass it to the children in the next render update\n // There's no reason to update the state for plain children, since it's not used in the rendering.\n this.setState({ inView, entry });\n }\n if (this.props.onChange) {\n // If the user is actively listening for onChange, always trigger it\n this.props.onChange(inView, entry);\n }\n };\n\n render() {\n if (!isPlainChildren(this.props)) {\n const { inView, entry } = this.state;\n return this.props.children({ inView, entry, ref: this.handleNode });\n }\n\n const {\n children,\n as,\n triggerOnce,\n threshold,\n root,\n rootMargin,\n onChange,\n skip,\n trackVisibility,\n delay,\n initialInView,\n fallbackInView,\n ...props\n } = this.props;\n\n return React.createElement(\n as || 'div',\n { ref: this.handleNode, ...props },\n children,\n );\n }\n}\n","import * as React from 'react';\nimport type { InViewHookResponse, IntersectionOptions } from './index';\nimport { observe } from './observe';\n\ntype State = {\n inView: boolean;\n entry?: IntersectionObserverEntry;\n};\n\n/**\n * React Hooks make it easy to monitor the `inView` state of your components. Call\n * the `useInView` hook with the (optional) [options](#options) you need. It will\n * return an array containing a `ref`, the `inView` status and the current\n * [`entry`](https://developer.mozilla.org/en-US/docs/Web/API/IntersectionObserverEntry).\n * Assign the `ref` to the DOM element you want to monitor, and the hook will\n * report the status.\n *\n * @example\n * ```jsx\n * import React from 'react';\n * import { useInView } from 'react-intersection-observer';\n *\n * const Component = () => {\n * const { ref, inView, entry } = useInView({\n * threshold: 0,\n * });\n *\n * return (\n *
\n *

{`Header inside viewport ${inView}.`}

\n *
\n * );\n * };\n * ```\n */\nexport function useInView({\n threshold,\n delay,\n trackVisibility,\n rootMargin,\n root,\n triggerOnce,\n skip,\n initialInView,\n fallbackInView,\n onChange,\n}: IntersectionOptions = {}): InViewHookResponse {\n const [ref, setRef] = React.useState(null);\n const callback = React.useRef();\n const [state, setState] = React.useState({\n inView: !!initialInView,\n entry: undefined,\n });\n\n // Store the onChange callback in a `ref`, so we can access the latest instance\n // inside the `useEffect`, but without triggering a rerender.\n callback.current = onChange;\n\n React.useEffect(\n () => {\n // Ensure we have node ref, and that we shouldn't skip observing\n if (skip || !ref) return;\n\n let unobserve: (() => void) | undefined = observe(\n ref,\n (inView, entry) => {\n setState({\n inView,\n entry,\n });\n if (callback.current) callback.current(inView, entry);\n\n if (entry.isIntersecting && triggerOnce && unobserve) {\n // If it should only trigger once, unobserve the element after it's inView\n unobserve();\n unobserve = undefined;\n }\n },\n {\n root,\n rootMargin,\n threshold,\n // @ts-ignore\n trackVisibility,\n // @ts-ignore\n delay,\n },\n fallbackInView,\n );\n\n return () => {\n if (unobserve) {\n unobserve();\n }\n };\n },\n // We break the rule here, because we aren't including the actual `threshold` variable\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [\n // If the threshold is an array, convert it to a string, so it won't change between renders.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n Array.isArray(threshold) ? threshold.toString() : threshold,\n ref,\n root,\n rootMargin,\n triggerOnce,\n skip,\n trackVisibility,\n fallbackInView,\n delay,\n ],\n );\n\n const entryTarget = state.entry?.target;\n\n React.useEffect(() => {\n if (!ref && entryTarget && !triggerOnce && !skip) {\n // If we don't have a node ref, then reset the state (unless the hook is set to only `triggerOnce` or `skip`)\n // This ensures we correctly reflect the current state - If you aren't observing anything, then nothing is inView\n setState({\n inView: !!initialInView,\n entry: undefined,\n });\n }\n }, [ref, entryTarget, triggerOnce, skip, initialInView]);\n\n const result = [setRef, state.inView, state.entry] as InViewHookResponse;\n\n // Support object destructuring, by adding the specific values.\n result.ref = result[0];\n result.inView = result[1];\n result.entry = result[2];\n\n return result;\n}\n"],"names":["factory","modules","installedModules","__webpack_require__","moduleId","exports","module","i","l","call","m","c","d","name","getter","o","Object","defineProperty","enumerable","get","r","Symbol","toStringTag","value","t","mode","__esModule","ns","create","key","bind","n","object","property","prototype","hasOwnProperty","p","s","Common","_nextId","_seed","_nowStartTime","Date","_warnedOnce","_decomp","extend","obj","deep","argsStart","deepClone","arguments","length","source","prop","constructor","clone","keys","push","values","path","begin","end","split","slice","set","val","parts","shuffle","array","j","Math","floor","random","temp","choose","choices","isElement","HTMLElement","nodeType","nodeName","isArray","toString","isFunction","isPlainObject","isString","clamp","min","max","sign","now","window","performance","webkitNow","_seededRandom","colorToNumber","colorString","replace","charAt","parseInt","logLevel","log","console","apply","concat","Array","info","warn","warnOnce","message","join","deprecated","warning","chain","nextId","indexOf","haystack","needle","map","list","func","mapped","topologicalSort","graph","result","visited","node","_topologicalSort","neighbors","neighbor","funcs","_chained","lastResult","args","chainPathBefore","base","chainPathAfter","setDecomp","decomp","getDecomp","global","e","Bounds","vertices","bounds","x","y","update","velocity","Infinity","vertex","contains","point","overlaps","boundsA","boundsB","translate","vector","shift","position","deltaX","deltaY","Vector","magnitude","sqrt","magnitudeSquared","rotate","angle","output","cos","sin","rotateAbout","normalise","dot","vectorA","vectorB","cross","cross3","vectorC","add","sub","mult","scalar","div","perp","negate","neg","atan2","_temp","Vertices","points","body","index","isInternal","fromPath","match","parseFloat","centre","area","mean","average","signed","abs","inertia","mass","numerator","denominator","v","verticesLength","translateX","translateY","dx","dy","pointX","pointY","nextVertex","scale","scaleX","scaleY","delta","chamfer","radius","quality","qualityMin","qualityMax","newVertices","prevVertex","currentRadius","prevNormal","nextNormal","diagonalRadius","pow","radiusVector","midNormal","scaledVertex","precision","theta","acos","clockwiseSort","sort","vertexA","vertexB","isConvex","k","z","flag","hull","upper","lower","pop","Events","on","eventNames","callback","names","events","off","callbacks","newCallbacks","trigger","event","eventClone","Composite","Body","options","id","type","parent","isModified","bodies","constraints","composites","label","plugin","cache","allBodies","allConstraints","allComposites","setModified","composite","updateParents","updateChildren","childComposite","objects","addBody","addConstraint","addComposite","constraint","remove","removeBody","removeConstraint","removeComposite","compositeA","compositeB","removeCompositeAt","splice","removeBodyAt","removeConstraintAt","clear","keepStatic","filter","isStatic","move","rebase","translation","recursive","rotation","setPosition","Sleeping","Axes","_inertiaScale","_nextCollidingGroupId","_nextNonCollidingGroupId","_nextCategory","defaults","force","torque","positionImpulse","constraintImpulse","totalContacts","speed","angularSpeed","angularVelocity","isSensor","isSleeping","motion","sleepThreshold","density","restitution","friction","frictionStatic","frictionAir","collisionFilter","category","mask","group","slop","timeScale","render","visible","opacity","strokeStyle","fillStyle","lineWidth","sprite","xScale","yScale","xOffset","yOffset","circleRadius","positionPrev","anglePrev","axes","_original","_initProperties","nextGroup","isNonColliding","nextCategory","defaultFillStyle","defaultStrokeStyle","defaultLineWidth","settings","setStatic","setMass","setDensity","setInertia","setVertices","setAngle","setVelocity","setAngularVelocity","setParts","setCentre","part","inverseMass","inverseInertia","moment","fromVertices","autoHull","hullCentre","total","_totalProperties","relative","totalArea","totalInertia","deltaTime","correction","deltaTimeSquared","velocityPrevX","velocityPrevY","applyForce","offset","properties","_motionWakeThreshold","_motionSleepThreshold","_minBias","timeFactor","minMotion","maxMotion","sleepCounter","afterCollisions","pairs","pair","isActive","collision","bodyA","bodyB","sleepingBody","movingBody","wasSleeping","Collision","Pair","_supports","_overlapAB","overlap","axis","_overlapBA","collided","parentA","parentB","depth","normal","tangent","penetration","supports","collides","_overlapAxes","minOverlap","table","minAxis","minAxisX","minAxisY","supportsB","_findSupports","supportCount","supportsA","verticesA","verticesB","overlapAB","overlapBA","verticesALength","verticesBLength","verticesAX","verticesAY","verticesBX","verticesBY","axesLength","overlapMin","Number","MAX_VALUE","overlapAxisNumber","axisX","axisY","minA","minB","maxA","maxB","_projectToAxis","projection","direction","vertexC","distance","bodyAPositionX","bodyAPositionY","normalX","normalY","nearestDistance","Contact","timestamp","contacts","activeContacts","separation","confirmedActive","timeCreated","timeUpdated","parentAVerticesLength","support","contactId","contact","setActive","Constraint","_warming","_torqueDampen","_minLength","pointA","pointB","initialPointA","initialPointB","stiffness","damping","angularStiffness","angleA","angleB","anchors","preSolveAll","impulse","solveAll","fixedA","fixedB","solve","pointAWorld","pointBWorld","currentLength","share","normalVelocity","relativeVelocity","difference","massTotal","resistanceTotal","zero","postSolveAll","gradient","toFixed","xx","Bodies","rectangle","width","height","trapezoid","slope","verticesPath","x1","x2","x3","circle","maxSides","sides","ceil","polygon","PI","yy","vertexSets","flagInternal","removeCollinear","minimumArea","removeDuplicatePoints","canDecomp","Boolean","quickDecomp","concave","makeCCW","removeCollinearPoints","decomposed","chunkVertices","partA","partB","pav","pbv","da","db","Mouse","element","mouse","document","absolute","mousedownPosition","mouseupPosition","wheelDelta","button","pixelRatio","getAttribute","sourceEvents","mousemove","mousedown","mouseup","mousewheel","_getRelativeMousePosition","changedTouches","preventDefault","detail","setElement","addEventListener","clearSourceEvents","setOffset","setScale","elementBounds","getBoundingClientRect","rootNode","documentElement","parentNode","scrollX","undefined","pageXOffset","scrollLeft","scrollY","pageYOffset","scrollTop","touches","pageX","left","pageY","top","clientWidth","clientHeight","Detector","setBodies","detector","collisions","bodiesLength","canCollide","_compareBoundsX","boundXMax","boundYMax","boundYMin","bodyAStatic","partsALength","partsASingle","partsBLength","partsBStart","filterA","filterB","Plugin","_registry","register","isPlugin","registered","pluginVersion","versionParse","version","number","registeredVersion","resolve","dependency","dependencyParse","range","install","isUsed","used","isFor","parsed","for","versionSatisfies","use","plugins","uses","dependencies","sortedDependencies","status","_warned","tracked","parsedBase","resolved","test","pattern","exec","major","minor","patch","isRange","operator","prerelease","Render","_requestAnimationFrame","_cancelAnimationFrame","requestAnimationFrame","webkitRequestAnimationFrame","mozRequestAnimationFrame","msRequestAnimationFrame","setTimeout","cancelAnimationFrame","mozCancelAnimationFrame","webkitCancelAnimationFrame","msCancelAnimationFrame","_goodFps","_goodDelta","controller","engine","canvas","frameRequestId","timing","historySize","deltaHistory","lastTime","lastTimestamp","lastElapsed","timestampElapsed","timestampElapsedHistory","engineDeltaHistory","engineElapsedHistory","elapsedHistory","background","wireframeBackground","hasBounds","enabled","wireframes","showSleeping","showDebug","showStats","showPerformance","showBounds","showVelocity","showCollisions","showSeparations","showAxes","showPositions","showAngleIndicator","showIds","showVertexNumbers","showConvexHulls","showInternalEdges","showMousePosition","_createCanvas","context","getContext","textures","showBroadphase","setPixelRatio","appendChild","run","loop","time","_updateTiming","world","stats","stop","_getPixelRatio","setAttribute","style","lookAt","padding","center","viewHeight","outerRatio","innerRatio","startViewTransform","boundsWidth","boundsHeight","boundsScaleX","boundsScaleY","setTransform","endViewTransform","startTime","currentBackground","_applyBackground","globalCompositeOperation","fillRect","enableSleeping","bodyConvexHulls","bodyWireframes","bodyBounds","bodyAxes","bodyPositions","bodyVelocity","bodyIds","separations","vertexNumbers","mousePosition","sections","font","textBaseline","textAlign","section","fillText","lastEngineDelta","lastDelta","deltaMean","_mean","elapsedMean","engineDeltaMean","engineElapsedMean","rateMean","fps","gap","round","count","indicator","plotY","beginPath","moveTo","lineTo","stroke","start","arc","closePath","coils","fill","globalAlpha","texture","_getTexture","drawImage","rect","normalPosX","normalPosY","inspector","selected","item","data","setLineDash","selectStart","selectBounds","unshift","createElement","oncontextmenu","onselectstart","devicePixelRatio","webkitBackingStorePixelRatio","mozBackingStorePixelRatio","msBackingStorePixelRatio","oBackingStorePixelRatio","backingStorePixelRatio","imagePath","image","Image","src","cssBackground","backgroundSize","normalImpulse","tangentImpulse","Engine","Resolver","Pairs","positionIterations","velocityIterations","constraintIterations","gravity","grid","buckets","broadphase","metrics","_bodiesApplyGravity","_bodiesUpdate","collisionStart","preSolvePosition","solvePosition","postSolvePosition","preSolveVelocity","solveVelocity","collisionActive","collisionEnd","_bodiesClearForces","merge","engineA","engineB","gravityScale","worldBounds","_restingThresh","_restingThreshTangent","_positionDampen","_positionWarming","_frictionNormalMultiplier","activeCount","pairsLength","contactShare","positionDampen","positionWarming","verticesTranslate","boundsUpdate","positionImpulseX","positionImpulseY","contactsLength","contactVertex","impulseX","impulseY","maxFriction","timeScaleSquared","restingThresh","frictionNormalMultiplier","restingThreshTangent","NumberMaxValue","bodyAVelocity","bodyBVelocity","tangentX","tangentY","inverseMassTotal","offsetAX","offsetAY","offsetBX","offsetBY","velocityPointAX","velocityPointAY","relativeVelocityX","relativeVelocityY","tangentVelocity","normalOverlap","normalForce","frictionLimit","oAcN","oBcN","contactNormalImpulse","contactTangentImpulse","pairIndex","pairsList","pairsListLength","pairsTable","collisionsLength","removePairIndex","Matter","Composites","Grid","MouseConstraint","Query","Runner","SAT","Svg","World","before","after","stack","columns","rows","columnGap","rowGap","lastBody","row","maxHeight","column","bodyHeight","bodyWidth","xOffsetA","yOffsetA","xOffsetB","yOffsetB","bodyAHeight","bodyAWidth","bodyBHeight","mesh","crossBrace","col","bodyC","pyramid","actualRows","lastBodyWidth","newtonsCradle","size","car","wheelSize","wheelAOffset","wheelBOffset","wheelA","wheelB","axelA","axelB","softBody","particleRadius","particleOptions","constraintOptions","bucketWidth","bucketHeight","forceUpdate","bucket","bucketId","gridChanged","newRegion","_getRegion","region","union","_regionUnion","startCol","endCol","startRow","endRow","_getBucketId","isInsideNewRegion","isInsideOldRegion","_bucketRemoveBody","_createBucket","_bucketAddBody","_createActivePairsList","regionA","regionB","_createRegion","gridPairs","pairId","bucketLength","pairKeys","pairKeysLength","mouseConstraint","_triggerEvents","mouseEvents","partsAStart","ray","startPoint","endPoint","rayWidth","rayAngle","rayLength","rayX","rayY","outside","_frameTimeout","clearTimeout","runner","deltaSampleSize","counterTimestamp","frameCounter","timePrev","timeScalePrev","isFixed","deltaMin","deltaMax","tick","pathToVertices","sampleLength","il","segment","segments","segmentsQueue","lastSegment","lastPoint","lx","ly","addPoint","px","py","pathSegType","isRelative","addSegmentPoint","segType","pathSegTypeAsLetter","toUpperCase","_svgPathToAbsolute","getTotalLength","pathSegList","numberOfItems","getItem","getPathSegAtLength","getPointAtLength","x0","y0","y1","y2","segs","len","seg","replaceItem","createSVGPathSegMovetoAbs","createSVGPathSegLinetoAbs","createSVGPathSegLinetoHorizontalAbs","createSVGPathSegLinetoVerticalAbs","createSVGPathSegCurvetoCubicAbs","createSVGPathSegCurvetoCubicSmoothAbs","createSVGPathSegCurvetoQuadraticAbs","createSVGPathSegCurvetoQuadraticSmoothAbs","createSVGPathSegArcAbs","r1","r2","largeArcFlag","sweepFlag","observerMap","Map","RootIds","WeakMap","rootId","unsupportedValue","optionsToId","root","has","createObserver","instance","thresholds","elements","observer","IntersectionObserver","entries","forEach","entry","inView","isIntersecting","some","threshold","intersectionRatio","trackVisibility","isVisible","target","observe","fallbackInView","boundingClientRect","intersectionRect","rootBounds","delete","unobserve","disconnect","isPlainChildren","props","children","InView","_unobserveCb","handleNode","triggerOnce","skip","setState","initialInView","observeNode","handleChange","onChange","state","componentDidUpdate","prevProps","rootMargin","this","delay","componentWillUnmount","ref","as","React","useInView","setRef","current","entryTarget"],"sourceRoot":""}