0
0
Fork 0
mirror of https://github.com/liabru/matter-js.git synced 2024-11-27 09:50:52 -05:00
liabru-matter-js/examples/airFriction.js

31 lines
856 B
JavaScript
Raw Normal View History

2015-08-25 14:12:52 -04:00
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;
};
})();