0
0
Fork 0
mirror of https://github.com/liabru/matter-js.git synced 2025-01-21 17:14:38 -05:00

release 0.16.0

This commit is contained in:
liabru 2021-01-17 23:13:32 +00:00
parent 12377cc72c
commit e81fc7a044
7 changed files with 373 additions and 163 deletions

View file

@ -1,3 +1,24 @@
## 0.16.0 (2021-01-17)
* added removeDuplicatePoints option from poly-decomp 0.3.0 to Bodies.fromVertices ([#639](https://github.com/liabru/matter-js/issues/639), [947cb97](https://github.com/liabru/matter-js/commit/947cb97), [a9694e6](https://github.com/liabru/matter-js/commit/a9694e6))
* added support for > and >= operators in plugin version ranges ([0792716](https://github.com/liabru/matter-js/commit/0792716))
* added support for example versioning in tests ([31d0ace](https://github.com/liabru/matter-js/commit/31d0ace))
* added version targets for examples ([142b7de](https://github.com/liabru/matter-js/commit/142b7de))
* added warning check on browser tests ([12377cc](https://github.com/liabru/matter-js/commit/12377cc))
* changed svg and terrain example to use fetch ([5551cd5](https://github.com/liabru/matter-js/commit/5551cd5))
* changed deprecated comments to avoid confusion ([1e73cab](https://github.com/liabru/matter-js/commit/1e73cab))
* fixed poly-decomp external require ([882e07c](https://github.com/liabru/matter-js/commit/882e07c))
* removed bower.json ([f71d4c0](https://github.com/liabru/matter-js/commit/f71d4c0))
* removed unused dev dependency run-sequence ([be592fd](https://github.com/liabru/matter-js/commit/be592fd))
* updated dev dependencies ([151eb30](https://github.com/liabru/matter-js/commit/151eb30))
* updated matter-tools ([5c66458](https://github.com/liabru/matter-js/commit/5c66458))
* updated matter-tools ([33e8fe8](https://github.com/liabru/matter-js/commit/33e8fe8))
* updated demo matter-tools ([a694ae5](https://github.com/liabru/matter-js/commit/a694ae5))
* updated demo pathseg ([9c5325b](https://github.com/liabru/matter-js/commit/9c5325b))
* updated readme ([3089b41](https://github.com/liabru/matter-js/commit/3089b41))
## 0.15.0 (2020-12-24) ## 0.15.0 (2020-12-24)
* add window global, stub require and handle bad values in test tools ([497ac80](https://github.com/liabru/matter-js/commit/497ac80)) * add window global, stub require and handle bad values in test tools ([497ac80](https://github.com/liabru/matter-js/commit/497ac80))

View file

@ -1,3 +1,48 @@
## ▲.●matter.js`0.16.0`
Release notes for `0.16.0`. See the release [readme](https://github.com/liabru/matter-js/blob/0.16.0/README.md) for further information.
### Highlights
- Changed external require method for `poly-decomp` ([882e07c](https://github.com/liabru/matter-js/commit/882e07c))
- Improved `Bodies.fromVertices` decomposition quality using `removeDuplicatePoints` ([#639](https://github.com/liabru/matter-js/pull/639))
- Added support for `>x.x.x` and `>=x.x.x` semver ranges in plugins ([0792716](https://github.com/liabru/matter-js/commit/0792716))
- Changed demo example select background colour for Windows ([matter-tools #5](https://github.com/liabru/matter-tools/pull/5))
- Updated demo to use latest [matter-tools](https://github.com/liabru/matter-tools) ([#33e8fe8](https://github.com/liabru/matter-js/commit/33e8fe8))
- Updated SVG and terrain examples to use `fetch` ([5551cd5](https://github.com/liabru/matter-js/commit/5551cd5))
### Changes
See the release [compare page](https://github.com/liabru/matter-js/compare/0.15.0...0.16.0) and the [changelog](https://github.com/liabru/matter-js/blob/0.16.0/CHANGELOG.md) for a detailed list of changes.
### Comparison
Differences in behaviour, quality and performance against the previous release `0.15.0`. For more information see [comparison method](https://github.com/liabru/matter-js/pull/794).
```ocaml
Output comparison of 41 examples against matter-js@0.15.0 build on last run
Similarity 100% Performance +0.00% Overlap +0.00%
airFriction · · avalanche · · ballPool · · bridge · · broadphase · · car · ·
catapult · · chains · · circleStack · · cloth · · collisionFiltering · ·
compositeManipulation · · compound · · compoundStack · · concave · · constraints · ·
doublePendulum · · events · · friction · · gravity · · gyro · ·
manipulation · · mixed · · newtonsCradle · · pyramid · · ragdoll · ·
raycasting · · restitution · · rounded · · sensors · · sleeping · ·
slingshot · · softBody · · sprites · · stack · · staticFriction · ·
stress · · stress2 · · timescale · · views · · wreckingBall · ·
where · no change ● extrinsics changed ◆ intrinsics changed
```
### Contributors
Many thanks to the [contributors](https://github.com/liabru/matter-js/compare/0.15.0...0.16.0) of this release, [past contributors](https://github.com/liabru/matter-js/graphs/contributors) as well those involved in the [community](https://github.com/liabru/matter-js/issues) for your input and support.
---
## ▲.●matter.js`0.15.0` ## ▲.●matter.js`0.15.0`
Release notes for `0.15.0`. See the release [readme](https://github.com/liabru/matter-js/blob/0.15.0/README.md) for further information. Release notes for `0.15.0`. See the release [readme](https://github.com/liabru/matter-js/blob/0.15.0/README.md) for further information.

View file

@ -1,5 +1,5 @@
/*! /*!
* matter-js 0.15.0 by @liabru 2020-12-26 * matter-js 0.16.0 by @liabru 2021-01-17
* http://brm.io/matter-js/ * http://brm.io/matter-js/
* License MIT * License MIT
* *
@ -27,11 +27,11 @@
*/ */
(function webpackUniversalModuleDefinition(root, factory) { (function webpackUniversalModuleDefinition(root, factory) {
if(typeof exports === 'object' && typeof module === 'object') if(typeof exports === 'object' && typeof module === 'object')
module.exports = factory((function webpackLoadOptionalExternalModule() { try { return require("poly-decomp"); } catch(e) {} }())); module.exports = factory(require("poly-decomp"));
else if(typeof define === 'function' && define.amd) else if(typeof define === 'function' && define.amd)
define("Matter", ["poly-decomp"], factory); define("Matter", ["poly-decomp"], factory);
else if(typeof exports === 'object') else if(typeof exports === 'object')
exports["Matter"] = factory((function webpackLoadOptionalExternalModule() { try { return require("poly-decomp"); } catch(e) {} }())); exports["Matter"] = factory(require("poly-decomp"));
else else
root["Matter"] = factory(root["decomp"]); root["Matter"] = factory(root["decomp"]);
})(this, function(__WEBPACK_EXTERNAL_MODULE__27__) { })(this, function(__WEBPACK_EXTERNAL_MODULE__27__) {
@ -7002,11 +7002,11 @@ var Vector = __webpack_require__(2);
* @param {bool} [flagInternal=false] * @param {bool} [flagInternal=false]
* @param {number} [removeCollinear=0.01] * @param {number} [removeCollinear=0.01]
* @param {number} [minimumArea=10] * @param {number} [minimumArea=10]
* @param {number} [removeDuplicatePoints=0.01]
* @return {body} * @return {body}
*/ */
Bodies.fromVertices = function(x, y, vertexSets, options, flagInternal, removeCollinear, minimumArea) { Bodies.fromVertices = function(x, y, vertexSets, options, flagInternal, removeCollinear, minimumArea, removeDuplicatePoints) {
var globals = typeof global !== 'undefined' ? global : window, var decomp = __webpack_require__(27),
decomp,
body, body,
parts, parts,
isConvex, isConvex,
@ -7017,18 +7017,13 @@ var Vector = __webpack_require__(2);
v, v,
z; z;
try {
decomp = globals.decomp || __webpack_require__(27);
} catch (e) {
// decomp is undefined
}
options = options || {}; options = options || {};
parts = []; parts = [];
flagInternal = typeof flagInternal !== 'undefined' ? flagInternal : false; flagInternal = typeof flagInternal !== 'undefined' ? flagInternal : false;
removeCollinear = typeof removeCollinear !== 'undefined' ? removeCollinear : 0.01; removeCollinear = typeof removeCollinear !== 'undefined' ? removeCollinear : 0.01;
minimumArea = typeof minimumArea !== 'undefined' ? minimumArea : 10; minimumArea = typeof minimumArea !== 'undefined' ? minimumArea : 10;
removeDuplicatePoints = typeof removeDuplicatePoints !== 'undefined' ? removeDuplicatePoints : 0.01;
if (!decomp) { if (!decomp) {
Common.warn('Bodies.fromVertices: poly-decomp.js required. Could not decompose vertices. Fallback to convex hull.'); Common.warn('Bodies.fromVertices: poly-decomp.js required. Could not decompose vertices. Fallback to convex hull.');
@ -7065,6 +7060,8 @@ var Vector = __webpack_require__(2);
decomp.makeCCW(concave); decomp.makeCCW(concave);
if (removeCollinear !== false) if (removeCollinear !== false)
decomp.removeCollinearPoints(concave, removeCollinear); decomp.removeCollinearPoints(concave, removeCollinear);
if (removeDuplicatePoints !== false && decomp.removeDuplicatePoints)
decomp.removeDuplicatePoints(concave, removeDuplicatePoints);
// use the quick decomposition algorithm (Bayazit) // use the quick decomposition algorithm (Bayazit)
var decomposed = decomp.quickDecomp(concave); var decomposed = decomp.quickDecomp(concave);
@ -7419,6 +7416,8 @@ var Common = __webpack_require__(0);
* Only the following range types are supported: * Only the following range types are supported:
* - Tilde ranges e.g. `~1.2.3` * - Tilde ranges e.g. `~1.2.3`
* - Caret ranges e.g. `^1.2.3` * - Caret ranges e.g. `^1.2.3`
* - Greater than ranges e.g. `>1.2.3`
* - Greater than or equal ranges e.g. `>=1.2.3`
* - Exact version e.g. `1.2.3` * - Exact version e.g. `1.2.3`
* - Any version `*` * - Any version `*`
* @method versionParse * @method versionParse
@ -7426,29 +7425,28 @@ var Common = __webpack_require__(0);
* @return {object} The version range parsed into its components. * @return {object} The version range parsed into its components.
*/ */
Plugin.versionParse = function(range) { Plugin.versionParse = function(range) {
var pattern = /^\*|[\^~]?\d+\.\d+\.\d+(-[0-9A-Za-z-]+)?$/; var pattern = /^(\*)|(\^|~|>=|>)?\s*((\d+)\.(\d+)\.(\d+))(-[0-9A-Za-z-]+)?$/;
if (!pattern.test(range)) { if (!pattern.test(range)) {
Common.warn('Plugin.versionParse:', range, 'is not a valid version or range.'); Common.warn('Plugin.versionParse:', range, 'is not a valid version or range.');
} }
var identifiers = range.split('-'); var parts = pattern.exec(range);
range = identifiers[0]; var major = Number(parts[4]);
var minor = Number(parts[5]);
var isRange = isNaN(Number(range[0])), var patch = Number(parts[6]);
version = isRange ? range.substr(1) : range,
parts = Common.map(version.split('.'), function(part) {
return Number(part);
});
return { return {
isRange: isRange, isRange: Boolean(parts[1] || parts[2]),
version: version, version: parts[3],
range: range, range: range,
operator: isRange ? range[0] : '', operator: parts[1] || parts[2] || '',
parts: parts, major: major,
prerelease: identifiers[1], minor: minor,
number: parts[0] * 1e8 + parts[1] * 1e4 + parts[2] patch: patch,
parts: [major, minor, patch],
prerelease: parts[7],
number: major * 1e8 + minor * 1e4 + patch
}; };
}; };
@ -7464,30 +7462,36 @@ var Common = __webpack_require__(0);
Plugin.versionSatisfies = function(version, range) { Plugin.versionSatisfies = function(version, range) {
range = range || '*'; range = range || '*';
var rangeParsed = Plugin.versionParse(range), var r = Plugin.versionParse(range),
rangeParts = rangeParsed.parts, v = Plugin.versionParse(version);
versionParsed = Plugin.versionParse(version),
versionParts = versionParsed.parts;
if (rangeParsed.isRange) { if (r.isRange) {
if (rangeParsed.operator === '*' || version === '*') { if (r.operator === '*' || version === '*') {
return true; return true;
} }
if (rangeParsed.operator === '~') { if (r.operator === '>') {
return versionParts[0] === rangeParts[0] && versionParts[1] === rangeParts[1] && versionParts[2] >= rangeParts[2]; return v.number > r.number;
} }
if (rangeParsed.operator === '^') { if (r.operator === '>=') {
if (rangeParts[0] > 0) { return v.number >= r.number;
return versionParts[0] === rangeParts[0] && versionParsed.number >= rangeParsed.number;
} }
if (rangeParts[1] > 0) { if (r.operator === '~') {
return versionParts[1] === rangeParts[1] && versionParts[2] >= rangeParts[2]; return v.major === r.major && v.minor === r.minor && v.patch >= r.patch;
} }
return versionParts[2] === rangeParts[2]; if (r.operator === '^') {
if (r.major > 0) {
return v.major === r.major && v.number >= r.number;
}
if (r.minor > 0) {
return v.minor === r.minor && v.patch >= r.patch;
}
return v.patch === r.patch;
} }
} }
@ -8278,7 +8282,7 @@ var Body = __webpack_require__(6);
var engine = Common.extend(defaults, options); var engine = Common.extend(defaults, options);
// @deprecated // back compatibility
if (element || engine.render) { if (element || engine.render) {
var renderDefaults = { var renderDefaults = {
element: element, element: element,
@ -8288,12 +8292,12 @@ var Body = __webpack_require__(6);
engine.render = Common.extend(renderDefaults, engine.render); engine.render = Common.extend(renderDefaults, engine.render);
} }
// @deprecated // back compatibility
if (engine.render && engine.render.controller) { if (engine.render && engine.render.controller) {
engine.render = engine.render.controller.create(engine.render); engine.render = engine.render.controller.create(engine.render);
} }
// @deprecated // back compatibility
if (engine.render) { if (engine.render) {
engine.render.engine = engine; engine.render.engine = engine;
} }
@ -8912,7 +8916,7 @@ var Common = __webpack_require__(0);
* @readOnly * @readOnly
* @type {String} * @type {String}
*/ */
Matter.version = true ? "0.15.0" : undefined; Matter.version = true ? "0.16.0" : undefined;
/** /**
* A list of plugin dependencies to be installed. These are normally set and installed through `Matter.use`. * A list of plugin dependencies to be installed. These are normally set and installed through `Matter.use`.
@ -9111,7 +9115,6 @@ var Vertices = __webpack_require__(3);
/* 27 */ /* 27 */
/***/ (function(module, exports) { /***/ (function(module, exports) {
if(typeof __WEBPACK_EXTERNAL_MODULE__27__ === 'undefined') {var e = new Error("Cannot find module 'undefined'"); e.code = 'MODULE_NOT_FOUND'; throw e;}
module.exports = __WEBPACK_EXTERNAL_MODULE__27__; module.exports = __WEBPACK_EXTERNAL_MODULE__27__;
/***/ }), /***/ }),
@ -9506,7 +9509,7 @@ var Common = __webpack_require__(0);
}; };
Events.trigger(runner, 'beforeTick', event); Events.trigger(runner, 'beforeTick', event);
Events.trigger(engine, 'beforeTick', event); // @deprecated Events.trigger(engine, 'beforeTick', event); // back compatibility
if (runner.isFixed) { if (runner.isFixed) {
// fixed timestep // fixed timestep
@ -9551,14 +9554,14 @@ var Common = __webpack_require__(0);
} }
Events.trigger(runner, 'tick', event); Events.trigger(runner, 'tick', event);
Events.trigger(engine, 'tick', event); // @deprecated Events.trigger(engine, 'tick', event); // back compatibility
// if world has been modified, clear the render scene graph // if world has been modified, clear the render scene graph
if (engine.world.isModified if (engine.world.isModified
&& engine.render && engine.render
&& engine.render.controller && engine.render.controller
&& engine.render.controller.clear) { && engine.render.controller.clear) {
engine.render.controller.clear(engine.render); // @deprecated engine.render.controller.clear(engine.render); // back compatibility
} }
// update // update
@ -9567,19 +9570,19 @@ var Common = __webpack_require__(0);
Events.trigger(runner, 'afterUpdate', event); Events.trigger(runner, 'afterUpdate', event);
// render // render
// @deprecated // back compatibility
if (engine.render && engine.render.controller) { if (engine.render && engine.render.controller) {
Events.trigger(runner, 'beforeRender', event); Events.trigger(runner, 'beforeRender', event);
Events.trigger(engine, 'beforeRender', event); // @deprecated Events.trigger(engine, 'beforeRender', event); // back compatibility
engine.render.controller.world(engine.render); engine.render.controller.world(engine.render);
Events.trigger(runner, 'afterRender', event); Events.trigger(runner, 'afterRender', event);
Events.trigger(engine, 'afterRender', event); // @deprecated Events.trigger(engine, 'afterRender', event); // back compatibility
} }
Events.trigger(runner, 'afterTick', event); Events.trigger(runner, 'afterTick', event);
Events.trigger(engine, 'afterTick', event); // @deprecated Events.trigger(engine, 'afterTick', event); // back compatibility
}; };
/** /**

4
build/matter.min.js vendored

File diff suppressed because one or more lines are too long

View file

@ -1,5 +1,5 @@
/*! /*!
* matter-js-examples 0.15.0 by @liabru 2020-12-26 * matter-js-examples 0.16.0 by @liabru 2021-01-17
* http://brm.io/matter-js/ * http://brm.io/matter-js/
* License MIT * License MIT
* *
@ -257,10 +257,13 @@ Example.airFriction = function() {
}; };
}; };
Example.airFriction.for = '>=0.14.2';
if (true) { if (true) {
module.exports = Example[Object.keys(Example)[0]]; module.exports = Example.airFriction;
} }
/***/ }), /***/ }),
/* 2 */ /* 2 */
/***/ (function(module, exports, __webpack_require__) { /***/ (function(module, exports, __webpack_require__) {
@ -358,10 +361,13 @@ Example.avalanche = function() {
}; };
}; };
Example.avalanche.for = '>=0.14.2';
if (true) { if (true) {
module.exports = Example[Object.keys(Example)[0]]; module.exports = Example.avalanche;
} }
/***/ }), /***/ }),
/* 3 */ /* 3 */
/***/ (function(module, exports, __webpack_require__) { /***/ (function(module, exports, __webpack_require__) {
@ -467,10 +473,13 @@ Example.ballPool = function() {
}; };
}; };
Example.ballPool.for = '>=0.14.2';
if (true) { if (true) {
module.exports = Example[Object.keys(Example)[0]]; module.exports = Example.ballPool;
} }
/***/ }), /***/ }),
/* 4 */ /* 4 */
/***/ (function(module, exports, __webpack_require__) { /***/ (function(module, exports, __webpack_require__) {
@ -601,10 +610,13 @@ Example.bridge = function() {
}; };
}; };
Example.bridge.for = '>=0.14.2';
if (true) { if (true) {
module.exports = Example[Object.keys(Example)[0]]; module.exports = Example.bridge;
} }
/***/ }), /***/ }),
/* 5 */ /* 5 */
/***/ (function(module, exports, __webpack_require__) { /***/ (function(module, exports, __webpack_require__) {
@ -706,10 +718,13 @@ Example.broadphase = function() {
}; };
}; };
Example.broadphase.for = '>=0.14.2';
if (true) { if (true) {
module.exports = Example[Object.keys(Example)[0]]; module.exports = Example.broadphase;
} }
/***/ }), /***/ }),
/* 6 */ /* 6 */
/***/ (function(module, exports, __webpack_require__) { /***/ (function(module, exports, __webpack_require__) {
@ -805,10 +820,13 @@ Example.car = function() {
}; };
}; };
Example.car.for = '>=0.14.2';
if (true) { if (true) {
module.exports = Example[Object.keys(Example)[0]]; module.exports = Example.car;
} }
/***/ }), /***/ }),
/* 7 */ /* 7 */
/***/ (function(module, exports, __webpack_require__) { /***/ (function(module, exports, __webpack_require__) {
@ -911,10 +929,13 @@ Example.catapult = function() {
}; };
}; };
Example.catapult.for = '>=0.14.2';
if (true) { if (true) {
module.exports = Example[Object.keys(Example)[0]]; module.exports = Example.catapult;
} }
/***/ }), /***/ }),
/* 8 */ /* 8 */
/***/ (function(module, exports, __webpack_require__) { /***/ (function(module, exports, __webpack_require__) {
@ -1043,10 +1064,13 @@ Example.chains = function() {
}; };
}; };
Example.chains.for = '>=0.14.2';
if (true) { if (true) {
module.exports = Example[Object.keys(Example)[0]]; module.exports = Example.chains;
} }
/***/ }), /***/ }),
/* 9 */ /* 9 */
/***/ (function(module, exports, __webpack_require__) { /***/ (function(module, exports, __webpack_require__) {
@ -1134,10 +1158,13 @@ Example.circleStack = function() {
}; };
}; };
Example.circleStack.for = '>=0.14.2';
if (true) { if (true) {
module.exports = Example[Object.keys(Example)[0]]; module.exports = Example.circleStack;
} }
/***/ }), /***/ }),
/* 10 */ /* 10 */
/***/ (function(module, exports, __webpack_require__) { /***/ (function(module, exports, __webpack_require__) {
@ -1228,10 +1255,13 @@ Example.cloth = function() {
}; };
}; };
Example.cloth.for = '>=0.14.2';
if (true) { if (true) {
module.exports = Example[Object.keys(Example)[0]]; module.exports = Example.cloth;
} }
/***/ }), /***/ }),
/* 11 */ /* 11 */
/***/ (function(module, exports, __webpack_require__) { /***/ (function(module, exports, __webpack_require__) {
@ -1392,10 +1422,13 @@ Example.collisionFiltering = function() {
}; };
}; };
Example.collisionFiltering.for = '>=0.14.2';
if (true) { if (true) {
module.exports = Example[Object.keys(Example)[0]]; module.exports = Example.collisionFiltering;
} }
/***/ }), /***/ }),
/* 12 */ /* 12 */
/***/ (function(module, exports, __webpack_require__) { /***/ (function(module, exports, __webpack_require__) {
@ -1509,10 +1542,13 @@ Example.compositeManipulation = function() {
}; };
}; };
Example.compositeManipulation.for = '>=0.14.2';
if (true) { if (true) {
module.exports = Example[Object.keys(Example)[0]]; module.exports = Example.compositeManipulation;
} }
/***/ }), /***/ }),
/* 13 */ /* 13 */
/***/ (function(module, exports, __webpack_require__) { /***/ (function(module, exports, __webpack_require__) {
@ -1625,10 +1661,13 @@ Example.compound = function() {
}; };
}; };
Example.compound.for = '>=0.14.2';
if (true) { if (true) {
module.exports = Example[Object.keys(Example)[0]]; module.exports = Example.compound;
} }
/***/ }), /***/ }),
/* 14 */ /* 14 */
/***/ (function(module, exports, __webpack_require__) { /***/ (function(module, exports, __webpack_require__) {
@ -1724,10 +1763,13 @@ Example.compoundStack = function() {
}; };
}; };
Example.compoundStack.for = '>=0.14.2';
if (true) { if (true) {
module.exports = Example[Object.keys(Example)[0]]; module.exports = Example.compoundStack;
} }
/***/ }), /***/ }),
/* 15 */ /* 15 */
/***/ (function(module, exports, __webpack_require__) { /***/ (function(module, exports, __webpack_require__) {
@ -1829,10 +1871,13 @@ Example.concave = function() {
}; };
}; };
Example.concave.for = '>=0.14.2';
if (true) { if (true) {
module.exports = Example[Object.keys(Example)[0]]; module.exports = Example.concave;
} }
/***/ }), /***/ }),
/* 16 */ /* 16 */
/***/ (function(module, exports, __webpack_require__) { /***/ (function(module, exports, __webpack_require__) {
@ -2018,10 +2063,13 @@ Example.constraints = function() {
}; };
}; };
Example.constraints.for = '>=0.14.2';
if (true) { if (true) {
module.exports = Example[Object.keys(Example)[0]]; module.exports = Example.constraints;
} }
/***/ }), /***/ }),
/* 17 */ /* 17 */
/***/ (function(module, exports, __webpack_require__) { /***/ (function(module, exports, __webpack_require__) {
@ -2176,10 +2224,13 @@ Example.doublePendulum = function() {
}; };
}; };
Example.doublePendulum.for = '>=0.14.2';
if (true) { if (true) {
module.exports = Example[Object.keys(Example)[0]]; module.exports = Example.doublePendulum;
} }
/***/ }), /***/ }),
/* 18 */ /* 18 */
/***/ (function(module, exports, __webpack_require__) { /***/ (function(module, exports, __webpack_require__) {
@ -2364,10 +2415,13 @@ Example.events = function() {
}; };
}; };
Example.events.for = '>=0.14.2';
if (true) { if (true) {
module.exports = Example[Object.keys(Example)[0]]; module.exports = Example.events;
} }
/***/ }), /***/ }),
/* 19 */ /* 19 */
/***/ (function(module, exports, __webpack_require__) { /***/ (function(module, exports, __webpack_require__) {
@ -2464,10 +2518,13 @@ Example.friction = function() {
}; };
}; };
Example.friction.for = '>=0.14.2';
if (true) { if (true) {
module.exports = Example[Object.keys(Example)[0]]; module.exports = Example.friction;
} }
/***/ }), /***/ }),
/* 20 */ /* 20 */
/***/ (function(module, exports, __webpack_require__) { /***/ (function(module, exports, __webpack_require__) {
@ -2570,10 +2627,13 @@ Example.gravity = function() {
}; };
}; };
Example.gravity.for = '>=0.14.2';
if (true) { if (true) {
module.exports = Example[Object.keys(Example)[0]]; module.exports = Example.gravity;
} }
/***/ }), /***/ }),
/* 21 */ /* 21 */
/***/ (function(module, exports, __webpack_require__) { /***/ (function(module, exports, __webpack_require__) {
@ -2710,10 +2770,13 @@ Example.gyro = function() {
}; };
}; };
Example.gyro.for = '>=0.14.2';
if (true) { if (true) {
module.exports = Example[Object.keys(Example)[0]]; module.exports = Example.gyro;
} }
/***/ }), /***/ }),
/* 22 */ /* 22 */
/***/ (function(module, exports, __webpack_require__) { /***/ (function(module, exports, __webpack_require__) {
@ -2860,10 +2923,13 @@ Example.manipulation = function() {
}; };
}; };
Example.manipulation.for = '>=0.14.2';
if (true) { if (true) {
module.exports = Example[Object.keys(Example)[0]]; module.exports = Example.manipulation;
} }
/***/ }), /***/ }),
/* 23 */ /* 23 */
/***/ (function(module, exports, __webpack_require__) { /***/ (function(module, exports, __webpack_require__) {
@ -2975,10 +3041,13 @@ Example.mixed = function() {
}; };
}; };
Example.mixed.for = '>=0.14.2';
if (true) { if (true) {
module.exports = Example[Object.keys(Example)[0]]; module.exports = Example.mixed;
} }
/***/ }), /***/ }),
/* 24 */ /* 24 */
/***/ (function(module, exports, __webpack_require__) { /***/ (function(module, exports, __webpack_require__) {
@ -3061,10 +3130,13 @@ Example.newtonsCradle = function() {
}; };
}; };
Example.newtonsCradle.for = '>=0.14.2';
if (true) { if (true) {
module.exports = Example[Object.keys(Example)[0]]; module.exports = Example.newtonsCradle;
} }
/***/ }), /***/ }),
/* 25 */ /* 25 */
/***/ (function(module, exports, __webpack_require__) { /***/ (function(module, exports, __webpack_require__) {
@ -3569,10 +3641,13 @@ Example.ragdoll.ragdoll = function(x, y, scale, options) {
return person; return person;
}; };
Example.ragdoll.for = '>=0.14.2';
if (true) { if (true) {
module.exports = Example[Object.keys(Example)[0]]; module.exports = Example.ragdoll;
} }
/***/ }), /***/ }),
/* 26 */ /* 26 */
/***/ (function(module, exports, __webpack_require__) { /***/ (function(module, exports, __webpack_require__) {
@ -3660,10 +3735,13 @@ Example.pyramid = function() {
}; };
}; };
Example.pyramid.for = '>=0.14.2';
if (true) { if (true) {
module.exports = Example[Object.keys(Example)[0]]; module.exports = Example.pyramid;
} }
/***/ }), /***/ }),
/* 27 */ /* 27 */
/***/ (function(module, exports, __webpack_require__) { /***/ (function(module, exports, __webpack_require__) {
@ -3805,10 +3883,13 @@ Example.raycasting = function() {
}; };
}; };
Example.raycasting.for = '>=0.14.2';
if (true) { if (true) {
module.exports = Example[Object.keys(Example)[0]]; module.exports = Example.raycasting;
} }
/***/ }), /***/ }),
/* 28 */ /* 28 */
/***/ (function(module, exports, __webpack_require__) { /***/ (function(module, exports, __webpack_require__) {
@ -3900,10 +3981,13 @@ Example.restitution = function() {
}; };
}; };
Example.restitution.for = '>=0.14.2';
if (true) { if (true) {
module.exports = Example[Object.keys(Example)[0]]; module.exports = Example.restitution;
} }
/***/ }), /***/ }),
/* 29 */ /* 29 */
/***/ (function(module, exports, __webpack_require__) { /***/ (function(module, exports, __webpack_require__) {
@ -4019,10 +4103,13 @@ Example.rounded = function() {
}; };
}; };
Example.rounded.for = '>=0.14.2';
if (true) { if (true) {
module.exports = Example[Object.keys(Example)[0]]; module.exports = Example.rounded;
} }
/***/ }), /***/ }),
/* 30 */ /* 30 */
/***/ (function(module, exports, __webpack_require__) { /***/ (function(module, exports, __webpack_require__) {
@ -4159,10 +4246,13 @@ Example.sensors = function() {
}; };
}; };
Example.sensors.for = '>=0.14.2';
if (true) { if (true) {
module.exports = Example[Object.keys(Example)[0]]; module.exports = Example.sensors;
} }
/***/ }), /***/ }),
/* 31 */ /* 31 */
/***/ (function(module, exports, __webpack_require__) { /***/ (function(module, exports, __webpack_require__) {
@ -4273,10 +4363,13 @@ Example.sleeping = function() {
}; };
}; };
Example.sleeping.for = '>=0.14.2';
if (true) { if (true) {
module.exports = Example[Object.keys(Example)[0]]; module.exports = Example.sleeping;
} }
/***/ }), /***/ }),
/* 32 */ /* 32 */
/***/ (function(module, exports, __webpack_require__) { /***/ (function(module, exports, __webpack_require__) {
@ -4383,10 +4476,13 @@ Example.slingshot = function() {
}; };
}; };
Example.slingshot.for = '>=0.14.2';
if (true) { if (true) {
module.exports = Example[Object.keys(Example)[0]]; module.exports = Example.slingshot;
} }
/***/ }), /***/ }),
/* 33 */ /* 33 */
/***/ (function(module, exports, __webpack_require__) { /***/ (function(module, exports, __webpack_require__) {
@ -4478,10 +4574,13 @@ Example.softBody = function() {
}; };
}; };
Example.softBody.for = '>=0.14.2';
if (true) { if (true) {
module.exports = Example[Object.keys(Example)[0]]; module.exports = Example.softBody;
} }
/***/ }), /***/ }),
/* 34 */ /* 34 */
/***/ (function(module, exports, __webpack_require__) { /***/ (function(module, exports, __webpack_require__) {
@ -4600,10 +4699,13 @@ Example.sprites = function() {
}; };
}; };
Example.sprites.for = '>=0.14.2';
if (true) { if (true) {
module.exports = Example[Object.keys(Example)[0]]; module.exports = Example.sprites;
} }
/***/ }), /***/ }),
/* 35 */ /* 35 */
/***/ (function(module, exports, __webpack_require__) { /***/ (function(module, exports, __webpack_require__) {
@ -4691,10 +4793,13 @@ Example.stack = function() {
}; };
}; };
Example.stack.for = '>=0.14.2';
if (true) { if (true) {
module.exports = Example[Object.keys(Example)[0]]; module.exports = Example.stack;
} }
/***/ }), /***/ }),
/* 36 */ /* 36 */
/***/ (function(module, exports, __webpack_require__) { /***/ (function(module, exports, __webpack_require__) {
@ -4807,10 +4912,13 @@ Example.staticFriction = function() {
}; };
}; };
Example.staticFriction.for = '>=0.14.2';
if (true) { if (true) {
module.exports = Example[Object.keys(Example)[0]]; module.exports = Example.staticFriction;
} }
/***/ }), /***/ }),
/* 37 */ /* 37 */
/***/ (function(module, exports, __webpack_require__) { /***/ (function(module, exports, __webpack_require__) {
@ -4896,10 +5004,13 @@ Example.stress = function() {
}; };
}; };
Example.stress.for = '>=0.14.2';
if (true) { if (true) {
module.exports = Example[Object.keys(Example)[0]]; module.exports = Example.stress;
} }
/***/ }), /***/ }),
/* 38 */ /* 38 */
/***/ (function(module, exports, __webpack_require__) { /***/ (function(module, exports, __webpack_require__) {
@ -4985,10 +5096,13 @@ Example.stress2 = function() {
}; };
}; };
Example.stress2.for = '>=0.14.2';
if (true) { if (true) {
module.exports = Example[Object.keys(Example)[0]]; module.exports = Example.stress2;
} }
/***/ }), /***/ }),
/* 39 */ /* 39 */
/***/ (function(module, exports, __webpack_require__) { /***/ (function(module, exports, __webpack_require__) {
@ -5028,24 +5142,28 @@ Example.svg = function() {
Runner.run(runner, engine); Runner.run(runner, engine);
// add bodies // add bodies
var svgs = [ if (typeof fetch !== 'undefined') {
'iconmonstr-check-mark-8-icon', var select = function(root, selector) {
'iconmonstr-paperclip-2-icon', return Array.prototype.slice.call(root.querySelectorAll(selector));
'iconmonstr-puzzle-icon', };
'iconmonstr-user-icon'
];
if (typeof $ !== 'undefined') { var loadSvg = function(url) {
for (var i = 0; i < svgs.length; i += 1) { return fetch(url)
(function(i) { .then(function(response) { return response.text(); })
$.get('./svg/' + svgs[i] + '.svg').done(function(data) { .then(function(raw) { return (new window.DOMParser()).parseFromString(raw, 'image/svg+xml'); });
var vertexSets = [], };
color = Common.choose(['#f19648', '#f5d259', '#f55a3c', '#063e7b', '#ececd1']);
$(data).find('path').each(function(i, path) { ([
var points = Svg.pathToVertices(path, 30); './svg/iconmonstr-check-mark-8-icon.svg',
vertexSets.push(Vertices.scale(points, 0.4, 0.4)); './svg/iconmonstr-paperclip-2-icon.svg',
}); './svg/iconmonstr-puzzle-icon.svg',
'./svg/iconmonstr-user-icon.svg'
]).forEach(function(path, i) {
loadSvg(path).then(function(root) {
var color = Common.choose(['#f19648', '#f5d259', '#f55a3c', '#063e7b', '#ececd1']);
var vertexSets = select(root, 'path')
.map(function(path) { return Vertices.scale(Svg.pathToVertices(path, 30), 0.4, 0.4); });
World.add(world, Bodies.fromVertices(100 + i * 150, 200 + i * 50, vertexSets, { World.add(world, Bodies.fromVertices(100 + i * 150, 200 + i * 50, vertexSets, {
render: { render: {
@ -5055,17 +5173,14 @@ Example.svg = function() {
} }
}, true)); }, true));
}); });
})(i);
}
$.get('./svg/svg.svg').done(function(data) {
var vertexSets = [],
color = Common.choose(['#f19648', '#f5d259', '#f55a3c', '#063e7b', '#ececd1']);
$(data).find('path').each(function(i, path) {
vertexSets.push(Svg.pathToVertices(path, 30));
}); });
loadSvg('./svg/svg.svg').then(function(root) {
var color = Common.choose(['#f19648', '#f5d259', '#f55a3c', '#063e7b', '#ececd1']);
var vertexSets = select(root, 'path')
.map(function(path) { return Svg.pathToVertices(path, 30); });
World.add(world, Bodies.fromVertices(400, 80, vertexSets, { World.add(world, Bodies.fromVertices(400, 80, vertexSets, {
render: { render: {
fillStyle: color, fillStyle: color,
@ -5074,6 +5189,8 @@ Example.svg = function() {
} }
}, true)); }, true));
}); });
} else {
Common.warn('Fetch is not available. Could not load SVG.');
} }
World.add(world, [ World.add(world, [
@ -5119,10 +5236,13 @@ Example.svg = function() {
}; };
}; };
Example.svg.for = '>=0.14.2';
if (true) { if (true) {
module.exports = Example[Object.keys(Example)[0]]; module.exports = Example.svg;
} }
/***/ }), /***/ }),
/* 40 */ /* 40 */
/***/ (function(module, exports, __webpack_require__) { /***/ (function(module, exports, __webpack_require__) {
@ -5163,17 +5283,24 @@ Example.terrain = function() {
Runner.run(runner, engine); Runner.run(runner, engine);
// add bodies // add bodies
var terrain; if (typeof fetch !== 'undefined') {
var select = function(root, selector) {
return Array.prototype.slice.call(root.querySelectorAll(selector));
};
if (typeof $ !== 'undefined') { var loadSvg = function(url) {
$.get('./svg/terrain.svg').done(function(data) { return fetch(url)
var vertexSets = []; .then(function(response) { return response.text(); })
.then(function(raw) { return (new window.DOMParser()).parseFromString(raw, 'image/svg+xml'); });
};
$(data).find('path').each(function(i, path) { loadSvg('./svg/terrain.svg')
vertexSets.push(Svg.pathToVertices(path, 30)); .then(function(root) {
}); var paths = select(root, 'path');
terrain = Bodies.fromVertices(400, 350, vertexSets, { var vertexSets = paths.map(function(path) { return Svg.pathToVertices(path, 30); });
var terrain = Bodies.fromVertices(400, 350, vertexSets, {
isStatic: true, isStatic: true,
render: { render: {
fillStyle: '#060a19', fillStyle: '#060a19',
@ -5196,6 +5323,8 @@ Example.terrain = function() {
} }
})); }));
}); });
} else {
Common.warn('Fetch is not available. Could not load SVG.');
} }
// add mouse control // add mouse control
@ -5234,10 +5363,13 @@ Example.terrain = function() {
}; };
}; };
Example.terrain.for = '>=0.14.2';
if (true) { if (true) {
module.exports = Example[Object.keys(Example)[0]]; module.exports = Example.terrain;
} }
/***/ }), /***/ }),
/* 41 */ /* 41 */
/***/ (function(module, exports, __webpack_require__) { /***/ (function(module, exports, __webpack_require__) {
@ -5395,10 +5527,13 @@ Example.timescale = function() {
}; };
}; };
Example.timescale.for = '>=0.14.2';
if (true) { if (true) {
module.exports = Example[Object.keys(Example)[0]]; module.exports = Example.timescale;
} }
/***/ }), /***/ }),
/* 42 */ /* 42 */
/***/ (function(module, exports, __webpack_require__) { /***/ (function(module, exports, __webpack_require__) {
@ -5587,10 +5722,13 @@ Example.views = function() {
}; };
}; };
Example.views.for = '>=0.14.2';
if (true) { if (true) {
module.exports = Example[Object.keys(Example)[0]]; module.exports = Example.views;
} }
/***/ }), /***/ }),
/* 43 */ /* 43 */
/***/ (function(module, exports, __webpack_require__) { /***/ (function(module, exports, __webpack_require__) {
@ -5690,10 +5828,13 @@ Example.wreckingBall = function() {
}; };
}; };
Example.wreckingBall.for = '>=0.14.2';
if (true) { if (true) {
module.exports = Example[Object.keys(Example)[0]]; module.exports = Example.wreckingBall;
} }
/***/ }) /***/ })
/******/ ]); /******/ ]);
}); });

2
package-lock.json generated
View file

@ -1,6 +1,6 @@
{ {
"name": "matter-js", "name": "matter-js",
"version": "0.15.0", "version": "0.16.0",
"lockfileVersion": 1, "lockfileVersion": 1,
"requires": true, "requires": true,
"dependencies": { "dependencies": {

View file

@ -1,6 +1,6 @@
{ {
"name": "matter-js", "name": "matter-js",
"version": "0.15.0", "version": "0.16.0",
"license": "MIT", "license": "MIT",
"homepage": "http://brm.io/matter-js/", "homepage": "http://brm.io/matter-js/",
"author": "Liam Brummitt <liam@brm.io> (http://brm.io/)", "author": "Liam Brummitt <liam@brm.io> (http://brm.io/)",