hooyantsing's Blog

P231_23_提交按钮加载动画效果

字数统计: 187阅读时长: 1 min
2020/04/25

P231 23 提交按钮加载动画效果

实战案例

效果:

.png

源码:

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
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <style>
        * {
            padding: 0;
            margin: 0;
            box-sizing: border-box;
        }

        body {
            height: 100vh;
            width: 100vw;
            display: grid;
            grid-template: 1fr / 1fr;
        }

        button {
            width: 150px;
            height: 40px;
            justify-self: center;
            align-self: center;
            color: #34495e;

        }

        button::after {
            content: '';
            width: 3px;
            height: 3px;
            display: inline-block;
            animation-name: hd;
            animation-duration: 1s;
            animation-iteration-count: infinite;
        }

        @keyframes hd {
            from {
                box-shadow: none;
            }
            25% {
                box-shadow: 3px 0 0 currentColor;
            }
            50% {
                box-shadow: 3px 0 0 currentColor, 9px 0 0 currentColor;
            }
            80% {
                box-shadow: 3px 0 0 currentColor, 9px 0 0 currentColor, 15px 0 0 currentColor;
            }
        }
    </style>
</head>
<body>
<button>提交</button>
</body>
</html>
CATALOG