css3实现精灵球

纯css3实现精灵球晃动效果


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
<html>
<head>
<meta name="UTF-8">
<style type="text/css">
*{
margin: 0px;
padding: 0px;
}
@keyframes anim{
0%{transform: rotate(0deg);}
25%{transform: rotate(30deg);}
50%{transform: rotate(0deg);}
75%{transform: rotate(-30deg);}
100%{transform: rotate(0deg);}
}
@keyframes anim2{
0%{background: white;}
100%{background: red;}
}
div{
position: relative;
height: 300px;
width: 300px;
border-radius: 150px;
margin: auto;
margin-top: 200px;
background: linear-gradient(red 0%,red 47%,black 47%,black 53%,white 53%,white 100%);
box-shadow: 0px 0px 22px #666;
animation: anim 3s infinite;
}
div:before{
content: "";
display: inline-block;
height: 80px;
width: 80px;
background: white;
border-radius: 40px;
position: absolute;
bottom: 110px;
left: 110px;
box-shadow: 0px 0px 0px 20px black inset;
animation: anim2 1s infinite alternate;
}
</style>
</head>
<body>
<div></div>
</body>
</html>

实现效果

gif

×

纯属好玩

扫码支持
扫码打赏,你说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

文章目录
  1. 1. 代码
  2. 2. 实现效果