CSS3实现圆圈动态发光特效动画
2022年01月29日
1295
CSS3实现圆圈动态发光特效动画
红色 圆圈 动态发光,二层光晕效果
白色 圆圈 动态发光,三层光晕效果
黄色 圆圈 动态发光,二层光晕效果

html:
<!-- 红色 圆圈 动态发光,二层光晕效果 --> <div class="circle-wrap"> <div class="circle"> <div class="big-circle"></div> <div class="small-circle"></div> </div> </div> <!-- 白色 圆圈 动态发光,三层光晕效果 --> <div class="smallcircle2"></div> <div class="bigcircle2"></div> <!-- 黄色 圆圈 动态发光,二层光晕效果 --> <div class="item"></div>
css:
<style>
body{
background: #006699;
}
.circle-wrap{
position: absolute;
top: 100px;
left: 100px;
}
.circle{
width: 24px;
height: 24px;
position: relative;
}
.big-circle{
width: 100%;
height: 100%;
border-radius: 50%;
background: #ff0033;
position: absolute;
top: -6px;
left: -6px;
animation: twinkling 1s infinite ease-in-out;
animation-fill-mode: both;
}
.small-circle{
width: 12px;
height: 12px;
background: #ff0033;
border-radius: 50%;
position: absolute;
}
@keyframes twinkling {
0%{
opacity: 0.2;
transform: scale(1);
}
50%{
opacity: 0.5;
transform: scale(1.12);
}
100%{
opacity: 0.2;
transform: scale(1);
}
}
.smallcircle2{
width: 12px;
height: 12px;
background-color: #fff;
border-radius: 50%;
position: absolute;
top: 100px;
left: 200px;
}
.smallcircle2::before{
content: '';
display: block;
width: 12px;
height: 12px;
background-color: #fff;
border-radius: 50%;
opacity: 0.4;
animation: scale 1s infinite cubic-bezier(0,0,0.49,1.02);
}
@keyframes scale {
0%{
transform: scale(1);
}
50%,75%{
transform: scale(3);
}
78%,100%{
opacity: 0;
}
}
.bigcircle2{
width: 12px;
height: 12px;
background-color: #fff;
opacity: 0.4;
border-radius: 50%;
position: absolute;
top: 100px;
left: 200px;
animation: scales 1s infinite cubic-bezier(0,0,0.49,1.02);
}
@keyframes scales {
0%{
transform: scale(1);
}
50%,75%{
transform: scale(2);
}
78%,100%{
opacity: 0;
}
}
.item{
width: 14px;
height: 14px;
background-color: #ffff00;
border-radius: 50%;
position: absolute;
top: 150px;
left: 100px;
}
.item::before{
content: '';
display: block;
width: 14px;
height: 14px;
border-radius: 50%;
opacity: 0.7;
background-color: #ffff00;
animation: scaless 1s infinite cubic-bezier(0,0,0.49,1.02);
}
@keyframes scaless {
0%{
transform: scale(1);
}
50%,75%{
transform: scale(3);
}
78%,100%{
opacity: 0;
}
}
</style>
