利用@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(/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) } }