# zpm-fun

> countUp: new zpm.sys.web.number.countUp(target, startVal, endVal, decimals, duration, options)

Latest version **0.0.115** (published 2022-10-03) · ISC license · 0 weekly downloads

## Install

```sh
npm install zpm-fun
pnpm add zpm-fun
yarn add zpm-fun
bun add zpm-fun
```

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.115 |
| Published | 2022-10-03 |
| First published | 2022-06-18 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 5 |
| Unpacked size | 3.6 MB |
| Known vulnerabilities | 0 (+2 in 1 direct dependencies) |
| Install scripts | no |
| Maintainers | zpm |

## Links

- npm: https://www.npmjs.com/package/zpm-fun
- npm.io page: https://npm.io/package/zpm-fun

## Dependencies (5)

- [xlsx](https://npm.io/package/xlsx.md) ^0.17.4
- [moment](https://npm.io/package/moment.md) ^2.29.1
- [iconv-lite](https://npm.io/package/iconv-lite.md) ^0.6.3
- [html2canvas](https://npm.io/package/html2canvas.md) ^1.1.4
- [child_process](https://npm.io/package/child_process.md) ^1.0.2

## Recent versions

- 0.0.115 (latest) — 2022-10-03
- 0.0.114 — 2022-09-05
- 0.0.113 — 2022-08-29
- 0.0.112 — 2022-08-29
- 0.0.111 — 2022-08-29
- 0.0.110 — 2022-08-28
- 0.0.109 — 2022-08-28
- 0.0.108 — 2022-06-19
- 0.0.107 — 2022-06-19
- 0.0.106 — 2022-06-19
- 0.0.105 — 2022-06-19
- 0.0.104 — 2022-06-19
- 0.0.103 — 2022-06-19
- 0.0.102 — 2022-06-18

## README

countUp:
new zpm.sys.web.number.countUp(target, startVal, endVal, decimals, duration, options)

参数：

target: 目标元素的id  *必填
startVal：开始的值(从哪个值开始)  *必填
endVal：结束的值(滚动到哪个值结束)  *必填
decimals：小数位数，默认值为0  *可选
duration：动画持续时间，单位为秒，默认值为2  *可选
options：选项的可选对象  *可选
                     useEasing:true  --是否使用缓动动画，默认为缓动，可设置为false让其匀速

                     useGrouping:true --对数字进行分组，如12345，按三位一组变为类似12,345这样的

                     separator: ','  --分组时使用的分隔符默认是逗号

                      decimal: '.'  --小数点

                      prefix: ''  --添加前缀如12345，变为￥12345

                      suffix: ''  --添加后缀如12345 通过添加后缀变为12345$，12345元之类的

方法：

暂停/恢复      pauseResume
重置动画       reset
更新值           update(newVal)

例如：
numberScroll() {
 let count = new CountUp("numScroll", 0, 56565, 0, 5, {duration: 5, useEasing: false})
 if (!count.error) {
  count.start()
 } else {
  console.log(count.error)
 }
 }

<!-- 可持续更新数据 -->
 setInterval(() => {
       count.update(count.endVal);
     }, 1000);

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