0
0
Fork 0
mirror of https://github.com/liabru/matter-js.git synced 2024-11-23 09:26:51 -05:00
liabru-matter-js/examples/newtonsCradle.js

23 lines
689 B
JavaScript
Raw Normal View History

2015-08-25 14:12:52 -04:00
(function() {
var World = Matter.World,
Body = Matter.Body,
Composites = Matter.Composites;
Example.newtonsCradle = function(demo) {
var engine = demo.engine,
world = engine.world;
var cradle = Composites.newtonsCradle(280, 100, 5, 30, 200);
World.add(world, cradle);
Body.translate(cradle.bodies[0], { x: -180, y: -100 });
cradle = Composites.newtonsCradle(280, 380, 7, 20, 140);
World.add(world, cradle);
Body.translate(cradle.bodies[0], { x: -140, y: -100 });
var renderOptions = demo.render.options;
2015-08-25 14:12:52 -04:00
renderOptions.showVelocity = true;
};
})();