0
0
Fork 0
mirror of https://github.com/liabru/matter-js.git synced 2025-01-20 17:10:11 -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)
* 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`
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/
* License MIT
*
@ -27,11 +27,11 @@
*/
(function webpackUniversalModuleDefinition(root, factory) {
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)
define("Matter", ["poly-decomp"], factory);
else if(typeof exports === 'object')
exports["Matter"] = factory((function webpackLoadOptionalExternalModule() { try { return require("poly-decomp"); } catch(e) {} }()));
exports["Matter"] = factory(require("poly-decomp"));
else
root["Matter"] = factory(root["decomp"]);
})(this, function(__WEBPACK_EXTERNAL_MODULE__27__) {
@ -7002,11 +7002,11 @@ var Vector = __webpack_require__(2);
* @param {bool} [flagInternal=false]
* @param {number} [removeCollinear=0.01]
* @param {number} [minimumArea=10]
* @param {number} [removeDuplicatePoints=0.01]
* @return {body}
*/
Bodies.fromVertices = function(x, y, vertexSets, options, flagInternal, removeCollinear, minimumArea) {
var globals = typeof global !== 'undefined' ? global : window,
decomp,
Bodies.fromVertices = function(x, y, vertexSets, options, flagInternal, removeCollinear, minimumArea, removeDuplicatePoints) {
var decomp = __webpack_require__(27),
body,
parts,
isConvex,
@ -7017,18 +7017,13 @@ var Vector = __webpack_require__(2);
v,
z;
try {
decomp = globals.decomp || __webpack_require__(27);
} catch (e) {
// decomp is undefined
}
options = options || {};
parts = [];
flagInternal = typeof flagInternal !== 'undefined' ? flagInternal : false;
removeCollinear = typeof removeCollinear !== 'undefined' ? removeCollinear : 0.01;
minimumArea = typeof minimumArea !== 'undefined' ? minimumArea : 10;
removeDuplicatePoints = typeof removeDuplicatePoints !== 'undefined' ? removeDuplicatePoints : 0.01;
if (!decomp) {
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);
if (removeCollinear !== false)
decomp.removeCollinearPoints(concave, removeCollinear);
if (removeDuplicatePoints !== false && decomp.removeDuplicatePoints)
decomp.removeDuplicatePoints(concave, removeDuplicatePoints);
// use the quick decomposition algorithm (Bayazit)
var decomposed = decomp.quickDecomp(concave);
@ -7419,6 +7416,8 @@ var Common = __webpack_require__(0);
* Only the following range types are supported:
* - Tilde 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`
* - Any version `*`
* @method versionParse
@ -7426,29 +7425,28 @@ var Common = __webpack_require__(0);
* @return {object} The version range parsed into its components.
*/
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)) {
Common.warn('Plugin.versionParse:', range, 'is not a valid version or range.');
}
var identifiers = range.split('-');
range = identifiers[0];
var isRange = isNaN(Number(range[0])),
version = isRange ? range.substr(1) : range,
parts = Common.map(version.split('.'), function(part) {
return Number(part);
});
var parts = pattern.exec(range);
var major = Number(parts[4]);
var minor = Number(parts[5]);
var patch = Number(parts[6]);
return {
isRange: isRange,
version: version,
isRange: Boolean(parts[1] || parts[2]),
version: parts[3],
range: range,
operator: isRange ? range[0] : '',
parts: parts,
prerelease: identifiers[1],
number: parts[0] * 1e8 + parts[1] * 1e4 + parts[2]
operator: parts[1] || parts[2] || '',
major: major,
minor: minor,
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) {
range = range || '*';
var rangeParsed = Plugin.versionParse(range),
rangeParts = rangeParsed.parts,
versionParsed = Plugin.versionParse(version),
versionParts = versionParsed.parts;
var r = Plugin.versionParse(range),
v = Plugin.versionParse(version);
if (rangeParsed.isRange) {
if (rangeParsed.operator === '*' || version === '*') {
if (r.isRange) {
if (r.operator === '*' || version === '*') {
return true;
}
if (rangeParsed.operator === '~') {
return versionParts[0] === rangeParts[0] && versionParts[1] === rangeParts[1] && versionParts[2] >= rangeParts[2];
if (r.operator === '>') {
return v.number > r.number;
}
if (rangeParsed.operator === '^') {
if (rangeParts[0] > 0) {
return versionParts[0] === rangeParts[0] && versionParsed.number >= rangeParsed.number;
if (r.operator === '>=') {
return v.number >= r.number;
}
if (r.operator === '~') {
return v.major === r.major && v.minor === r.minor && v.patch >= r.patch;
}
if (r.operator === '^') {
if (r.major > 0) {
return v.major === r.major && v.number >= r.number;
}
if (rangeParts[1] > 0) {
return versionParts[1] === rangeParts[1] && versionParts[2] >= rangeParts[2];
if (r.minor > 0) {
return v.minor === r.minor && v.patch >= r.patch;
}
return versionParts[2] === rangeParts[2];
return v.patch === r.patch;
}
}
@ -8278,7 +8282,7 @@ var Body = __webpack_require__(6);
var engine = Common.extend(defaults, options);
// @deprecated
// back compatibility
if (element || engine.render) {
var renderDefaults = {
element: element,
@ -8288,12 +8292,12 @@ var Body = __webpack_require__(6);
engine.render = Common.extend(renderDefaults, engine.render);
}
// @deprecated
// back compatibility
if (engine.render && engine.render.controller) {
engine.render = engine.render.controller.create(engine.render);
}
// @deprecated
// back compatibility
if (engine.render) {
engine.render.engine = engine;
}
@ -8912,7 +8916,7 @@ var Common = __webpack_require__(0);
* @readOnly
* @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`.
@ -9111,7 +9115,6 @@ var Vertices = __webpack_require__(3);
/* 27 */
/***/ (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__;
/***/ }),
@ -9506,7 +9509,7 @@ var Common = __webpack_require__(0);
};
Events.trigger(runner, 'beforeTick', event);
Events.trigger(engine, 'beforeTick', event); // @deprecated
Events.trigger(engine, 'beforeTick', event); // back compatibility
if (runner.isFixed) {
// fixed timestep
@ -9551,14 +9554,14 @@ var Common = __webpack_require__(0);
}
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 (engine.world.isModified
&& engine.render
&& engine.render.controller
&& engine.render.controller.clear) {
engine.render.controller.clear(engine.render); // @deprecated
engine.render.controller.clear(engine.render); // back compatibility
}
// update
@ -9567,19 +9570,19 @@ var Common = __webpack_require__(0);
Events.trigger(runner, 'afterUpdate', event);
// render
// @deprecated
// back compatibility
if (engine.render && engine.render.controller) {
Events.trigger(runner, 'beforeRender', event);
Events.trigger(engine, 'beforeRender', event); // @deprecated
Events.trigger(engine, 'beforeRender', event); // back compatibility
engine.render.controller.world(engine.render);
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(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/
* License MIT
*
@ -257,10 +257,13 @@ Example.airFriction = function() {
};
};
Example.airFriction.for = '>=0.14.2';
if (true) {
module.exports = Example[Object.keys(Example)[0]];
module.exports = Example.airFriction;
}
/***/ }),
/* 2 */
/***/ (function(module, exports, __webpack_require__) {
@ -358,10 +361,13 @@ Example.avalanche = function() {
};
};
Example.avalanche.for = '>=0.14.2';
if (true) {
module.exports = Example[Object.keys(Example)[0]];
module.exports = Example.avalanche;
}
/***/ }),
/* 3 */
/***/ (function(module, exports, __webpack_require__) {
@ -467,10 +473,13 @@ Example.ballPool = function() {
};
};
Example.ballPool.for = '>=0.14.2';
if (true) {
module.exports = Example[Object.keys(Example)[0]];
module.exports = Example.ballPool;
}
/***/ }),
/* 4 */
/***/ (function(module, exports, __webpack_require__) {
@ -601,10 +610,13 @@ Example.bridge = function() {
};
};
Example.bridge.for = '>=0.14.2';
if (true) {
module.exports = Example[Object.keys(Example)[0]];
module.exports = Example.bridge;
}
/***/ }),
/* 5 */
/***/ (function(module, exports, __webpack_require__) {
@ -706,10 +718,13 @@ Example.broadphase = function() {
};
};
Example.broadphase.for = '>=0.14.2';
if (true) {
module.exports = Example[Object.keys(Example)[0]];
module.exports = Example.broadphase;
}
/***/ }),
/* 6 */
/***/ (function(module, exports, __webpack_require__) {
@ -805,10 +820,13 @@ Example.car = function() {
};
};
Example.car.for = '>=0.14.2';
if (true) {
module.exports = Example[Object.keys(Example)[0]];
module.exports = Example.car;
}
/***/ }),
/* 7 */
/***/ (function(module, exports, __webpack_require__) {
@ -911,10 +929,13 @@ Example.catapult = function() {
};
};
Example.catapult.for = '>=0.14.2';
if (true) {
module.exports = Example[Object.keys(Example)[0]];
module.exports = Example.catapult;
}
/***/ }),
/* 8 */
/***/ (function(module, exports, __webpack_require__) {
@ -1043,10 +1064,13 @@ Example.chains = function() {
};
};
Example.chains.for = '>=0.14.2';
if (true) {
module.exports = Example[Object.keys(Example)[0]];
module.exports = Example.chains;
}
/***/ }),
/* 9 */
/***/ (function(module, exports, __webpack_require__) {
@ -1134,10 +1158,13 @@ Example.circleStack = function() {
};
};
Example.circleStack.for = '>=0.14.2';
if (true) {
module.exports = Example[Object.keys(Example)[0]];
module.exports = Example.circleStack;
}
/***/ }),
/* 10 */
/***/ (function(module, exports, __webpack_require__) {
@ -1228,10 +1255,13 @@ Example.cloth = function() {
};
};
Example.cloth.for = '>=0.14.2';
if (true) {
module.exports = Example[Object.keys(Example)[0]];
module.exports = Example.cloth;
}
/***/ }),
/* 11 */
/***/ (function(module, exports, __webpack_require__) {
@ -1392,10 +1422,13 @@ Example.collisionFiltering = function() {
};
};
Example.collisionFiltering.for = '>=0.14.2';
if (true) {
module.exports = Example[Object.keys(Example)[0]];
module.exports = Example.collisionFiltering;
}
/***/ }),
/* 12 */
/***/ (function(module, exports, __webpack_require__) {
@ -1509,10 +1542,13 @@ Example.compositeManipulation = function() {
};
};
Example.compositeManipulation.for = '>=0.14.2';
if (true) {
module.exports = Example[Object.keys(Example)[0]];
module.exports = Example.compositeManipulation;
}
/***/ }),
/* 13 */
/***/ (function(module, exports, __webpack_require__) {
@ -1625,10 +1661,13 @@ Example.compound = function() {
};
};
Example.compound.for = '>=0.14.2';
if (true) {
module.exports = Example[Object.keys(Example)[0]];
module.exports = Example.compound;
}
/***/ }),
/* 14 */
/***/ (function(module, exports, __webpack_require__) {
@ -1724,10 +1763,13 @@ Example.compoundStack = function() {
};
};
Example.compoundStack.for = '>=0.14.2';
if (true) {
module.exports = Example[Object.keys(Example)[0]];
module.exports = Example.compoundStack;
}
/***/ }),
/* 15 */
/***/ (function(module, exports, __webpack_require__) {
@ -1829,10 +1871,13 @@ Example.concave = function() {
};
};
Example.concave.for = '>=0.14.2';
if (true) {
module.exports = Example[Object.keys(Example)[0]];
module.exports = Example.concave;
}
/***/ }),
/* 16 */
/***/ (function(module, exports, __webpack_require__) {
@ -2018,10 +2063,13 @@ Example.constraints = function() {
};
};
Example.constraints.for = '>=0.14.2';
if (true) {
module.exports = Example[Object.keys(Example)[0]];
module.exports = Example.constraints;
}
/***/ }),
/* 17 */
/***/ (function(module, exports, __webpack_require__) {
@ -2176,10 +2224,13 @@ Example.doublePendulum = function() {
};
};
Example.doublePendulum.for = '>=0.14.2';
if (true) {
module.exports = Example[Object.keys(Example)[0]];
module.exports = Example.doublePendulum;
}
/***/ }),
/* 18 */
/***/ (function(module, exports, __webpack_require__) {
@ -2364,10 +2415,13 @@ Example.events = function() {
};
};
Example.events.for = '>=0.14.2';
if (true) {
module.exports = Example[Object.keys(Example)[0]];
module.exports = Example.events;
}
/***/ }),
/* 19 */
/***/ (function(module, exports, __webpack_require__) {
@ -2464,10 +2518,13 @@ Example.friction = function() {
};
};
Example.friction.for = '>=0.14.2';
if (true) {
module.exports = Example[Object.keys(Example)[0]];
module.exports = Example.friction;
}
/***/ }),
/* 20 */
/***/ (function(module, exports, __webpack_require__) {
@ -2570,10 +2627,13 @@ Example.gravity = function() {
};
};
Example.gravity.for = '>=0.14.2';
if (true) {
module.exports = Example[Object.keys(Example)[0]];
module.exports = Example.gravity;
}
/***/ }),
/* 21 */
/***/ (function(module, exports, __webpack_require__) {
@ -2710,10 +2770,13 @@ Example.gyro = function() {
};
};
Example.gyro.for = '>=0.14.2';
if (true) {
module.exports = Example[Object.keys(Example)[0]];
module.exports = Example.gyro;
}
/***/ }),
/* 22 */
/***/ (function(module, exports, __webpack_require__) {
@ -2860,10 +2923,13 @@ Example.manipulation = function() {
};
};
Example.manipulation.for = '>=0.14.2';
if (true) {
module.exports = Example[Object.keys(Example)[0]];
module.exports = Example.manipulation;
}
/***/ }),
/* 23 */
/***/ (function(module, exports, __webpack_require__) {
@ -2975,10 +3041,13 @@ Example.mixed = function() {
};
};
Example.mixed.for = '>=0.14.2';
if (true) {
module.exports = Example[Object.keys(Example)[0]];
module.exports = Example.mixed;
}
/***/ }),
/* 24 */
/***/ (function(module, exports, __webpack_require__) {
@ -3061,10 +3130,13 @@ Example.newtonsCradle = function() {
};
};
Example.newtonsCradle.for = '>=0.14.2';
if (true) {
module.exports = Example[Object.keys(Example)[0]];
module.exports = Example.newtonsCradle;
}
/***/ }),
/* 25 */
/***/ (function(module, exports, __webpack_require__) {
@ -3569,10 +3641,13 @@ Example.ragdoll.ragdoll = function(x, y, scale, options) {
return person;
};
Example.ragdoll.for = '>=0.14.2';
if (true) {
module.exports = Example[Object.keys(Example)[0]];
module.exports = Example.ragdoll;
}
/***/ }),
/* 26 */
/***/ (function(module, exports, __webpack_require__) {
@ -3660,10 +3735,13 @@ Example.pyramid = function() {
};
};
Example.pyramid.for = '>=0.14.2';
if (true) {
module.exports = Example[Object.keys(Example)[0]];
module.exports = Example.pyramid;
}
/***/ }),
/* 27 */
/***/ (function(module, exports, __webpack_require__) {
@ -3805,10 +3883,13 @@ Example.raycasting = function() {
};
};
Example.raycasting.for = '>=0.14.2';
if (true) {
module.exports = Example[Object.keys(Example)[0]];
module.exports = Example.raycasting;
}
/***/ }),
/* 28 */
/***/ (function(module, exports, __webpack_require__) {
@ -3900,10 +3981,13 @@ Example.restitution = function() {
};
};
Example.restitution.for = '>=0.14.2';
if (true) {
module.exports = Example[Object.keys(Example)[0]];
module.exports = Example.restitution;
}
/***/ }),
/* 29 */
/***/ (function(module, exports, __webpack_require__) {
@ -4019,10 +4103,13 @@ Example.rounded = function() {
};
};
Example.rounded.for = '>=0.14.2';
if (true) {
module.exports = Example[Object.keys(Example)[0]];
module.exports = Example.rounded;
}
/***/ }),
/* 30 */
/***/ (function(module, exports, __webpack_require__) {
@ -4159,10 +4246,13 @@ Example.sensors = function() {
};
};
Example.sensors.for = '>=0.14.2';
if (true) {
module.exports = Example[Object.keys(Example)[0]];
module.exports = Example.sensors;
}
/***/ }),
/* 31 */
/***/ (function(module, exports, __webpack_require__) {
@ -4273,10 +4363,13 @@ Example.sleeping = function() {
};
};
Example.sleeping.for = '>=0.14.2';
if (true) {
module.exports = Example[Object.keys(Example)[0]];
module.exports = Example.sleeping;
}
/***/ }),
/* 32 */
/***/ (function(module, exports, __webpack_require__) {
@ -4383,10 +4476,13 @@ Example.slingshot = function() {
};
};
Example.slingshot.for = '>=0.14.2';
if (true) {
module.exports = Example[Object.keys(Example)[0]];
module.exports = Example.slingshot;
}
/***/ }),
/* 33 */
/***/ (function(module, exports, __webpack_require__) {
@ -4478,10 +4574,13 @@ Example.softBody = function() {
};
};
Example.softBody.for = '>=0.14.2';
if (true) {
module.exports = Example[Object.keys(Example)[0]];
module.exports = Example.softBody;
}
/***/ }),
/* 34 */
/***/ (function(module, exports, __webpack_require__) {
@ -4600,10 +4699,13 @@ Example.sprites = function() {
};
};
Example.sprites.for = '>=0.14.2';
if (true) {
module.exports = Example[Object.keys(Example)[0]];
module.exports = Example.sprites;
}
/***/ }),
/* 35 */
/***/ (function(module, exports, __webpack_require__) {
@ -4691,10 +4793,13 @@ Example.stack = function() {
};
};
Example.stack.for = '>=0.14.2';
if (true) {
module.exports = Example[Object.keys(Example)[0]];
module.exports = Example.stack;
}
/***/ }),
/* 36 */
/***/ (function(module, exports, __webpack_require__) {
@ -4807,10 +4912,13 @@ Example.staticFriction = function() {
};
};
Example.staticFriction.for = '>=0.14.2';
if (true) {
module.exports = Example[Object.keys(Example)[0]];
module.exports = Example.staticFriction;
}
/***/ }),
/* 37 */
/***/ (function(module, exports, __webpack_require__) {
@ -4896,10 +5004,13 @@ Example.stress = function() {
};
};
Example.stress.for = '>=0.14.2';
if (true) {
module.exports = Example[Object.keys(Example)[0]];
module.exports = Example.stress;
}
/***/ }),
/* 38 */
/***/ (function(module, exports, __webpack_require__) {
@ -4985,10 +5096,13 @@ Example.stress2 = function() {
};
};
Example.stress2.for = '>=0.14.2';
if (true) {
module.exports = Example[Object.keys(Example)[0]];
module.exports = Example.stress2;
}
/***/ }),
/* 39 */
/***/ (function(module, exports, __webpack_require__) {
@ -5028,43 +5142,44 @@ Example.svg = function() {
Runner.run(runner, engine);
// add bodies
var svgs = [
'iconmonstr-check-mark-8-icon',
'iconmonstr-paperclip-2-icon',
'iconmonstr-puzzle-icon',
'iconmonstr-user-icon'
];
if (typeof fetch !== 'undefined') {
var select = function(root, selector) {
return Array.prototype.slice.call(root.querySelectorAll(selector));
};
if (typeof $ !== 'undefined') {
for (var i = 0; i < svgs.length; i += 1) {
(function(i) {
$.get('./svg/' + svgs[i] + '.svg').done(function(data) {
var vertexSets = [],
color = Common.choose(['#f19648', '#f5d259', '#f55a3c', '#063e7b', '#ececd1']);
var loadSvg = function(url) {
return fetch(url)
.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) {
var points = Svg.pathToVertices(path, 30);
vertexSets.push(Vertices.scale(points, 0.4, 0.4));
});
([
'./svg/iconmonstr-check-mark-8-icon.svg',
'./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']);
World.add(world, Bodies.fromVertices(100 + i * 150, 200 + i * 50, vertexSets, {
render: {
fillStyle: color,
strokeStyle: color,
lineWidth: 1
}
}, true));
});
})(i);
}
var vertexSets = select(root, 'path')
.map(function(path) { return Vertices.scale(Svg.pathToVertices(path, 30), 0.4, 0.4); });
$.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));
World.add(world, Bodies.fromVertices(100 + i * 150, 200 + i * 50, vertexSets, {
render: {
fillStyle: color,
strokeStyle: color,
lineWidth: 1
}
}, true));
});
});
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, {
render: {
@ -5074,6 +5189,8 @@ Example.svg = function() {
}
}, true));
});
} else {
Common.warn('Fetch is not available. Could not load SVG.');
}
World.add(world, [
@ -5119,10 +5236,13 @@ Example.svg = function() {
};
};
Example.svg.for = '>=0.14.2';
if (true) {
module.exports = Example[Object.keys(Example)[0]];
module.exports = Example.svg;
}
/***/ }),
/* 40 */
/***/ (function(module, exports, __webpack_require__) {
@ -5163,39 +5283,48 @@ Example.terrain = function() {
Runner.run(runner, engine);
// add bodies
var terrain;
if (typeof fetch !== 'undefined') {
var select = function(root, selector) {
return Array.prototype.slice.call(root.querySelectorAll(selector));
};
if (typeof $ !== 'undefined') {
$.get('./svg/terrain.svg').done(function(data) {
var vertexSets = [];
var loadSvg = function(url) {
return fetch(url)
.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) {
vertexSets.push(Svg.pathToVertices(path, 30));
loadSvg('./svg/terrain.svg')
.then(function(root) {
var paths = select(root, 'path');
var vertexSets = paths.map(function(path) { return Svg.pathToVertices(path, 30); });
var terrain = Bodies.fromVertices(400, 350, vertexSets, {
isStatic: true,
render: {
fillStyle: '#060a19',
strokeStyle: '#060a19',
lineWidth: 1
}
}, true);
World.add(world, terrain);
var bodyOptions = {
frictionAir: 0,
friction: 0.0001,
restitution: 0.6
};
World.add(world, Composites.stack(80, 100, 20, 20, 10, 10, function(x, y) {
if (Query.point([terrain], { x: x, y: y }).length === 0) {
return Bodies.polygon(x, y, 5, 12, bodyOptions);
}
}));
});
terrain = Bodies.fromVertices(400, 350, vertexSets, {
isStatic: true,
render: {
fillStyle: '#060a19',
strokeStyle: '#060a19',
lineWidth: 1
}
}, true);
World.add(world, terrain);
var bodyOptions = {
frictionAir: 0,
friction: 0.0001,
restitution: 0.6
};
World.add(world, Composites.stack(80, 100, 20, 20, 10, 10, function(x, y) {
if (Query.point([terrain], { x: x, y: y }).length === 0) {
return Bodies.polygon(x, y, 5, 12, bodyOptions);
}
}));
});
} else {
Common.warn('Fetch is not available. Could not load SVG.');
}
// add mouse control
@ -5234,10 +5363,13 @@ Example.terrain = function() {
};
};
Example.terrain.for = '>=0.14.2';
if (true) {
module.exports = Example[Object.keys(Example)[0]];
module.exports = Example.terrain;
}
/***/ }),
/* 41 */
/***/ (function(module, exports, __webpack_require__) {
@ -5395,10 +5527,13 @@ Example.timescale = function() {
};
};
Example.timescale.for = '>=0.14.2';
if (true) {
module.exports = Example[Object.keys(Example)[0]];
module.exports = Example.timescale;
}
/***/ }),
/* 42 */
/***/ (function(module, exports, __webpack_require__) {
@ -5587,10 +5722,13 @@ Example.views = function() {
};
};
Example.views.for = '>=0.14.2';
if (true) {
module.exports = Example[Object.keys(Example)[0]];
module.exports = Example.views;
}
/***/ }),
/* 43 */
/***/ (function(module, exports, __webpack_require__) {
@ -5690,10 +5828,13 @@ Example.wreckingBall = function() {
};
};
Example.wreckingBall.for = '>=0.14.2';
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",
"version": "0.15.0",
"version": "0.16.0",
"lockfileVersion": 1,
"requires": true,
"dependencies": {

View file

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