2015-08-25 14:12:52 -04:00
|
|
|
(function() {
|
|
|
|
|
|
|
|
var World = Matter.World,
|
|
|
|
Bodies = Matter.Bodies,
|
|
|
|
Composites = Matter.Composites,
|
|
|
|
Common = Matter.Common;
|
|
|
|
|
|
|
|
Example.ballPool = function(demo) {
|
|
|
|
var engine = demo.engine,
|
|
|
|
world = engine.world;
|
|
|
|
|
2015-08-25 14:31:44 -04:00
|
|
|
var stack = Composites.stack(100, 50, 10, 15, 10, 10, function(x, y) {
|
2015-08-25 14:12:52 -04:00
|
|
|
return Bodies.circle(x, y, Common.random(15, 30), { restitution: 0.6, friction: 0.1 });
|
|
|
|
});
|
|
|
|
|
|
|
|
World.add(world, [
|
|
|
|
stack,
|
|
|
|
Bodies.polygon(200, 560, 3, 60),
|
|
|
|
Bodies.polygon(400, 560, 5, 60),
|
|
|
|
Bodies.rectangle(600, 560, 80, 80)
|
|
|
|
]);
|
|
|
|
};
|
|
|
|
|
|
|
|
})();
|