diff --git a/package-lock.json b/package-lock.json index 02b3842..b5be60e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -20,6 +20,7 @@ "color": "^4.2.3", "concurrently": "^8.2.2", "electron-squirrel-startup": "^1.0.0", + "gsap": "^3.12.5", "lucide-vue-next": "^0.309.0", "pinia": "^2.1.7", "radix-vue": "^1.3.0", @@ -6818,6 +6819,11 @@ "integrity": "sha512-EtKwoO6kxCL9WO5xipiHTZlSzBm7WLT627TqC/uVRd0HKmq8NXyebnNYxDoBi7wt8eTWrUrKXCOVaFq9x1kgag==", "dev": true }, + "node_modules/gsap": { + "version": "3.12.5", + "resolved": "https://registry.npmjs.org/gsap/-/gsap-3.12.5.tgz", + "integrity": "sha512-srBfnk4n+Oe/ZnMIOXt3gT605BX9x5+rh/prT2F1SsNJsU1XuMiP0E2aptW481OnonOGACZWBqseH5Z7csHxhQ==" + }, "node_modules/has-flag": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", @@ -16130,6 +16136,11 @@ "integrity": "sha512-EtKwoO6kxCL9WO5xipiHTZlSzBm7WLT627TqC/uVRd0HKmq8NXyebnNYxDoBi7wt8eTWrUrKXCOVaFq9x1kgag==", "dev": true }, + "gsap": { + "version": "3.12.5", + "resolved": "https://registry.npmjs.org/gsap/-/gsap-3.12.5.tgz", + "integrity": "sha512-srBfnk4n+Oe/ZnMIOXt3gT605BX9x5+rh/prT2F1SsNJsU1XuMiP0E2aptW481OnonOGACZWBqseH5Z7csHxhQ==" + }, "has-flag": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", diff --git a/package.json b/package.json index bb61578..4b9aab8 100644 --- a/package.json +++ b/package.json @@ -27,6 +27,7 @@ "color": "^4.2.3", "concurrently": "^8.2.2", "electron-squirrel-startup": "^1.0.0", + "gsap": "^3.12.5", "lucide-vue-next": "^0.309.0", "pinia": "^2.1.7", "radix-vue": "^1.3.0", diff --git a/src/components/device/DeviceKeys.vue b/src/components/device/DeviceKeys.vue new file mode 100644 index 0000000..5395f17 --- /dev/null +++ b/src/components/device/DeviceKeys.vue @@ -0,0 +1,23 @@ + + + \ No newline at end of file diff --git a/src/components/device/DeviceLEDRing.vue b/src/components/device/DeviceLEDRing.vue index bfdc265..b576d11 100644 --- a/src/components/device/DeviceLEDRing.vue +++ b/src/components/device/DeviceLEDRing.vue @@ -1,37 +1,62 @@ \ No newline at end of file diff --git a/src/components/device/DevicePreview.vue b/src/components/device/DevicePreview.vue index 12599f5..3e94a7c 100644 --- a/src/components/device/DevicePreview.vue +++ b/src/components/device/DevicePreview.vue @@ -9,12 +9,13 @@ +
midi-logo -

{{ value }}

+

{{ parseInt(value) }}

HIGH PASS
+ @@ -33,6 +35,9 @@ import DeviceBar from '@/components/device/DeviceBar.vue' import { useStore } from '@/store' import ScrambleText from '@/components/effects/ScrambleText.vue' import { computed, onMounted, onUnmounted, ref } from 'vue' +import DeviceLEDRing from '@/components/device/DeviceLEDRing.vue' +import gsap from 'gsap' +import DeviceKeys from '@/components/device/DeviceKeys.vue' const value = ref(69) @@ -40,28 +45,14 @@ const barValue = computed(() => value.value / 127 * 100) const store = useStore() -let anim = null -let step = null +const targetValue = ref(69) +const animateValue = () => { + targetValue.value = Math.floor(Math.random() * 127) + gsap.to(value, { duration: 1, value: targetValue.value, ease: 'power2.inOut' }) + setTimeout(animateValue, 1500 + Math.random() * 2000) +} onMounted(() => { - anim = setInterval(() => { - clearInterval(step) - const target = Math.floor(Math.random() * 127) - step = setInterval(() => { - const intVal = Math.floor(value.value) - if (intVal < target) { - value.value = intVal + 1 - } else if (intVal > target) { - value.value = intVal - 1 - } else { - clearInterval(step) - } - }, 20) - }, 2000) -}) - -onUnmounted(() => { - clearInterval(anim) - clearInterval(step) + animateValue() }) \ No newline at end of file diff --git a/src/data/mapping.json b/src/data/mapping.json new file mode 100644 index 0000000..d7a34e9 --- /dev/null +++ b/src/data/mapping.json @@ -0,0 +1,75 @@ +{ + "actions": { + "unique-id-12313": { + "trigger": "rotation", + // "rotation", "keyDown", "keyUp", "keyHold" + "key": "a", + "duration": 250, + // ms (only for keyHold) + "direction": "clockwise", + // "counterClockwise" (only for rotation), + "condition": { + "type": "key", + "key": "a" + }, + "events": [ + { + "type": "keyDown", + // "keyUp" + "key": "ctrl" + }, + { + "type": "serialWrite", + "data": "Hello, World!" + }, + { + "type": "keyCombination", + "keys": [ + "ctrl", + "a" + ] + }, + { + "type": "delay", + "time": 100 + }, + { + "type": "mouseMove", + "x": 100, + "y": 20, + "smooth": true + }, + { + "type": "midiCC", + "cc": 64, + "value": 127 + }, + { + "type": "midiNote", + "note": 60, + "velocity": 127 + }, + { + "type": "midiProgramChange", + "program": 1 + }, + { + "type": "action", + // watch out for infinite loops + "action": "unique-id-42069" + }, + { + "type": "profileChange", + "profile": "+1", + // "profile-name" + "tag": null + // "tag-name" + }, + { + "type": "repeat", + "times": 3 + } + ] + } + } +} \ No newline at end of file