css3小萌物弹跳跳效果

css3小萌物弹跳跳效果

利用@keyframes设置了高度、scaleX和scaleY之间的相关度,增强了反弹真实效果。 <无>

源码与演示:源码出处 演示出处

<div class="ball"></div>
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(http://i.imgur.com/syIVRUi.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) }
}
css3小萌物弹跳跳效果

相关文章:

你感兴趣的文章:

标签云: