Remove smooth option to improve performance

This commit is contained in:
syuilo 2020-03-22 18:18:34 +09:00
parent 9f32e46921
commit 92f47cc9cb
1 changed files with 4 additions and 14 deletions

View File

@ -38,13 +38,6 @@ import Vue from 'vue';
import * as tinycolor from 'tinycolor2'; import * as tinycolor from 'tinycolor2';
export default Vue.extend({ export default Vue.extend({
props: {
smooth: {
type: Boolean,
default: false
}
},
data() { data() {
return { return {
now: new Date(), now: new Date(),
@ -83,9 +76,6 @@ export default Vue.extend({
return tinycolor(this.computedStyle.getPropertyValue('--accent')).toHexString(); return tinycolor(this.computedStyle.getPropertyValue('--accent')).toHexString();
}, },
ms(): number {
return this.now.getMilliseconds() * (this.smooth ? 1 : 0);
},
s(): number { s(): number {
return this.now.getSeconds(); return this.now.getSeconds();
}, },
@ -97,13 +87,13 @@ export default Vue.extend({
}, },
hAngle(): number { hAngle(): number {
return Math.PI * (this.h % 12 + (this.m + (this.s + this.ms / 1000) / 60) / 60) / 6; return Math.PI * (this.h % 12 + (this.m + this.s / 60) / 60) / 6;
}, },
mAngle(): number { mAngle(): number {
return Math.PI * (this.m + (this.s + this.ms / 1000) / 60) / 30; return Math.PI * (this.m + this.s / 60) / 30;
}, },
sAngle(): number { sAngle(): number {
return Math.PI * (this.s + this.ms / 1000) / 30; return Math.PI * this.s / 30;
}, },
graduations(): any { graduations(): any {
@ -121,7 +111,7 @@ export default Vue.extend({
const update = () => { const update = () => {
if (this.enabled) { if (this.enabled) {
this.tick(); this.tick();
requestAnimationFrame(update); setTimeout(update, 1000);
} }
}; };
update(); update();