# @hanspeleman/rolling-number

> is an easy-to-use inline Web Component that shows a nice rolling digit animation

Latest version **1.2.2** (published 2024-04-16) · MIT license · 0 weekly downloads

## Install

```sh
npm install @hanspeleman/rolling-number
pnpm add @hanspeleman/rolling-number
yarn add @hanspeleman/rolling-number
bun add @hanspeleman/rolling-number
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.2.2 |
| Published | 2024-04-16 |
| First published | 2024-04-15 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 10.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | hanspeleman |
| Maintainers | hansp. |
| Keywords | rolling, number, numbers, web component, layflags, digits, animation, animating, animated |

## Links

- npm: https://www.npmjs.com/package/@hanspeleman/rolling-number
- Repository: https://github.com/hanspeleman/rolling-number
- Homepage: https://github.com/hanspeleman/rolling-number#readme
- Issues: https://github.com/hanspeleman/rolling-number/issues
- npm.io page: https://npm.io/package/@hanspeleman/rolling-number

## Alternatives

- [random-seedable](https://npm.io/package/random-seedable.md) — 27.9K weekly downloads
- [n2words](https://npm.io/package/n2words.md) — 22.2K weekly downloads
- [@stdlib/math-base-special-factorialln](https://npm.io/package/@stdlib/math-base-special-factorialln.md) — 5.7K weekly downloads
- [@stdlib/math-base-special-abs2](https://npm.io/package/@stdlib/math-base-special-abs2.md) — 1.7K weekly downloads
- [commons-math-interpolation](https://npm.io/package/commons-math-interpolation.md) — 1.4K weekly downloads

## Recent versions

- 1.2.2 (latest) — 2024-04-16
- 1.2.1 — 2024-04-15
- 1.1.1 — 2024-04-15
- 1.1.0 — 2024-04-15
- 1.0.1 — 2024-04-15

## README

# rolling-number
**&lt;rolling-number&gt; is an easy-to-use inline Web Component**
This easy-to-use web component shows a nice rolling digit animation.

![Rolling Number Screen Recording](rolling-number.gif)

## Information

- The &lt;rolling-number&gt; component can be used out-of-the-box with a monospaced font.
- The webcomponent inherits the font-family from it's parent.
- Depending on the font-family your letterspacing will vary

## Installation

### Self hosted

Add the following to an HTML document:

```html
<script type="module" src="path/to/rolling-number.js"></script>
```

### NPM
```html
npm i @hanspeleman/rolling-number
```

## Usage

Value by fallback
```html
<rolling-number>123</rolling-number>
```
Value w/o fallback
```html
<rolling-number value="123"></rolling-number>
```
Customize roll duration
```html
<rolling-number style="--roll-duration:750ms" value="123"></rolling-number>
```

## Roadmap

- [x] Fixed inline css typo
- [x] Fixed inline css so other non-monospaced fonts are nicely aligned in each digits column
- [x] Add an observer wich will initiate the animation only when it's in view
- [x] Reset the element each time it's out of view
- [ ] Add full support for non-monospaced fonts
- [ ] Add feature the roll n-times
- [ ] ...

[![my github badge](https://img.shields.io/badge/hanspeleman-000?style=for-the-badge&logo=github&logoColor=white)](https://github.com/hanspeleman) ![NPM Version](https://img.shields.io/npm/v/%40hanspeleman%2Frolling-number?style=for-the-badge&include_prereleases=&sort=semver&color=black) [![License](https://img.shields.io/badge/License-MIT-black?style=for-the-badge)](#license)
This repository is based on [@layflags/rolling-number](https://github.com/layflags/rolling-number).

---
_Source: https://npm.io/package/@hanspeleman/rolling-number · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
