Created
June 10, 2018 22:39
-
-
Save lonekorean/f411471bb0a3e31bcee1187f23c55dc0 to your computer and use it in GitHub Desktop.
Floaty bubbles Matter.js setup
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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