Skip to content

Instantly share code, notes, and snippets.

@lonekorean
Created June 10, 2018 22:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lonekorean/f411471bb0a3e31bcee1187f23c55dc0 to your computer and use it in GitHub Desktop.
Save lonekorean/f411471bb0a3e31bcee1187f23c55dc0 to your computer and use it in GitHub Desktop.
Floaty bubbles Matter.js setup
// engine
this.engine = Matter.Engine.create();
this.engine.world.gravity.y = 0;
// render
this.render = Matter.Render.create({
canvas: document.querySelector(this.options.canvasSelector),
engine: this.engine,
options: {
width: viewportWidth,
height: viewportHeight,
wireframes: false,
background: 'transparent'
}
});
Matter.Render.run(this.render);
// runner
this.runner = Matter.Runner.create();
Matter.Runner.run(this.runner, this.engine);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment