mirror of
https://github.com/liabru/matter-js.git
synced 2024-12-27 13:59:01 -05:00
31 lines
No EOL
856 B
JavaScript
31 lines
No EOL
856 B
JavaScript
var _isBrowser = typeof window !== 'undefined' && window.location,
|
|
Matter = _isBrowser ? window.Matter : require('../../build/matter-dev.js');
|
|
|
|
var Example = {};
|
|
Matter.Example = Example;
|
|
|
|
if (!_isBrowser) {
|
|
module.exports = Example;
|
|
}
|
|
|
|
(function() {
|
|
|
|
var World = Matter.World,
|
|
Bodies = Matter.Bodies;
|
|
|
|
Example.airFriction = function(demo) {
|
|
var engine = demo.engine,
|
|
world = engine.world;
|
|
|
|
World.add(world, [
|
|
Bodies.rectangle(200, 100, 60, 60, { frictionAir: 0.001 }),
|
|
Bodies.rectangle(400, 100, 60, 60, { frictionAir: 0.05 }),
|
|
Bodies.rectangle(600, 100, 60, 60, { frictionAir: 0.1 })
|
|
]);
|
|
|
|
var renderOptions = engine.render.options;
|
|
renderOptions.showAngleIndicator = false;
|
|
renderOptions.showVelocity = true;
|
|
};
|
|
|
|
})(); |