mirror of
https://github.com/liabru/matter-js.git
synced 2024-11-30 10:20:52 -05:00
25 lines
No EOL
669 B
JavaScript
25 lines
No EOL
669 B
JavaScript
(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;
|
|
var size = 50;
|
|
|
|
var stack = Composites.stack(100, 220, 12, 6, 0, 0, function(x, y) {
|
|
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);
|
|
};
|
|
|
|
})(); |