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

@axt_ayakoto/html-number-countup

v0.2.0

Published

「カウントアップする数値テキストのHTML要素」を作るためのアニメーションライブラリ

Readme

html-number-countup

HTML要素に対して、初めて画面に表示されたときに0からその数値までカウントアップするアニメーションを付与します。

Usage

JavaScriptモジュールのインポート

静的HTMLファイルでは、例えば以下のようにJavaScriptモジュールをインポートします。

<script type="module">
  import { init } from '@axt_ayakoto/html-number-countup';
  // ここにコードを記述
</script>

また、npmなどのパッケージマネージャーを使用している場合は、以下のようにインポートが可能です。

import { init } from '@axt_ayakoto/html-number-countup';

CSSのインポート

(現時点でCSSは特に必要ありません。)

簡易利用: クラス・data属性による使用

HTML要素に対して、以下のようにCSSクラス名とdata-html-number-countup属性を指定します。

<span class="html-number-countup" data-html-number-countup='{"duration":2000,"start":100,"end":1000,"separator":",","decimalDigits":2}'></span>

これにより、ページ読み込み時に自動的にカウントアップアニメーションが予約されます。

なお、data-html-number-countup属性には、以下のオプションをJSON形式で指定できます。

  • duration: アニメーションの継続時間をミリ秒単位で指定します。
    • 省略可能で、デフォルトは1000(1秒)です。
  • start: カウントアップを開始する数値を指定します。
    • 省略可能で、デフォルトは0です。
  • end: カウントアップを終了する数値を指定します。
    • 省略はできません。
  • separator: 数値を3桁ごとに区切るための文字列を指定します。
    • 省略可能で、デフォルトは""(区切りなし)です。
  • decimalDigits: 小数点以下の桁数を指定します。
    • 省略可能で、デフォルトは0です。
    • 0のときは整数として、1以上のときはその桁数まで小数点以下を表示する形でカウントアップします。

カスタム利用: init()関数による使用

init()関数を使用して、任意のHTML要素に対してカウントアップアニメーションを予約することもできます。

import { init } from '@axt_ayakoto/html-number-countup';
const element = document.getElementById('countup-target');
init(element, { start: 0, end: 1000, duration: 2000, separator: ",", decimalDigits: 2 });

Notes

  • どのようにスクロールしても画面全体に表示されることがない要素(大きさが画面サイズを超えている要素など)に対しては、カウントアップアニメーションは発動しません。
  • アニメーションは一度だけ発動します。要素が画面外にスクロールアウトして再度スクロールインしても、再度アニメーションは発動しません。
  • endオプションは必須です。指定しない場合、コンソールにエラーメッセージが表示され、アニメーションは発動しません。
  • endオプションに数値以外の値を指定した場合、コンソールにエラーメッセージが表示され、アニメーションは発動しません。

Development

Build, Publish

package.jsonのバージョンを更新した後、以下のコマンドを実行してビルドおよび公開を行います。

npm run build
npm publish --access public

License

copyright (c) 2026- Ayasaka-Koto. This library is licensed under the MIT License.