2015-08-25 14:12:52 -04:00
|
|
|
(function() {
|
|
|
|
|
2015-08-25 14:31:44 -04:00
|
|
|
var World = Matter.World,
|
2015-08-25 14:12:52 -04:00
|
|
|
Bodies = Matter.Bodies,
|
|
|
|
Composites = Matter.Composites,
|
|
|
|
Common = Matter.Common,
|
|
|
|
Vertices = Matter.Vertices;
|
|
|
|
|
|
|
|
Example.concave = function(demo) {
|
|
|
|
var engine = demo.engine,
|
|
|
|
world = engine.world;
|
|
|
|
|
|
|
|
var arrow = Vertices.fromPath('40 0 40 20 100 20 100 80 40 80 40 100 0 50'),
|
|
|
|
chevron = Vertices.fromPath('100 0 75 50 100 100 25 100 0 50 25 0'),
|
|
|
|
star = Vertices.fromPath('50 0 63 38 100 38 69 59 82 100 50 75 18 100 31 59 0 38 37 38'),
|
|
|
|
horseShoe = Vertices.fromPath('35 7 19 17 14 38 14 58 25 79 45 85 65 84 65 66 46 67 34 59 30 44 33 29 45 23 66 23 66 7 53 7');
|
|
|
|
|
2015-08-25 14:31:44 -04:00
|
|
|
var stack = Composites.stack(50, 50, 6, 4, 10, 10, function(x, y) {
|
2015-08-25 14:12:52 -04:00
|
|
|
var color = Common.choose(['#556270', '#4ECDC4', '#C7F464', '#FF6B6B', '#C44D58']);
|
|
|
|
return Bodies.fromVertices(x, y, Common.choose([arrow, chevron, star, horseShoe]), {
|
|
|
|
render: {
|
|
|
|
fillStyle: color,
|
|
|
|
strokeStyle: color
|
|
|
|
}
|
|
|
|
}, true);
|
|
|
|
});
|
|
|
|
|
|
|
|
World.add(world, stack);
|
|
|
|
|
|
|
|
var renderOptions = engine.render.options;
|
|
|
|
renderOptions.showAngleIndicator = false;
|
|
|
|
};
|
|
|
|
|
|
|
|
})();
|