@foobar404/wave

中文文档
2.0.5发布于 2023/12/19MITTypeScriptCommonJS零依赖近 30 天下载 3.1万

Audio visualizer library for javascript.

原始使用文档

Wave.js

Audio visualizer library for javascript.

Installation

Install With CDN

<script src="https://cdn.jsdelivr.net/gh/foobar404/wave.js/dist/bundle.js"></script>

Or NPM

npm i @foobar404/wave

Setup

If your using NPM:

import {Wave} from "@foobar404/wave";

Usage

let audioElement = document.querySelector("#audioElmId");
let canvasElement = document.querySelector("#canvasElmId");
let wave = new Wave(audioElement, canvasElement);

// Simple example: add an animation
wave.addAnimation(new wave.animations.Wave());

// Intermediate example: add an animation with options
wave.addAnimation(new wave.animations.Wave({
    lineWidth: 10,
    lineColor: "red",
    count: 20
}));

// Expert example: add multiple animations with options
wave.addAnimation(new wave.animations.Square({
    count: 50,
    diamater: 300
}));

wave.addAnimation(new wave.animations.Glob({
    fillColor: {gradient: ["red","blue","green"], rotate: 45},
    lineWidth: 10,
    lineColor: "#fff"
}));

// The animations will start playing when the provided audio element is played

// 'wave.animations' is an object with all possible animations on it.

// Each animation is a class, so you have to new-up each animation when passed to 'addAnimation'

Contributing

Get involved! Check out the Contributing Guide for how to get started.

License

MIT

版本与发布记录

@foobar404/wave 共发布 23 个版本,首次发布于 2020/06/23;过去 12 个月发布了 0 个版本。

版本发布日期距今
2.0.5latest2023/12/192 年前
2.0.42022/12/183 年前
2.0.32022/03/294 年前
2.0.22022/03/294 年前
2.0.12022/03/264 年前
2.0.02022/03/184 年前

其他发布通道:beta → 2.0.0-beta.3。

关于 @foobar404/wave 的常见问题

@foobar404/wave 是什么?

Audio visualizer library for javascript.

如何安装 @foobar404/wave?

在项目目录运行 npm install @foobar404/wave,或使用 pnpm add / yarn add / bun add。

@foobar404/wave 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@foobar404/wave 支持 ESM 还是 CommonJS?

以 CommonJS 形式发布,可以直接 require();在 ES Module 项目中也可以用 import 引入(Node.js 会把 module.exports 作为默认导出)。

@foobar404/wave 可以商用吗?

@foobar404/wave 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@foobar404/wave 的下载量有多少?

根据 npm 官方下载统计,@foobar404/wave 在 2026/10/16 – 2026/11/14 这 30 天内被下载 31,483 次,日均约 1,049 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@foobar404/wave 还在维护吗?

最新版本 2.0.5 发布于 2023/12/19(2 年前);至今共发布 23 个版本,其中过去 12 个月发布了 0 个;首次发布于 2020/06/23。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。