0
Wenn ich die Kraft der Geschwindigkeit kenne. Ich möchte alle meine CSS3-Animation in meinen Apps mit Velocity konvertieren. Und jetzt habe ich Probleme mit der Schrittanimation.Schritt-Animation arbeitet nicht mit Geschwindigkeitsfortschritt
Dies ist das Snippet
$el = $(".velocity-animation");
$el.velocity({
\t paddingLeft : "0"
}, {
\t \t duration: 3000,
easing : "ease",
\t progress: function(elements, complete) {
\t var step = complete * 100 ;
\t if(step <= 50){
\t \t $el.velocity({
\t paddingLeft : "50px"
})
} else if(step <= 70){
\t $el.velocity({
\t paddingLeft : "0px"
})
} else if(step <= 100){
\t $el.velocity({
\t paddingLeft : "300px"
})
}
}
})
.css-animation, .velocity-animation {
background : red;
}
.css-animation {
animation : 3s move;
}
@keyframes move {
0% {
padding-left:0;
}
50% {
padding-left:50px;
}
70% {
padding-left:0;
}
100% {
padding-left:300px;
}
}
<div class="css-animation">
Animate it
</div>
<div class="velocity-animation">
Animate It
</div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/velocity/1.4.1/velocity.min.js"></script>
Und hier ist die Geige https://jsfiddle.net/nLx3z32z/
Wenn Sie die Geschwindigkeit möchten Sie vielleicht ändern, um eine Beschleunigungsfunktion verwenden ?: http://cubic-bezier.com/#.17,.67,.83 ,. 67 –
Mehr als das, ich möchte Geschwindigkeit Run Step Animation, wie css3 tut. (auf 30%, 70%, 100%) –