diff --git a/src/components/device/DevicePreview.vue b/src/components/device/DevicePreview.vue index e4f3b4c..dbc9114 100644 --- a/src/components/device/DevicePreview.vue +++ b/src/components/device/DevicePreview.vue @@ -16,7 +16,7 @@ midi-logo

{{ value }}

HIGH PASS
- + KORG MINILOGUE HIGH PASS FILTER 0-127 @@ -32,9 +32,27 @@ import LogoMidi from '@/assets/logos/logoMidi.svg' import DeviceBar from '@/components/device/DeviceBar.vue' import { useStore } from '@/store' import ScrambleText from '@/components/effects/ScrambleText.vue' -import { ref } from 'vue' +import { computed, onMounted, ref } from 'vue' const value = ref(69) +const barValue = computed(() => value.value / 127 * 100) + const store = useStore() + +onMounted(() => { + setInterval(() => { + const target = Math.floor(Math.random() * 127) + const anim = setInterval(() => { + const intVal = Math.floor(value.value) + if (intVal < target) { + value.value = intVal + 1 + } else if (intVal > target) { + value.value = intVal - 1 + } else { + clearInterval(anim) + } + }, 20) + }, 2000) +}) \ No newline at end of file