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/avalanche.js

25 lines
846 B
JavaScript
Raw Normal View History

2015-08-25 14:12:52 -04:00
(function() {
var World = Matter.World,
Bodies = Matter.Bodies,
Composites = Matter.Composites,
Common = Matter.Common;
Example.avalanche = function(demo) {
var engine = demo.engine,
world = engine.world;
2015-08-25 14:31:44 -04:00
var stack = Composites.stack(20, 20, 20, 5, 0, 0, function(x, y) {
2015-08-25 14:12:52 -04:00
return Bodies.circle(x, y, Common.random(10, 20), { friction: 0.00001, restitution: 0.5, density: 0.001 });
});
World.add(world, stack);
World.add(world, [
Bodies.rectangle(200, 150, 700, 20, { isStatic: true, angle: Math.PI * 0.06 }),
Bodies.rectangle(500, 350, 700, 20, { isStatic: true, angle: -Math.PI * 0.06 }),
Bodies.rectangle(340, 580, 700, 20, { isStatic: true, angle: Math.PI * 0.04 })
]);
};
})();