mirror of
https://github.com/liabru/matter-js.git
synced 2024-11-24 09:36:48 -05:00
27 lines
804 B
JavaScript
27 lines
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 })
|
||
|
]);
|
||
|
};
|
||
|
|
||
|
})();
|