CSS glatte bounce-animation

Ich brauchte, um zu realisieren unendliche bounce-Effekt mit reinem CSS, also bezog ich mich diese Website und endete damit, dass diese.

CSS:

.animated {
  -webkit-animation-duration: 2.5s;
  animation-duration: 2.5s;
  -webkit-animation-fill-mode: both;
  animation-fill-mode: both;
  -webkit-animation-timing-function: linear;
  animation-timing-function: linear;
  animation-iteration-count: infinite;
  -webkit-animation-iteration-count: infinite;
} 

@-webkit-keyframes bounce {
  0%, 20%, 40%, 60%, 80%, 100% { -webkit-transform: translateY(0);}
  50% { -webkit-transform: translateY(-5px);}
} 

@keyframes bounce { 
  0%, 20%, 40%, 60%, 80%, 100% {transform: translateY(0);}
  50% {transform: translateY(-5px);}
} 

.bounce { 
  -webkit-animation-name: bounce;
  animation-name: bounce;
}

#animated-example {
    width: 20px;
    height: 20px;
    background-color: red;
    position: relative;
    top: 100px;
    left: 100px;
    border-radius: 50%;
}

hr {
    position: relative;
    top: 92px;
    left: -300px;
    width: 200px;
}

HTML:

<div id="animated-example" class="animated bounce"></div>
<hr>

Nun, mein problem ist nur das bouncing-element nimmt eine längere Pause, bevor es beginnt Prellen wieder. Wie kann ich machen, hüpfen reibungslos, genau wie die bounce-Effekt wir durch den Einsatz jQuery.animate?

InformationsquelleAutor Abhi | 2015-08-31
Schreibe einen Kommentar