mirror of
https://github.com/liabru/matter-js.git
synced 2024-12-29 14:19:01 -05:00
23 lines
No EOL
689 B
JavaScript
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;
|
|
};
|
|
|
|
})(); |