var Engine=Matter.Engine,
Render=Matter.Render,
World=Matter.World,
Mouse=Matter.Mouse,
MouseConstraint=Matter.MouseConstraint,
Composites=Matter.Composites,
Bodies=Matter.Bodies;
var engine=Engine.create(),
world=engine.world;
var vwidth = window.innerWidth,
vheight = window.innerHeight
var render=Render.create({
engine:engine,
element:document.body,
options:{
width:vwidth,
height:vheight,
wireframes:false
}
});
Engine.run(engine);
Render.run(render);
var rectA=Bodies.rectangle(100,20,200,40,{
render:{
fillStyle:"#f0c"
}
});
var ground=Bodies.rectangle(vwidth/2,
vheight-10,vwidth,20,{
isStatic:true,
render:{
fillStyle:"#9fa"
}
});
var stack_rect=Composites.stack(300,100,4,3,0,0,function(x,y){
return Bodies.rectangle(x,y,150,40);
});
// var stack_circle=Composites.stack(600,100,5,5,2,3,function (x,y) {
// return Bodies.circle(x,y,30);
// });
var wall1 = Bodies.rectangle(0, 0, vwidth*2, 10, { isStatic: true });
var wall2 = Bodies.rectangle(0, 0, 10, vheight*2, { isStatic: true });
var wall3 = Bodies.rectangle(0, vheight*2, vwidth*2, 10, { isStatic: true });
var wall4 = Bodies.rectangle(vwidth*2, 0, 10, vheight*2, { isStatic: true });
var mouseConstraint=MouseConstraint.create(engine,{});
World.add(world,[rectA,ground,stack_rect,mouseConstraint,wall1,wall2,wall3,wall4]);
console