先看效果:
實現原理:改變圖片的透明度
代碼:
<div class="breath"></div>
.breath {
width: 8%;
height: 77%;
position: absolute;
right: 19px;
top: 17px;
background: url("../../assets/image/drugRight/BreathingLampL.png") no-repeat;
background-size: 100% 100%;
animation: breathLamp 2s alternate infinite;
}
@keyframes breathLamp{
0%{
opacity:.2;
}
100%{
opacity:1;
}
}