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
No EOL
689 B
JavaScript

(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;
renderOptions.showVelocity = true;
};
})();