-
Notifications
You must be signed in to change notification settings - Fork 312
/
Copy pathSequencerPhraseIndicator.vue
85 lines (76 loc) · 1.89 KB
/
SequencerPhraseIndicator.vue
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
<template>
<div :class="`${className}`"></div>
</template>
<script lang="ts">
import { defineComponent, computed } from "vue";
import { useStore } from "@/store";
import { PhraseState } from "@/store/type";
export default defineComponent({
name: "SingSequencerPhraseIndicator",
props: {
phraseKey: { type: String, required: true },
},
setup(props) {
const store = useStore();
const classNames: Record<PhraseState, string> = {
WAITING_TO_BE_RENDERED: "waiting-to-be-rendered",
NOW_RENDERING: "now-rendering",
COULD_NOT_RENDER: "could-not-render",
PLAYABLE: "playable",
};
const className = computed(() => {
const phrase = store.state.phrases.get(props.phraseKey);
if (phrase == undefined) {
throw new Error("phrase is undefined.");
}
return classNames[phrase.state];
});
return {
className,
};
},
});
</script>
<style scoped lang="scss">
@use '@/styles/variables' as vars;
@use '@/styles/colors' as colors;
.waiting-to-be-rendered {
background-color: colors.$background;
background-image: linear-gradient(
to right,
rgba(colors.$primary-rgb, 0.8),
rgba(colors.$primary-rgb, 0.8)
);
}
.now-rendering {
border: 1px solid rgba(colors.$primary-rgb, 0.7);
background-color: colors.$background;
background-size: 28px 28px;
background-image: linear-gradient(
-45deg,
colors.$primary,
colors.$primary 25%,
rgba(colors.$primary-rgb, 0.36) 25%,
rgba(colors.$primary-rgb, 0.36) 50%,
colors.$primary 50%,
colors.$primary 75%,
rgba(colors.$primary-rgb, 0.36) 75%,
rgba(colors.$primary-rgb, 0.36) 100%
);
animation: stripes-animation 0.7s linear infinite;
}
@keyframes stripes-animation {
from {
background-position-x: 0;
}
to {
background-position-x: 28px;
}
}
.could-not-render {
background-color: #ff6a64;
}
.playable {
visibility: hidden;
}
</style>