descent-ripple

A ripple animation overlay for buttons. Uses svg and is build with Svelte

Usage no npm install needed!

<script type="module">
  import descentRipple from 'https://cdn.skypack.dev/descent-ripple';
</script>

README

Descent-Ripple

A highly customizable javascrip ripple animation for buttons. Made with Svelte, but easily usable with other frameworks.

Examples and usage

Getting started

Install the package from npm:

npm install descent-ripple

In Svelte you can easily use actions:

// MyButton.tsx
import React from 'react';
import ripple from 'descent-ripple';

export const MyButton = ()=>{
    const buttonRef = React.useRef<Node>(null);
     React.useEffect(()=>{
        if (buttonRef.current){
            let rippleOptions={};
            const buttonRipple = ripple(buttonRef.current,rippleOptions);
            return buttonRipple.destroy;
            
        }
    },[]);
    return (
        <button ref={buttonRef}>click me</button>
    )
}

For other frameworks see this blog post.