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

soyorin-fluid

v0.1.1

Published

A lightweight WebGL water ripple effect library.

Readme

Soyorin Fluid

一个基于 WebGL 的轻量水波纹效果库,适合叠加在页面背景、封面、交互层或 Vue 组件中使用。

安装

npm install soyorin-fluid

基础用法

import { createWaterRipple } from 'soyorin-fluid'

const canvas = document.querySelector<HTMLCanvasElement>('#water-canvas')

if (canvas) {
  const waterRipple = createWaterRipple(canvas)

  // 不再使用时释放动画、事件和 WebGL 资源
  waterRipple?.destroy()
}

页面中需要准备一个 canvas

<canvas id="water-canvas"></canvas>

建议让 canvas 覆盖目标区域:

#water-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

Vue 3 中使用

<script setup lang="ts">
import { onBeforeUnmount, onMounted, ref } from 'vue'
import { createWaterRipple, type WaterRippleEffect } from 'soyorin-fluid'

const canvasRef = ref<HTMLCanvasElement | null>(null)
let waterRipple: WaterRippleEffect | null = null

onMounted(() => {
  if (!canvasRef.value) return
  waterRipple = createWaterRipple(canvasRef.value)
})

onBeforeUnmount(() => {
  waterRipple?.destroy()
})
</script>

<template>
  <canvas ref="canvasRef"></canvas>
</template>

配置项

createWaterRipple(canvas, {
  light: 1,
  moveRipple: 0.6,
  clickRipple: 0.3,
  maxDevicePixelRatio: 2,
  gridWidth: 160,
})

| 参数 | 类型 | 默认值 | 说明 | | --- | --- | --- | --- | | light | number | 1 | 水波高光强度 | | moveRipple | number | 0.6 | 指针移动产生的水波强度 | | clickRipple | number | 0.3 | 点击产生的水波强度 | | maxDevicePixelRatio | number | 2 | 最大设备像素比,限制高清屏性能消耗 | | gridWidth | number | 160 | 模拟网格宽度,越大越细腻但性能消耗越高 |

API

createWaterRipple(canvas, options?)

创建水波纹效果实例。

返回值:WaterRippleEffect | null

  • 当浏览器不支持 WebGL 时返回 null
  • 成功时返回实例对象

WaterRippleEffect

interface WaterRippleEffect {
  resize: () => void
  destroy: () => void
}
  • resize():手动重新计算画布尺寸
  • destroy():销毁动画、事件监听和 WebGL 资源

发布到 npm

发布前先确认 package.json 中的 name 没有被占用,并按需修改 version

npm login
npm run build
npm publish --access public

如果只是检查最终会发布哪些文件,可以先运行:

npm pack --dry-run