-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.html
142 lines (130 loc) · 2.94 KB
/
index.html
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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
<html>
<style>
.bracket-container {
margin-top: 15vh;
width: 100%;
display: flex;
justify-content: center;
align-items: center;
flex-direction: column;
}
.bracket {
position: relative;
width: 800px;
height: 50px;
border-top: 3px solid black;
border-left: 3px solid black;
border-right: 3px solid black;
}
.bracket::before {
content: "";
position: absolute;
top: -3px;
left: -13px;
width: 10px;
height: 10px;
background-image: radial-gradient(
circle at 100% 0,
transparent 0%,
transparent 10px,
black 10px
);
transform: rotate(180deg);
}
.bracket::after {
content: "";
position: absolute;
top: -3px;
right: -13px;
width: 10px;
height: 10px;
background-image: radial-gradient(
circle at 0% 0,
transparent 0%,
transparent 10px,
black 10px
);
transform: rotate(180deg);
}
.border-tip-left {
position: absolute;
left: -0.5;
width: 0;
bottom: 0;
height: 0;
border-left: 4px solid transparent;
border-bottom: 50px solid white;
transform: translateX(-50%);
}
.border-tip-right {
position: absolute;
right: -5.5;
width: 0;
bottom: 0;
height: 0;
border-right: 4px solid transparent;
border-bottom: 50px solid white;
transform: translateX(-50%);
}
.extruding-line {
position: absolute;
top: -20px;
left: 50%;
width: 0;
height: 0;
border-left: 20px solid transparent;
border-right: 20px solid transparent;
border-bottom: 20px solid black;
border-radius: 20%;
transform: translateX(-50%);
}
.extruding-line::before {
content: "";
position: absolute;
top: -20px;
left: 50%;
width: 0;
height: 0;
border-left: 10px solid transparent;
border-right: 10px solid transparent;
border-bottom: 40px solid black;
transform: translateX(-50%);
}
.extruding-line::after {
content: "";
position: absolute;
top: -10px;
left: 50%;
width: 0;
height: 0;
border-left: 5px solid transparent;
border-right: 5px solid transparent;
border-bottom: 30px solid white;
transform: translateX(-50%);
}
#range-input {
margin-right: auto;
margin-left: auto;
width: 800px;
margin-top: 60px;
}
</style>
<div class="bracket-container">
<div class="bracket" id="bracket">
<div class="extruding-line"></div>
<div class="border-tip-left"></div>
<div class="border-tip-right"></div>
</div>
<input type="range" min="0" max="100" value="50" id="range-input" />
</div>
<script>
const rangeInput = document.getElementById("range-input")
const extrudingLine = document.querySelector(".extruding-line")
const bracketWidth = document.querySelector("#bracket").offsetWidth
rangeInput.addEventListener("input", () => {
const value = rangeInput.value
const translateX = (value / 100) * (bracketWidth - 40) - bracketWidth / 2
extrudingLine.style.transform = `translateX(${translateX}px)`
})
</script>
</html>