css實現呼吸燈動效

先看效果:

實現原理:改變圖片的透明度

代碼:

 <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;
  }
}

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章