File size: 2,995 Bytes
7c8e4a1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
class DancingDotsLoader extends HTMLElement {
    connectedCallback() {
        this.attachShadow({ mode: 'open' });
        this.shadowRoot.innerHTML = `
            <style>
                .container {
                    width: 100px;
                    height: 100px;
                    position: relative;
                    animation: rotate-move 2s ease-in-out infinite;
                }
                
                .dot {
                    width: 15px;
                    height: 15px;
                    border-radius: 50%;
                    position: absolute;
                    top: 0;
                    bottom: 0;
                    left: 0;
                    right: 0;
                    margin: auto;
                }
                
                .dot-1 {
                    background-color: #ffe386;
                    animation: dot-1-move 2s ease infinite;
                }
                
                .dot-2 {
                    background-color: #10beae;
                    animation: dot-2-move 2s ease infinite;
                }
                
                .dot-3 {
                    background-color: #f74d75;
                    animation: dot-3-move 2s ease infinite;
                }
                
                @keyframes dot-1-move {
                    20% { transform: scale(1) }
                    45% { transform: translate(16px, 12px) scale(.45) }
                    60% { transform: translate(20px, 15px) scale(.45) }
                    80% { transform: translate(20px, 15px) scale(.45) }
                    100% { transform: translateY(0px) scale(1) }
                }
                
                @keyframes dot-2-move {
                    20% { transform: scale(1) }
                    45% { transform: translate(-16px, 12px) scale(.45) }
                    60% { transform: translate(-20px, 15px) scale(.45) }
                    80% { transform: translate(-20px, 15px) scale(.45) }
                    100% { transform: translateY(0px) scale(1) }
                }
                
                @keyframes dot-3-move {
                    20% { transform: scale(1) }
                    45% { transform: translateY(-18px) scale(.45) }
                    60% { transform: translateY(-25px) scale(.45) }
                    80% { transform: translateY(-25px) scale(.45) }
                    100% { transform: translateY(0px) scale(1) }
                }
                
                @keyframes rotate-move {
                    55% { transform: rotate(0deg) }
                    80% { transform: rotate(360deg) }
                    100% { transform: rotate(360deg) }
                }
            </style>
            <div class="container">
                <div class="dot dot-1"></div>
                <div class="dot dot-2"></div>
                <div class="dot dot-3"></div>
            </div>
        `;
    }
}

customElements.define('dancing-dots-loader', DancingDotsLoader);