Socket
Socket
Sign inDemoInstall

carbonator

Package Overview
Dependencies
0
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    carbonator

Carbonate your web pages.


Version published
Weekly downloads
8
Maintainers
1
Install size
12.2 kB
Created
Weekly downloads
 

Readme

Source

Carbonator

Carbonate the web.

JQuery plugin based on bubblr by Mikey Hogarth.

Usage

Install the library:

npm install --save carbonator

Require the module:

require('carbonator');

JQuery should now be able to initialize carbonation on an HTML div via the carbonate function:

$('div.flat').carbonate();

A canvas element will be created and appended to the div, and will resize automatically to match its parent.

Options

The following options may be passed to the carbonate function:

optiondescriptiondefault
animationIntervalinverval between animation frame requests (ms)1000 / 24 (24 FPS)
backgroundColorbackground color of the container element'transparent'
bubbleColorcolor of the bubbles'white'
bubbleDensitynumber of bubbles to draw per pixel of canvas area0.0005
bubbleFluttermaximum range bubble may move in either direction (px/frame)0.1
bubbleGrowthFactorMinminimum bubble growth rate1 (no growth)
bubbleGrowthFactorMinpossible bubble growth rate in excess of minimum0.002
bubbleOpacityopacity of the bubbles0.7
bubbleRadiusMinminimum range of each bubble (px)1
bubbleRadiusRangepossible bubble radius in excess of minimum2
bubbleSpeedMinminimum movement speed of each bubble (px/frame)3
bubbleSpeedRangepossible bubble movement speed in excess of minimum2
hotspotDensitynumber of hotspots to generate per pixel of width0.0025
hotspotProbabilityMinminimum chance per frame for hotspot to generate bubble0.25
hotspotProbabilityMaxmaximum chance per frame for hotspot to generate bubble0.75
hotspotRespawnRatechance per frame that hotspot will be deleted and regenerated at a different location1 / (24 * 10) (about every 10 seconds)
beforeDrawfunction to call before drawing each frame (passed Canvas​Rendering​Context2D) †undefined
afterDrawfunction to call after drawing each frame (passed Canvas​Rendering​Context2D) †undefined

† callbacks are bound to the Carbonator instance; internal properties may therefore be accessed through this, but such behavior may be subject to breaking changes

You Might Not Need JQuery

While this library is designed to be used as a JQuery plugin, JQuery is not required and is not included as a dependency. Alternatively, the constructor may be accessed directly from the imported module, or through a function attached to itself:

const Carbonator = require('carbonator');

// call via constructor
new Carbonator(document.querySelector('div.flat'), options);

// call via factory method
Carbonator.carbonate(document.querySelector('div.flat'), options);

Keywords

FAQs

Last updated on 25 Sep 2019

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc