-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstroke button.html
More file actions
108 lines (91 loc) · 2.82 KB
/
stroke button.html
File metadata and controls
108 lines (91 loc) · 2.82 KB
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>stroke button</title>
<style>
* {
padding: 0;
margin: 0;
font-size: 5vmin;
}
body {
display: flex;
justify-content: center;
align-items: center;
width: 100%;
height: 100vh;
background-color: #171717;
}
.button {
position: absolute;
display: flex;
justify-content: center;
align-items: center;
padding: 0.3rem 1rem;
border: 0.05rem solid #f7f7f7;
border-radius: 2rem;
cursor: pointer;
}
.button_text {
font-family: impact;
font-size: 1.2rem;
color: #17f700;
letter-spacing: 0.05rem;
margin-right: 0.5rem;
}
/* JIEJOE produce
b站主页:https://space.bilibili.com/3546390319860710 */
.button_icon {
width: 0.9rem;
fill: none;
stroke: #17f700;
stroke-width: 15;
transition: transform 0.8s ease;
transform: translateY(15%);
}
.button_icon_straight,
.button_icon_bias {
transition: stroke-dasharray 0.6s ease;
}
.button_arrow .button_icon_straight {
stroke-dasharray: 50 50 200;
}
.button_arrow .button_icon_bias {
stroke-dasharray: 205 300 205 300;
}
.button_arrow:hover .button_icon_straight {
stroke-dasharray: 150 50 200;
}
.button_cross .button_icon {
transform: translateY(-15%);
}
.button_cross .button_icon_straight {
stroke-dasharray: 0 300;
}
.button_cross .button_icon_bias {
stroke-dasharray: 0 0 400 0;
}
.button_cross:hover .button_icon_bias {
stroke-dasharray: 20 60 240 60 20;
}
</style>
</head>
<body>
<div class="button button_arrow" onclick="change_state(this)">
<p class="button_text">STROKE</p>
<svg class="button_icon" viewBox="0 0 283.9 425.8">
<line class="button_icon_straight" x1="141.9" y1="-0.1" x2="141.9" y2="283.8" />
<line class="button_icon_bias" x1="0" y1="141.9" x2="283.9" y2="425.8" />
<line class="button_icon_bias" x1="283.9" y1="141.9" x2="0" y2="425.8" />
</svg>
</div>
</body>
<script>
function change_state(ele) {
ele.classList.toggle("button_arrow");
ele.classList.toggle("button_cross");
}
</script>
</html>