echarts 数字翻滚_CountUp.js实现数字滚动增值效果

数据改动的时候,countUp.js进行数值滚动增加的动态效果,供大家参考,具体内容如下

这是js文件

// target = id of html element or var of previously selected html element where counting occurs

// startVal = the value you want to begin at

// endVal = the value you want to arrive at

// decimals = number of decimal places, default 0

// duration = duration of animation in seconds, default 2

// options = optional object of options (see below)

var CountUp = function (target, startVal, endVal, decimals, duration, options) {

var self = this

self.version = function () { return '1.9.3' }

// default options

self.options = {

useEasing: true, // toggle easing

useGrouping: true, // 1,000,000 vs 1000000

separator: ',', // character to use as a separator

decimal: '.', // character to use as a decimal

easingFn: easeOutExpo, // optional custom easing function, default is Robert Penner's easeOutExpo

formattingFn: formatNumber, // optional custom formatting function, default is formatNumber above

prefix: '', // optional text before the result

suffix: '', // optional text after the result

numerals: [] // optionally pass an array of custom numerals for 0-9

}

// extend default options with passed options object

if (options && typeof options === 'object') {

for (var key in self.options) {

if (options.hasOwnProperty(key) && options[key] !== null) {

self.options[key] = options[key]

}

}

}

if (self.options.separator === '') {

self.options.useGrouping = false

} else {

// ensure the separator is a string (formatNumber assumes this)

self.options.separator = '' + self.options.separator

}

// make sure requestAnimationFrame and cancelAnimationFrame are defined

// polyfill for browsers without native support

// by

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值