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

26 lines
662 B
JavaScript
Raw Normal View History

2015-08-25 14:12:52 -04:00
(function() {
var World = Matter.World,
Bodies = Matter.Bodies,
Body = Matter.Body,
Composites = Matter.Composites;
Example.compoundStack = function(demo) {
var engine = demo.engine,
world = engine.world,
size = 50;
2015-08-25 14:12:52 -04:00
2015-12-23 07:45:40 -05:00
var stack = Composites.stack(100, 280, 12, 6, 0, 0, function(x, y) {
2015-08-25 14:12:52 -04:00
var partA = Bodies.rectangle(x, y, size, size / 5),
partB = Bodies.rectangle(x, y, size / 5, size, { render: partA.render });
return Body.create({
parts: [partA, partB]
});
});
World.add(world, stack);
};
2015-12-23 07:45:40 -05:00
})();