@phucbm/ripple-effect
v1.0.0
Published
A TypeScript utility for applying a ripple effect to a set of elements.
Maintainers
Readme
ripple-effect
Applies a ripple effect that distributes normalized values [0; 1] from a center point. Useful for animations or visual emphasis.
Installation
npm i @phucbm/ripple-effectpnpm add @phucbm/ripple-effectUsage
import {applyRippleEffect} from '@phucbm/ripple-effect';
const elements = document.querySelectorAll('.item');
applyRippleEffect({
length: elements.length,
centerIndex: 5,
rippleRadius: 3,
callback: (normalizedValue, index) => {
const scale = 1 + normalizedValue; // [1.0 - 2.0]
elements[index].style.transform = `scale(${scale})`;
}
});
Development
# Install dependencies
pnpm install
# Run tests
pnpm test
# Build the package
pnpm run build
# Run tests in watch mode
pnpm run test:watchLicense
MIT © phucbm
