Have you ever thought on how to get the Siri wave effect on your website or mobile app?
SiriWave is a library that easily allows you to get this effect.
Download the dist file under ./dist/siriwave.min.js, or use the CDN one https://unpkg.com/siriwave/dist/siriwave.min.js and include in your web page as a script.
<script src="https://unpkg.com/siriwave/dist/siriwave.js"></script>
Create a div container and instantiate a SiriWave object
<div id="siri-container"></div>
<script>
var siriWave = new SiriWave({
container: document.getElementById('siri-container'),
width: 640,
height: 200,
});
</script>
The DOM container where the DOM canvas element will be added.
The style of the wave.
default
- Original Siri styleios9
- Style used in iOS9+
Ratio of the display to use. Calculated by default.
The speed of the animation.
The amplitude of the complete wave.
The frequency for the complete wave (how many waves).
Not available in iOS9 Style
The color of the wave, in hexadecimal form (#336699
, #FF0
)
Not available in iOS9 Style
The canvas
covers the entire width or height of the container.
Decide wether start the animation on boot.
Number of step (in pixels) used when drawed on canvas.
Lerp speed to interpolate properties.
Start the animation
Stop the animation.
Set the new value of speed (animated)
Set the new value of amplitude (animated)