fix: Remove animated running numbers (#3604)

This commit is contained in:
Sivin Varghese 2021-12-21 07:49:59 +05:30 committed by GitHub
parent 83655f4ca4
commit 0130e08016
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 1 additions and 36 deletions

View file

@ -14,8 +14,6 @@
</li>
</template>
<script>
import TWEEN from 'tween.js';
export default {
name: 'WootTabsItem',
props: {
@ -41,43 +39,16 @@ export default {
},
},
data() {
return {
animatedNumber: 0,
};
},
computed: {
active() {
return this.index === this.$parent.index;
},
getItemCount() {
return this.animatedNumber || this.count;
return this.count;
},
},
watch: {
count(newValue, oldValue) {
let animationFrame;
const animate = time => {
TWEEN.update(time);
animationFrame = window.requestAnimationFrame(animate);
};
const tweeningNumber = { value: oldValue };
new TWEEN.Tween(tweeningNumber)
.easing(TWEEN.Easing.Quadratic.Out)
.to({ value: newValue }, 500)
.onUpdate(() => {
this.animatedNumber = tweeningNumber.value.toFixed(0);
})
.onComplete(() => {
window.cancelAnimationFrame(animationFrame);
})
.start();
animationFrame = window.requestAnimationFrame(animate);
},
},
methods: {
onTabClick(event) {
event.preventDefault();

View file

@ -51,7 +51,6 @@
"semver": "7.3.5",
"spinkit": "~1.2.5",
"tailwindcss": "^1.9.6",
"tween.js": "~16.6.0",
"url-loader": "^2.0.0",
"v-tooltip": "~2.1.3",
"vue": "2.6.12",

View file

@ -14533,11 +14533,6 @@ tunnel-agent@^0.6.0:
dependencies:
safe-buffer "^5.0.1"
tween.js@~16.6.0:
version "16.6.0"
resolved "https://registry.yarnpkg.com/tween.js/-/tween.js-16.6.0.tgz#739104c9336cc4f11ee53f9ce7cede51e6723624"
integrity sha1-c5EEyTNsxPEe5T+c587eUeZyNiQ=
tweetnacl@^0.14.3, tweetnacl@~0.14.0:
version "0.14.5"
resolved "https://registry.yarnpkg.com/tweetnacl/-/tweetnacl-0.14.5.tgz#5ae68177f192d4456269d108afa93ff8743f4f64"