feat: demonstrate animation
This commit is contained in:
parent
9a4f6d10f4
commit
6c61c96091
3 changed files with 36 additions and 6 deletions
|
|
@ -68,6 +68,25 @@ import GameTab from '~/components/GameTab.vue'
|
|||
export default {
|
||||
name: 'IndexPage',
|
||||
components: { GameTab, FirstTabContent },
|
||||
mounted() {
|
||||
window.setInterval(() => {
|
||||
this.gametick()
|
||||
}, 1000)
|
||||
},
|
||||
methods: {
|
||||
gametick() {
|
||||
for (let i = 0; i <= 4; i++) {
|
||||
const currentCompletion = this.$store.state.processes[i].completion
|
||||
const step = 100.0 / (6.0 * (i + 1)) // go at different rates
|
||||
let newValue = currentCompletion + step
|
||||
if (newValue >= 100) newValue = newValue - 100
|
||||
this.$store.commit('setProcessCompletion', {
|
||||
processIndex: i,
|
||||
value: newValue,
|
||||
})
|
||||
}
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
|
|
|
|||
Reference in a new issue