File size: 2,236 Bytes
8a1f4e2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
<script setup lang="ts">
import {ref} from "vue";

const props = withDefaults(defineProps<{
    isButton? : boolean;
    color? : string;
}>(), {
    isButton: false,
    color: '#fff',
});

const currColor = ref(props.color);

</script>

<template>
    <template v-if="isButton">
        <div class="button-loader" />
    </template>
    <template v-else>
        <div class="section-loader" />
    </template>
</template>

<style lang="scss" scoped>
@import '@plugin/assets/_variables_override.scss';

.button-loader {
    width: 16px;
    height: 16px;
    border-radius: 20px;
    border: 2px solid v-bind(color);
    border-bottom-color: transparent;
    display: inline-block;
    box-sizing: border-box;
    animation: rotation 1s linear infinite;

    @keyframes rotation {
        0% {
            transform: rotate(0deg);
        }
        100%   {
            transform: rotate(360deg);
        }
    }
}

.section-loader {
    position: relative;
    width: 100px;
    height: 50px;
    margin-inline: auto;
    background-repeat: no-repeat;
    background-image: linear-gradient(v-bind(color) 50px, transparent 0),
    linear-gradient(v-bind(color) 50px, transparent 0),
    linear-gradient(v-bind(color) 50px, transparent 0),
    linear-gradient(v-bind(color) 50px, transparent 0),
    linear-gradient(v-bind(color) 50px, transparent 0),
    linear-gradient(v-bind(color) 50px, transparent 0);
    background-position: 0px center, 15px center, 30px center, 45px center, 60px center, 75px center, 90px center;
    animation: rikSpikeRoll 0.65s linear infinite alternate;

    @keyframes rikSpikeRoll {
        0% { background-size: 10px 3px;}
        16% { background-size: 10px 50px, 10px 3px, 10px 3px, 10px 3px, 10px 3px, 10px 3px}
        33% { background-size: 10px 30px, 10px 50px, 10px 3px, 10px 3px, 10px 3px, 10px 3px}
        50% { background-size: 10px 10px, 10px 30px, 10px 50px, 10px 3px, 10px 3px, 10px 3px}
        66% { background-size: 10px 3px, 10px 10px, 10px 30px, 10px 50px, 10px 3px, 10px 3px}
        83% { background-size: 10px 3px, 10px 3px,  10px 10px, 10px 30px, 10px 50px, 10px 3px}
        100% { background-size: 10px 3px, 10px 3px, 10px 3px,  10px 10px, 10px 30px, 10px 50px}
    }
}
</style>