div+css实现点状8字摆动动画效果代码
代码语言:html
所属分类:动画
代码描述:div+css实现点状8字摆动动画效果代码
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html>
<html lang="en" >
<head>
<meta charset="UTF-8">
<style>
body {background-color: #345995;}
.center {
margin-top: 100px;
display: flex;
flex-direction: row;
flex-wrap: wrap;
justify-content: center;
}
.circle,
.circle2 {
position: relative;
width: 200px;
height: 200px;
border-radius: 50%;
display: inline-block;
}
.dot,
.dot2 {
position: absolute;
width: 10px;
height: 10px;
background-color: #03CEA4;
border-radius: 50%;
animation-duration: 3s;
animation-iteration-count: infinite;
animation-timing-function: ease-in-out;
}
/* First circle */
.dot {
animation-name: moveParticle;
}
/* Second circle */
.dot2 {
animation-name: moveParticle2;
}
@keyframes moveParticle {
0%,
100% {
transform: scale(1) translate(0, 0);
opacity: 1;
}
50% {
transform: scale(2) translate(-20px, 20px);
opacity: 0.5;
}
}
@keyframes moveParticle2 {
0%,
100% {
transform: scale(2) translate(0, 0);
opacity: 1;
}
50% {
transform: scale(1) translate(20px, -20px);
opacity: 0.7;
}
}
.dot:nth-child(1),
.dot2:nth-child(1) {
left: calc(50% + 100px * cos(0deg) - 5px);
top: calc(50% + 100px * sin(0deg) - 5px);
animation-delay: 0s;
}
.dot:nth-child(2),
.dot2:nth-child(2) {
left: calc(50% + 100px * cos(30deg) - 5px);
top: calc(50% + 100px * sin(30deg) - 5px);
animation-delay: 0.2s;
}
.dot:nth-child(3),
.dot2.........完整代码请登录后点击上方下载按钮下载查看
网友评论0