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

@realitsyourman/liquid-glass

v0.2.0

Published

Realistic liquid glass refraction with chromatic aberration for the web

Downloads

91

Readme

liquid-glass

Realistic liquid glass refraction with chromatic aberration for the web. Captures actual page pixels via html2canvas, applies barrel distortion + per-channel chromatic aberration, and adds static wave turbulence via SVG filters.

Install

npm install liquid-glass html2canvas

Quick Start

<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/html2canvas.min.js"></script>
import { createLiquidGlass } from 'liquid-glass'

const glass = createLiquidGlass('.my-card', {
  background: '.bg-layer',
})

// Re-capture after layout changes
glass.refresh()

// Clean up
glass.destroy()

How It Works

  1. Captures the page behind the glass element using html2canvas
  2. Applies barrel distortion (convex lens effect) via Canvas 2D pixel manipulation
  3. Splits R/G/B channels with edge-weighted offset for chromatic aberration
  4. Applies a static SVG feTurbulence wave filter for organic glass texture
  5. Adds frost blur + dark tint overlay

Options

| Option | Type | Default | Description | |--------|------|---------|-------------| | background | string \| HTMLElement | required | Element to hide during capture | | distortion | number | 0.15 | Barrel distortion strength (0-1) | | chromatic | number | 2.5 | Chromatic aberration edge intensity (px) | | frost | number | 0.3 | Frosted blur overlay opacity (0-1) | | tint | string | 'rgba(15,15,25,0.15)' | Dark tint overlay color | | wave | number | 12 | Static wave turbulence scale. 0 to disable | | waveFrequency | [number, number] | [0.008, 0.006] | Turbulence frequency [x, y] | | glow | boolean | true | Pointer-following specular glow |

API

createLiquidGlass(target, options): LiquidGlassInstance

Returns:

  • destroy() — Remove canvas, filters, listeners
  • refresh() — Re-capture background and re-render

Browser Support

Works in all modern browsers (Chrome, Safari, Firefox, Edge). Uses html2canvas for pixel capture and Canvas 2D for distortion — no browser-specific APIs.

Peer Dependencies

  • html2canvas ^1.4.0

Navigation Bar

Use createLiquidNav to apply liquid glass + sticky/fixed positioning to a navigation element.

<nav class="my-nav">
  <a href="#">About</a>
  <a href="#">Work</a>
  <a href="#">Studio</a>
  <a href="#">Contact</a>
</nav>
import { createLiquidNav } from 'liquid-glass'

const nav = createLiquidNav('.my-nav', {
  position: 'sticky',
  top: 16,
  gap: 24,
})

nav.refresh()
nav.destroy()

Nav Options

| Option | Type | Default | Description | |--------|------|---------|-------------| | position | 'sticky' \| 'fixed' \| 'static' | 'sticky' | Positioning strategy | | top | number | 0 | Distance from top (px) | | gap | number | 24 | Space between items (px) | | padding | string | '12px 20px' | Inner padding | | recaptureOnScroll | boolean | true if sticky/fixed | Re-capture background during scroll | | wave / waveFrequency | — | — | Same as createLiquidGlass |

Returns the same LiquidGlassInstance with destroy() and refresh().

License

MIT