Git Product home page Git Product logo

siren-wave's Introduction

Siren Wave 

This is a graphic wave animational effect library implemented by canvas.

Usage

$ npm install siren-wave --save

or

<script src="./node_modules/siren_wave/dist/siren-wave.min.js"></script>
var Siren = require('siren-wave');

var siren = new Siren({
    target: 'wave',
    height: 200,
    color: '#96ddf6',
    width: 600,
    waves: [
        // small
        {
            alpha: 0.1,
            yOffset: 40,
            speed: 0.02 * 0.4,
            angleStep: 0.0075,
            peak: 35,
            isPositive: true
        },
        // large
        {
            alpha: 0.1,
            yOffset: -20,
            speed: 0.05 * 0.4,
            angleStep: 0.0055,
            peak: 45,
            isPositive: true
        },
        // middle
        {
            alpha: 0.2,
            yOffset: 0,
            speed: 0.025 * 0.4,
            angleStep: 0.0055,
            peak: 30,
            isPositive: true
        }
    ]
});

siren.draw();

Exapmle

API

new Siren(options)

1. target

the element id.

2. width [number]

it's optional, if it does not exist, the canvas's width will be it parent's width.

3. height [number]

it's optional.

4. color [#rgb]

wave's color.

5. bgColor [#rgb]

background color.

6. waves [array]

wave

1. alpha [number]

the alpha of wave.

2. speed [number]

wave's speed.

3. angleStep [number]

wave's angle, default is 0.01.

4. peak [number]

wave's height.

5. isPositive [boolean]

wave moves from left to right or moves right to left.

siren.draw()

start wave animation.

siren.stop();

stop wave animation.

siren.update(options)

update some params.

Feedback

If you any questions, use Issues.

Sina Weibo: @miaowingz

License

MIT Licence.

siren-wave's People

Contributors

miaowing avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

zhaoyueer

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.