DIV CSS 佈局教程網

 DIV+CSS佈局教程網 >> 網頁腳本 >> HTML基礎知識 >> HTML5詳解 >> css3小萌物彈跳跳效果
css3小萌物彈跳跳效果
編輯:HTML5詳解     

利用@keyframes設置了高度、scaleX和scaleY之間的相關度,增強了反彈真實效果。

Html

<div class="ball"></div>

CSS

body {
  background: #fff;
}

.ball {
  position: absolute;
  top: 0;
  left: 50%;
  z-index: 11;
  margin: 0 0 0 -8px;
  width: 200px;
  height: 130px;
  border-radius: 50%;
  background: url(/School/UploadFiles_7810/201603/20160313141641745.gif?1) #57abdb;
  animation: jump 4s infinite forwards;
}

@keyframes jump {
  0%, 
  100% { top: 0%;     transform: scaleX(1.1) scaleY(0.9); animation-timing-function: ease-in }
  40%  { top: 80%; transform: scaleX(1)  scaleY(1)}
  55%  { top: 90%; transform: scaleX(1.8) scaleY(0.2); animation-timing-function: ease-in-out  }
  65%  { top: 30%; transform: scaleX(.6)  scaleY(1.4); animation-timing-function: ease-out }
  80%  {             transform: scaleX(1)   scaleY(1) }
}
XML學習教程| jQuery入門知識| AJAX入門| Dreamweaver教程| Fireworks入門知識| SEO技巧| SEO優化集錦|
Copyright © DIV+CSS佈局教程網 All Rights Reserved