npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

vue-wavify

v1.2.2

Published

🌊 Animated wave component for Vue (using svg)

Downloads

12

Readme

Vue Wavify

build npm npm img

A single Vue component to create and adjust an animated wave using svg & javascript.

Installation

Yarn

yarn add vue-wavify

npm

npm install vue-wavify

Usage

The package can be imported globally or locally.

Locally (single file component)

<template>
  <div class="wave-container">
    <vue-wavify fill="#f79902"/>
  </div>
</template>

<script>
import VueWavify from 'vue-wavify';

export default {
  components: { VueWavify }
});
</script>

Globally

import Vue from 'vue';
import VueWavify from 'vue-wavify';

Vue.use(VueWavify);
// Or
Vue.component('vue-wavify', VueWavify);

Props

In order the configure the wave, the following props can be applied:

| prop | default | type | description | | ----------- |:-------:|:---------:|:----------- | | paused | false | Boolean | Pauses the animation | | points | 3 | Number | Amount of points used to form the wave | | speed | 0.15 | Number | Speed that the wave animation plays at | | height | 20 | Number | Height of the wave relative to the SVG element | | amplitude | 20 | Number | Amplitude of the rendered wave | | fill | blue | String | Color of the wave (can be anything that a SVG path accepts) |

Note: Props that are not mentiond above will be passed on to the path element (instead of the container). Except for id & style attribute, these will be added to the container.

Configuring the SVG

It is possible to configure and style the svg more precisely by using the default slot. This can be any HTML a SVG accepts. For example a <defs> component to add gradients, clipping paths, or masks.

Examples

Below are some examples on how to implement the slot for configuring the svg/path.

Note: The framerate of the gifs are limited to 25, the actual animation is smooth.

Gradient

<template>
  <vue-wavify fill="url(#gradient)">
    <defs>
      <linearGradient id="gradient">
        <stop offset="0%" style="stop-color:rgb(255,255,0);" />
        <stop offset="100%" style="stop-color:rgb(255,0,0);" />
      </linearGradient>
    </defs>
  </vue-wavify>
</template>

Result:

gradient wave

Clipping path (mask)

<template>
  <vue-wavify fill="#e62315" mask="url(#mask)" :points="20" :amplitude="25" :speed="0.2" :height="20">
      <defs>
        <mask id="mask">
          <path d="M10,35 A20,20,0,0,1,50,35 A20,20,0,0,1,90,35 Q90,65,50,95 Q10,65,10,35 Z" fill="white" />
        </mask>
      </defs>
    </vue-wavify>
</template>

Result:

gradient wave

Gradient

<template>
  <vue-wavify mask="url(#mask2)" fill="#1277b0" >
    <defs>
      <linearGradient id="grad" gradientTransform="rotate(90)">
        <stop offset="0" style="stop-color:white;" />
        <stop offset="0.5" style="stop-color:black;" />
      </linearGradient>
      <mask id="mask2">
        <rect x="0" y="0" width="800" height="200" fill="url(#grad)"/>
      </mask>
    </defs>
  </vue-wavify>
</template>

Result:

gradient wave

Styling the container

In order for the svg to take up full-width there is a container surrounding the svg with a class of .vue-wavify-wave. By standard its styling is set to width: 100%; display: inline-block;. The svg animating the wave is set to a width & height of 100%. Therefore, it is advised to manipulate the height and width by using the css class of the container.

Credits

This component/package is mainly based on the react-wavify package and can be seen as a simple port from react to vue, implementing functionalities similar to that of Benjamin Grauwin's Wavify plug-in.