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

rain-ripple

v1.0.0

Published

Canvas-based realistic rain and water-ripple animation for the web.

Readme

rain-ripple

A dependency-free, canvas-based realistic rain animation with water ripples, splashes, wind drift and occasional lightning — perfect as a page background or inside a card/hero section.

rain-ripple

Install

npm install rain-ripple

Usage

Full-page background (simplest)

import { RainRipple } from "rain-ripple";

// No target = attaches a fixed, full-viewport canvas behind your content
new RainRipple();

Inside a specific element, with text on top

The canvas is automatically absolutely-positioned to fill its container, sits behind whatever else is already in there, and ignores clicks — so your copy stays visible and interactive on top of it. You don't need to set position: relative on the container yourself; the library does it for you if it's still static.

<section id="hero" style="height: 480px;">
  <h1>Built for stormy nights</h1>
  <button>Get started</button>
</section>
import { RainRipple } from "rain-ripple";

new RainRipple("#hero");

With options

import { RainRipple } from "rain-ripple";

const rain = new RainRipple("#hero", {
  rainCount: 220,      // number of drops on screen
  wind: -1.4,           // horizontal drift (negative = slants left)
  groundTop: 0.65,      // horizon line, 0–1 fraction of height
  rainColor: [185, 215, 240],
  rippleColor: [175, 215, 240],
  background: true,     // paint the built-in dark sky/ground gradient
  lightning: true,       // occasional lightning flashes
  autoStart: true,
});

// Pause / resume
rain.stop();
rain.start();

// Change settings live
rain.setOptions({ rainCount: 400 });

// Clean up (removes listeners and the canvas it created)
rain.destroy();

CommonJS

const { RainRipple } = require("rain-ripple");
new RainRipple();

Directly on a <canvas>

<canvas id="rain" style="width: 100%; height: 100%;"></canvas>
new RainRipple(document.getElementById("rain"));

Intensity presets

rainCount (and to a lesser extent maxParticles) is what controls how heavy the rain feels. A few starting points for a background effect:

// Light, relaxed drizzle — good behind readable text
new RainRipple("#hero", { rainCount: 90, maxParticles: 300 });

// Default, moderate rain
new RainRipple("#hero"); // rainCount: 150

// Heavy storm
new RainRipple("#hero", { rainCount: 320, maxParticles: 700, lightning: true });

Options

| Option | Type | Default | Description | | -------------- | ------------------------ | ----------------------- | -------------------------------------------------- | | rainCount | number | 150 | Drops on screen at once | | wind | number | -1.0 | Horizontal drift | | groundTop | number (0–1) | 0.62 | Horizon line as a fraction of canvas height | | maxRipples | number | 220 | Cap on concurrent ripples | | maxParticles | number | 600 | Cap on concurrent splash/droplet particles | | rainColor | [r, g, b] | [185, 215, 240] | Raindrop color | | rippleColor | [r, g, b] | [175, 215, 240] | Ripple color | | background | boolean | true | Paint the built-in dark sky/ground gradient | | lightning | boolean | true | Occasional lightning flashes | | autoStart | boolean | true | Start animating immediately | | zIndex | number | -1 | z-index used only when auto-attached to <body> |

API

  • new RainRipple(target?, options?) — target is a CSS selector, an HTMLElement to fill, an existing <canvas>, or omitted to attach a full-viewport background canvas to <body>.
  • .start() — start/resume the animation.
  • .stop() — pause without tearing anything down.
  • .resize() — recalculate canvas size (call if you resize its container manually without a window resize event).
  • .setOptions(partial) — merge new options at runtime; re-seeds drops if rainCount changes.
  • .destroy() — stop, remove listeners, and remove the canvas if this instance created one.

License

MIT