Coder Social home page Coder Social logo

kendall-p-taylor / waterpipe.js Goto Github PK

View Code? Open in Web Editor NEW

This project forked from dragdropsite/waterpipe.js

0.0 0.0 0.0 1.04 MB

waterpipe.js is a jQuery plugin for smoky backgrounds generation (HTML5 Canvas)

Home Page: http://dragdropsite.github.io/waterpipe.js

License: MIT License

JavaScript 66.44% CSS 25.96% HTML 7.60%

waterpipe.js's Introduction

waterpipe.js - smoky backgrounds generator (HTML5 Canvas)

waterpipe.js is a jQuery plugin for smoky backgrounds developed by dragdropsite.com

alt tag

Examples

Here are some examples generated using waterpipe.js plugin.

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

Usage

1. Include jQuery and waterpipe.js

<script src="lib/jquery-1.11.0.min.js"></script>
<script src="waterpipe.js"></script>

2. Create wrapper with canvas element inside

<div id="wavybg-wrapper" style="width: 100%; height: 100%;"> 
    <canvas>Your browser does not support HTML5 canvas.</canvas>
</div>

3. Initialize with

var smokyBG = $('#wavybg-wrapper').waterpipe({
    //Default values
    gradientStart: '#000000',
    gradientEnd: '#222222',
    smokeOpacity: 0.1,
    numCircles: 1,
    maxMaxRad: 'auto',
    minMaxRad: 'auto',
    minRadFactor: 0,
    iterations: 8,
    drawsPerFrame: 10,
    lineWidth: 2,
    speed: 1,
    bgColorInner: "#ffffff",
    bgColorOuter: "#666666"
});

Options

Option Type Default Description
gradientStart string '#000000' Gradient start color in hex format.
gradientEnd string '#222222' Gradient end color in hex format.
smokeOpacity number 0.1 Smoke opacity 0 to 1.
numCircles int 1 Number of circles (smokes).
maxMaxRad int or 'auto' 'auto' Could be used to change circle radius size
minMaxRad int or 'auto' 'auto' Could be used to change circle radius size
minRadFactor int 0 It's a factor representing the size of the smallest radius with respect to the largest possible. Integer from 0 to 1.
iterations int 8 The 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.
drawsPerFrame int 10 Number of curves to draw on every tick of the timer
lineWidth number 2 Line width
speed int 1 Drawing speed (tick of timer in ms)
bgColorInner string '#ffffff' Background outer color in hex format
bgColorOuter string '#666666' Background inner color in hex format

Methods

The following code could be used to call a method: smokyBG.data('waterpipe').generate();Please make sure variable smokyBG exists

Method Arguments Description
generate Generates background canvas
setOption optionName, Set a new value to an option. Please check the above table for possible option names and values
optionValue
download width: int, Download size in pixels
height: int

Demo

Please check the demo to generate and download your own smoky backgrounds: http://dragdropsite.github.io/waterpipe.js

Credits

rectangleworld.com - big part of code has been taken from the examples provided on this blog

License

Licensed under MIT license

waterpipe.js's People

Contributors

bryant1410 avatar aslauris avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.