The very easy, performance and flexible to use JavaScript/TypeScript library for creating a ripple effect.
npm install @chaocore/ripplebash
npm i @chaocore/ripple
`
Using yarn:
`bash
yarn add @chaocore/ripple
`
Using pnpm:
`bash
pnpm add @chaocore/ripple
`
Using CDN:
`html
`
or
`html
`
$3
- - -
React
`jsx
import { useRipple } from "@chaocore/ripple";
function MyComponent() {
const ripple = useRipple(options);
return
}
`
Native js
`js
const btn = document.querySelector(".btn");
btn.addEventListener("pointerdown", (event) => {
createRippleEffect(event, btn, options) // or window.createRippleEffect
})
`
$3
| Name | Default | Type |
|----------------------|:----------------:|-----------|
| color | "currentColor" | string |
| easing | "ease-out" | string |
| duration | 400ms | number |
| dissolveDuration | 300ms | number |
| delay | 75ms | number |
| initialOpacity | 0.2 | number |
| finalOpacity | 0.1 | number |
| considerDisabledAttr | true | boolean |
| turnOff | false | boolean` |