CSS3實現的圓球放大縮小效果

admin發表於2017-02-17
本章節分享一段程式碼例項,它實現了圓球放大縮小效果。

不知道這麼描述這個效果是否正確,反正瀏覽者預覽到效果就明白了

程式碼例項如下:

[HTML] 純文字檢視 複製程式碼
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="author" content="http://www.softwhy.com/" />
<title>螞蟻部落</title>
<style>
.spinner{
  width:60px;
  height:60px;
  position:relative;
  margin:100px auto;
}
.double-bounce1, .double-bounce2{
  width:100%;
  height:100%;
  border-radius:50%;
  background-color:#67CF22;
  opacity:0.6;
  position:absolute;
  top:0;
  left:0;
  -webkit-animation:bounce 2.0s infinite ease-in-out;
  animation:bounce 2.0s infinite ease-in-out;
}
.double-bounce2{
  -webkit-animation-delay:-1.0s;
  animation-delay:-1.0s;
}
@-webkit-keyframes bounce{
  0%, 100% { -webkit-transform: scale(0.0) }
  50% { -webkit-transform: scale(1.0) }
}
@keyframes bounce{
  0%, 100% {
    transform: scale(0.0);
    -webkit-transform: scale(0.0);
  } 
  50% {
    transform: scale(1.0);
    -webkit-transform: scale(1.0);
  }
}
</style>
</head>
<body>
<div class="spinner">
  <div class="double-bounce1"></div>
  <div class="double-bounce2"></div>
</div>
</body>
</html>

相關文章