0
0
Fork 0
mirror of https://github.com/liabru/matter-js.git synced 2024-11-30 10:20:52 -05:00
liabru-matter-js/examples/cloth.js
2015-08-25 19:12:52 +01:00

27 lines
No EOL
804 B
JavaScript

(function() {
var World = Matter.World,
Bodies = Matter.Bodies,
Body = Matter.Body,
Composites = Matter.Composites;
Example.cloth = function(demo) {
var engine = demo.engine,
world = engine.world;
var group = Body.nextGroup(true),
particleOptions = { friction: 0.00001, collisionFilter: { group: group }, render: { visible: false }},
cloth = Composites.softBody(200, 200, 20, 12, 5, 5, false, 8, particleOptions);
for (var i = 0; i < 20; i++) {
cloth.bodies[i].isStatic = true;
}
World.add(world, [
cloth,
Bodies.circle(300, 500, 80, { isStatic: true }),
Bodies.rectangle(500, 480, 80, 80, { isStatic: true })
]);
};
})();