/
clip-pathBorder动画.html
112 lines (94 loc) · 1.76 KB
/
clip-pathBorder动画.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
body,
html {
width: 100%;
height: 100%;
display: flex;
}
.box {
position: relative;
margin: auto;
width: 160px;
height: 160px;
line-height: 160px;
text-align: center;
font-size: 24px;
border-radius: 10px;
}
.box::before {
content: "";
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
border: 2px solid gold;
/* transition: all .5s; */
/* background: rgba(255, 215, 0, .5); */
animation: clippath 3s infinite linear;
}
.sp {
background: gold;
border-radius: 10px;
cursor: pointer;
}
.sp::before {
top: -10px;
left: -10px;
right: -10px;
bottom: -10px;
border-radius: 10px;
}
.sp::after {
content: "";
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
border: 2px solid gold;
top: -10px;
left: -10px;
right: -10px;
bottom: -10px;
border-radius: 10px;
animation: clippath 3s infinite -1.5s linear;
}
.sp:hover {
filter: contrast(1.1);
}
.sp:active {
filter: contrast(0.8);
}
@keyframes clippath {
0%,
100% {
clip-path: inset(0 0 95% 0);
}
25% {
clip-path: inset(0 95% 0 0);
}
50% {
clip-path: inset(95% 0 0 0);
}
75% {
clip-path: inset(0 0 0 95%);
}
}
</style>
</head>
<body>
<div class="box">
Lac
</div>
<div class="box sp">
Lac!#
</div>
</body>
</html>