在vue中利用TweenMax动画实现数字滚动

it2022-05-05  156

让数字在渲染时达到滚动增长的效果

mounted() { this.plist = [ { id:1, name:'月职住人口', value:12664103, },{ id:2, name:'月流入人口', value:2330366, }, { id:3, name:'月流出人口', value:1845645, } ] this.set() }, methods: { set() { this.setLite(this.plist[0], this.plist[0].value) this.setLite(this.plist[1], this.plist[1].value) this.setLite(this.plist[2], this.plist[2].value) }, setLite(obj, val) { TweenMax.fromTo( obj, 2, { value: 0 }, { value: val, roundProps: ['value'] } ) } }

最新回复(0)