mirror of
https://github.com/seigler/dash-visualizer
synced 2025-07-27 09:46:09 +00:00
⚡ Balloons!
This commit is contained in:
parent
5dbf1b9dca
commit
446999743c
1 changed files with 6 additions and 5 deletions
|
@ -113,7 +113,7 @@ var App = {
|
||||||
}
|
}
|
||||||
playground.insertBefore(tx, playground.firstChild);
|
playground.insertBefore(tx, playground.firstChild);
|
||||||
*/
|
*/
|
||||||
World.add(engine.world, Bodies.circle(width / 2 + Math.random() * 10, -50, 50, { friction: 0.1 }));
|
World.add(engine.world, Bodies.circle(width / 2 + Math.random() * 10, height + 50, 50, { density: 0.00001, frictionAir: 0.08 }));
|
||||||
};
|
};
|
||||||
|
|
||||||
var onBlock = function(data) {
|
var onBlock = function(data) {
|
||||||
|
@ -184,7 +184,8 @@ var App = {
|
||||||
Bodies = Matter.Bodies;
|
Bodies = Matter.Bodies;
|
||||||
|
|
||||||
// create an engine
|
// create an engine
|
||||||
var engine = Engine.create();
|
var world = World.create({ gravity: { y: -1 } }),
|
||||||
|
engine = Engine.create({ world: world });
|
||||||
|
|
||||||
var width = playground.offsetWidth;
|
var width = playground.offsetWidth;
|
||||||
var height = playground.offsetHeight;
|
var height = playground.offsetHeight;
|
||||||
|
@ -201,9 +202,9 @@ var App = {
|
||||||
|
|
||||||
// create two boxes and a ground
|
// create two boxes and a ground
|
||||||
var edges = [
|
var edges = [
|
||||||
Bodies.rectangle(-10, height / 2, 60, height + 10, { isStatic: true }),
|
Bodies.rectangle(-60, height / 2, 60, height + 10, { isStatic: true }),
|
||||||
Bodies.rectangle(width + 10, height / 2, 60, height + 10, { isStatic: true }),
|
Bodies.rectangle(width + 60, height / 2, 60, height + 10, { isStatic: true }),
|
||||||
Bodies.rectangle(width/2, height + 10, width + 10, 60, { isStatic: true })
|
Bodies.rectangle(width/2, -30, width + 10, 60, { isStatic: true })
|
||||||
];
|
];
|
||||||
|
|
||||||
// add all of the bodies to the world
|
// add all of the bodies to the world
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue