ADD: Device element selection

This commit is contained in:
Robert Kossessa
2024-02-03 23:15:53 +01:00
parent 332984ba07
commit 4398cd2492
3 changed files with 39 additions and 15 deletions

View File

@@ -1,23 +1,38 @@
<template> <template>
<div class="flex"> <div class="flex">
<div <div
v-for="(key, index) in keys" :key="key" class="aspect-square flex-1 rounded-[2px] flex items-center justify-center" v-for="(color, key) in keys"
:style="`box-shadow: 0 0 20px 0 hsl(${-hue + index * 20},100%,50%)`"> :key="key" :class="{'outline outline-white ' : key === selected,
<div class="font-heading text-2xl text-black opacity-30">{{ key}}</div> 'hover:outline outline-zinc-400' : key !== selected}"
class="aspect-square flex-1 rounded-[2px] flex items-center justify-center"
:style="`box-shadow: 0 0 20px 0 ${color.hex()}`"
@click="$emit('select', key)">
<div
class="font-heading text-2xl"
:class="{'opacity-30 text-black': key!==selected}">{{ key }}
</div>
</div> </div>
</div> </div>
</template> </template>
<script setup> <script setup>
import Color from 'color'
import { onMounted, ref } from 'vue' defineProps({
import gsap from 'gsap' keys: {
type: Object,
const keys = ref(['a', 'b', 'c', 'd']) default: () => ({
a: Color.hsl(265, 100, 50),
const hue = ref(0) b: Color.hsl(280, 100, 50),
c: Color.hsl(300, 100, 50),
onMounted(() => { d: Color.hsl(330, 100, 50),
gsap.to(hue, { duration: 10, value: 360, repeat: -1, ease: 'none' }) }),
},
selected: {
type: String,
default: 'a',
},
}) })
defineEmits(['select'])
</script> </script>

View File

@@ -28,7 +28,7 @@ const props = defineProps({
}, },
}) })
const leds = ref(new Array(60).fill(Color())) const leds = ref(Array(60).fill(Color()))
const radius = ref(100) const radius = ref(100)
const ledRadius = ref(3) const ledRadius = ref(3)

View File

@@ -24,7 +24,14 @@
</span> </span>
</div> </div>
</div> </div>
<DeviceKeys class="absolute w-[72.7%] top-[77.2%] gap-[2.8%] left-0 right-0 mx-auto" /> <div
class="rounded-full outline-2 absolute h-[41.5%] top-[24.5%] aspect-square left-0 right-0 mx-auto"
:class="{'outline outline-white': selected==='ring',
'hover:outline outline-zinc-400': selected!=='ring'}"
@click="selected='ring'" />
<DeviceKeys
:selected="selected" class="absolute w-[72.7%] top-[77.2%] gap-[2.8%] left-0 right-0 mx-auto"
@select="args => selected=args" />
</div> </div>
</div> </div>
</template> </template>
@@ -34,11 +41,13 @@ import LogoMidi from '@/assets/logos/logoMidi.svg'
import DeviceBar from '@/components/device/DeviceBar.vue' import DeviceBar from '@/components/device/DeviceBar.vue'
import { useStore } from '@/store' import { useStore } from '@/store'
import ScrambleText from '@/components/effects/ScrambleText.vue' import ScrambleText from '@/components/effects/ScrambleText.vue'
import { computed, onMounted, onUnmounted, ref } from 'vue' import { computed, onMounted, ref } from 'vue'
import DeviceLEDRing from '@/components/device/DeviceLEDRing.vue' import DeviceLEDRing from '@/components/device/DeviceLEDRing.vue'
import gsap from 'gsap' import gsap from 'gsap'
import DeviceKeys from '@/components/device/DeviceKeys.vue' import DeviceKeys from '@/components/device/DeviceKeys.vue'
const selected = ref('a')
const value = ref(69) const value = ref(69)
const barValue = computed(() => value.value / 127 * 100) const barValue = computed(() => value.value / 127 * 100)