Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

JavaScript

Babel is required to process package imports. If you need a different preprocessor remove all packages first.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Behavior

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                
              
            
!

CSS

              
                body {
	margin: 0;
	background-color: #fff;
}


canvas {
	border: 1px solid black;
	width: 95%;/*98%*/
	position: absolute;
	left:0;
	right:0;
	top:0;/*8%*/
	margin:auto;
}

              
            
!

JS

              
                
//MATTER JS

// module aliases
var Engine = Matter.Engine,
    Render = Matter.Render,
    World = Matter.World,
    Bodies = Matter.Bodies,
		MouseConstraint = Matter.MouseConstraint,
		Mouse = Matter.Mouse,
		
		//Runner = Matter.Runner,
		Composites = Matter.Composites,
		Constraint = Matter.Constraint;



// create an engine
  var engine = Engine.create(),
        world = engine.world;


// create renderer
   var render = Render.create({
        element: document.body,
        engine: engine,
        options: {
            width: 1400,
            height: 800,
            background: 'white',
            showAngleIndicator: false,
            wireframes: false,
						//showVelocity: true,
						//showCollisions: true
        }
    });






// LES FORMES

var nicolas = Bodies.circle(145, 20, 145, {
                render: {
                    sprite: {
                        texture: 'https://s3-us-west-2.amazonaws.com/s.cdpn.io/265602/nicolas-fond-blanc.png'
                    }
                }
            });


var est = Bodies.circle(200, 50, 77, {
                render: {
                    sprite: {
                        texture: 'https://s3-us-west-2.amazonaws.com/s.cdpn.io/265602/est-cercle02.png'
                    }
                }
            });


var interactive = Bodies.rectangle(390, 10, 465, 118, {
                render: {
                    sprite: {
                        texture: 'https://s3-us-west-2.amazonaws.com/s.cdpn.io/265602/interactive-cercle03.png'
                    }
                }
            });


var media = Bodies.circle(656, 156, 113, {
                render: {
                    sprite: {
                        texture: 'https://s3-us-west-2.amazonaws.com/s.cdpn.io/265602/media-cercle04.png'
                    }
                }
            });


var designer = Bodies.rectangle(790, 0, 350, 148, {
                render: {
                    sprite: {
                        texture: 'https://s3-us-west-2.amazonaws.com/s.cdpn.io/265602/designer-cercle05.png'
                    }
                }
            });

var et = Bodies.circle(900, -1000, 34, {
                render: {
                    sprite: {
                        texture: 'https://s3-us-west-2.amazonaws.com/s.cdpn.io/265602/et.png'
                    }
                }
            });

var enseignant = Bodies.rectangle(890, -1800, 350, 90, {
                render: {
                    sprite: {
                        texture: 'https://s3-us-west-2.amazonaws.com/s.cdpn.io/265602/enseignant.png'
                    }
                }
            });

var hello = Bodies.rectangle(890, -9800, 171, 31, {
                render: {
                    sprite: {
                        texture: 'https://s3-us-west-2.amazonaws.com/s.cdpn.io/265602/hello-blue.png'
                    }
                }
            });




var point1 = Bodies.polygon(400, -1200, 6, 40, {
	render: {
         fillStyle: 'black',
         strokeStyle: 'white',
         lineWidth: 1
	}
});

var point2 = Bodies.polygon(600, -2500, 8, 30, {
	render: {
         fillStyle: 'black',
         strokeStyle: 'white',
         lineWidth: 1
	}
});

var point3 = Bodies.polygon(900, -3600, 3, 60, {
	render: {
         fillStyle: 'black',
         strokeStyle: 'white',
         lineWidth: 1
	}
});



/*LES MURS*/
var sol = Bodies.rectangle(700, 810, 1400, 20, { 
	isStatic: true,
	render: {
         fillStyle: 'white',
         strokeStyle: 'white',
         lineWidth: 1
	}
});


var murgauche = Bodies.rectangle(-5, 50, 10, 1400, { 
	isStatic: true,
	render: {
         fillStyle: 'white',
         strokeStyle: 'white',
         lineWidth: 1
	}
});




var murdroit = Bodies.rectangle(1400, 50, -5, 1400, { 
	isStatic: true,
	render: {
         fillStyle: 'white',
         strokeStyle: 'white',
         lineWidth: 1
	}
});


/*
var plafond = Bodies.rectangle(700, 0, 1400, 10, { 
	isStatic: true,
	render: {
         fillStyle: 'white',
         strokeStyle: 'white',
         lineWidth: 1
	}
});
*/



// add all of the bodies to the world
World.add(engine.world, [nicolas, est, interactive, media, designer, et, enseignant, hello, sol, murgauche, murdroit, point1, point2, point3]);




// run the engine
Engine.run(engine);

// run the renderer
Render.run(render);

// create runner
    //var runner = Runner.create();
    //Runner.run(runner, engine);


// add mouse control
var mouse = Mouse.create(render.canvas),
        mouseConstraint = MouseConstraint.create(engine, {
            mouse: mouse,
            constraint: {
                stiffness: 1,
                render: {
                    visible: false
                }
            }
        });


World.add(world, mouseConstraint);

// keep the mouse in sync with rendering
render.mouse = mouse;
              
            
!
999px

Console