This is a graphic wave animational effect library implemented by canvas.
$ 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();
the element id.
it's optional, if it does not exist, the canvas's width will be it parent's width.
it's optional.
wave's color.
background color.
the alpha of wave.
wave's speed.
wave's angle, default is 0.01.
wave's height.
wave moves from left to right or moves right to left.
start wave animation.
stop wave animation.
update some params.
If you any questions, use Issues.
Sina Weibo: @miaowingz
MIT Licence.