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 🙏

© 2026 – Pkg Stats / Ryan Hefner

ripple-text

v0.2.0

Published

Physics-driven text effect with pluggable field and ripple algorithms

Readme

ripple-text

Physics-driven text animation engine. Characters react to mouse and touch interactions through expanding ripple waves and continuous field effects like water caustics.

Demo & homepage

Install

npm install ripple-text

Usage

import {
  RippleTextEngine,
  WaterField,
  WaveRipple,
  layoutText,
} from "ripple-text";

const canvas = document.getElementById("canvas") as HTMLCanvasElement;
const ctx = canvas.getContext("2d")!;

const field = new WaterField();
const ripple = new WaveRipple();

const engine = new RippleTextEngine(canvas, field, ripple, {
  bgColor: "#020814",
});

const letters = layoutText(ctx, "Hello world", { fontSize: 24, margin: 40 });
engine.setLetters(letters);
engine.start();

Tuning settings at runtime

engine.updateSettings({
  gradientForce: 25000,
  springForce: 5,
  damping: 0.92,
  maxDisplacement: 150,
});

Custom colors

const engine = new RippleTextEngine(canvas, field, ripple, {
  colorBuckets: 10,
  buildColors(n) {
    return Array.from({ length: n }, (_, i) => {
      const t = i / (n - 1);
      return `rgba(${100 + t * 155}, ${180 + t * 75}, 255, ${0.8 + t * 0.2})`;
    });
  },
});

Extracting text from the DOM

import { extractTextFromDOM } from "ripple-text";

const letters = extractTextFromDOM(document.body, 5000);
engine.setLetters(letters);

API

RippleTextEngine(canvas, field, ripple, settings?)

Main class. Handles physics simulation, rendering, and pointer interaction.

  • setLetters(letters) — set the characters to animate
  • updateSettings(patch) — update physics/rendering settings live
  • resize(w, h) — call on window resize
  • start() — begin the animation loop and attach event listeners
  • stop() — stop the loop and remove listeners

layoutText(ctx, text, options)

Lays out plain text on a canvas with word wrapping. Returns an array of letter positions.

Options: fontSize, margin, lineHeight, font.

extractTextFromDOM(root, maxChars?)

Walks the DOM tree and extracts visible characters with their screen positions and computed fonts.

WaterField / WaveRipple

Built-in implementations of the FieldEffect and RippleSource interfaces. Provide your own to create custom effects.

Settings

| Setting | Default | Description | | ----------------- | ----------- | ----------------------------------------------- | | gradientForce | 18000 | How strongly field gradients push letters | | springForce | 3.0 | Restoration force toward original position | | darkSpringBoost | 8.0 | Extra spring force in dark field regions | | damping | 0.88 | Velocity damping per frame | | maxDisplacement | 120 | Max pixel distance from origin | | fieldScale | 3 | Field simulation downscale factor | | rippleInterval | 90 | Milliseconds between ripples while pointer held | | colorBuckets | 10 | Number of displacement-based color steps | | bgColor | "#020814" | Canvas background color | | showFps | false | Show FPS counter |

License

MIT