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

animated-lyrics

v1.1.0

Published

Draw animated lyrics into video, to support pictureInPicture

Readme

Animated Lyrics

以“画中画”(Picture-In-Picture)的形式展示歌词动画。 Show lyrics animation In picture-in-picture view.

使用方式 Usage

<!-- umd -->
<script src="index.min.js"></script>
<script>
  new AnimatedLyrics()
</script>

or:

const anime = new AnimatedLyrics(config)
// 在开始播放/更换曲目时调用 update()
// call update() when start playing or changing current playing songs or lyrics
// 会在传入音频元素上重新绑定相应事件
// update() will attach/detach event listeners to video element automatically
anime.update(document.getElementById('video'), lyrics, {
  title,
  artist,
})
// 在更新动画设置时调用 updateConfig(),会用新的配置重新绘制动画
// call updateConfig() when you want to reset animation config, canvas will be rerendered
anime.updateConfig({
  activeTextStyle: {
    size: 32, // font-size
    stroke: '#000', // strokeColor
    opacity: 1,
    scale: 1,
    fill: '#fff',
    trokeWidth: 1,
  },
})
// 开启画中画
// request pictureInPicture
anime.requestPictureInPicture()
// 不再需要播放时调用,会取消事件绑定和移除隐藏的 video 元素
// call close() when you don't need to display the animation anymore (e.g. page unmounted), this call will detach event listeners and remove hidden video element
anime.close()

实现方式

  1. 在播放时间更新时实时绘制歌词到 canvas 上。
  2. 通过 videoEl.srcObject = canvasEl.captureStream() 将绘制结果输出到 video 尚
  3. videoEl.requestPictureInPicture()

已知问题

  • 尚未对一行显示不下的歌词需要换行的情况进行处理,不支持双语歌词。
  • 因为用三方库实现 canvas 动画,所以包体积比较大