Last active
June 10, 2018 22:36
-
-
Save lonekorean/162c97620819a97365f9c32275cc56b8 to your computer and use it in GitHub Desktop.
Floaty bubbles prototype object
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
let floatyBubbles = { | |
// customizable options (passed into init function) | |
options: { | |
canvasSelector: '', // to find <canvas> in DOM to draw on | |
radiusRange: [50, 100], // random range of body radii | |
xVarianceRange: [-0.5, 0.5], // random range of x velocity scaling on bodies | |
yVarianceRange: [0.5, 1.5], // random range of y velocity scaling on bodies | |
airFriction: 0.03, // air friction of bodies | |
opacity: 1, // opacity of bodies | |
collisions: true, // do bodies collide or pass through | |
scrollVelocity: 0.025, // scaling of scroll delta to velocity applied to bodies | |
pixelsPerBody: 50000, // viewport pixels required for each body added | |
// colors to cycle through to fill bodies | |
colors: ['#e4e4cc', '#e1d2c4', '#d1e4df'] | |
}, | |
// more properties... | |
init(options) { | |
// override default options with incoming options | |
this.options = Object.assign({}, this.options, options); | |
// more code to start things up... | |
}, | |
// more methods... | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment