0.1.1 • Published 4 years ago

smokybg v0.1.1

Weekly downloads
5
License
MIT
Repository
github
Last release
4 years ago

Smokybg

This is an analog of waterpipe.js jQuery plugin, but rewritten in typescript and usable as a common npm module with types (not perfectly typed tho)

Install

npm i smokybg

Usage

<canvas id="smoky-wrapper" style="width: 100%; height: 100%;">Your browser does not support HTML5 canvas.</canvas>
import { Smoke } from 'smokybg';

const element = document.getElementById('smoky-wrapper');

const options = {
   kek: 'lol'
};

new Smoke(element, options);

Support

If anyone will use this- I will provide wider documentation for this and make a better API

Examples

Here are some examples generated using waterpipe.js plugin.

alt tag alt tag alt tag alt tag alt tag alt tag alt tag

Options

OptionTypeDefaultDescription
gradientStartstring'#000000'Gradient start color in hex format.
gradientEndstring'#222222'Gradient end color in hex format.
smokeOpacitynumber0.1Smoke opacity 0 to 1.
numCirclesint1Number of circles (smokes).
maxMaxRadint or 'auto''auto'Could be used to change circle radius size
minMaxRadint or 'auto''auto'Could be used to change circle radius size
minRadFactorint0It's a factor representing the size of the smallest radius with respect to the largest possible. Integer from 0 to 1.
iterationsint8The number of subdividing steps to take when creating a single fractal curve. Can use more, but anything over 10 (thus 1024 points) is overkill for a moderately sized canvas.
drawsPerFrameint10Number of curves to draw on every tick of the timer
lineWidthnumber2Line width
speedint1Drawing speed (tick of timer in ms)
bgColorInnerstring'#ffffff'Background outer color in hex format
bgColorOuterstring'#666666'Background inner color in hex format

Methods

MethodArgumentsDescription
generateGenerates background canvas
setOptionoptionName,Set a new value to an option. Please check the above table for possible option names and values
optionValue
downloadwidth: int,Download size in pixels
height: int

License

Licensed under MIT license

0.1.1

4 years ago

0.1.0

4 years ago

0.0.2

4 years ago

0.0.1

4 years ago