La propriété animation-timing-function en CSS est utilisée pour spécifier comment l'animation effectue les transitions par le biais des images clés.
En d'autres termes, elle est utilisée pour déterminer le mouvement de l'animation pendant les transitions.
animation-timing-function: linear|ease|ease-in|ease-out|ease-in-out|step-start|step-end|steps(int,start|end)|cubic-bezier(n,n,n,n)|initial|inherit;
Valeurs par défaut | ease |
---|---|
Inherited: | non |
Animable : | non En savoir plus sur l'animable |
Version: | CSS3 |
Syntaxe JavaScript: | object.style.animationTimingFunction="linear" |
Explorateur | ![]() | ![]() | ![]() | ![]() | ![]() | |
---|---|---|---|---|---|---|
Verssion | 43 4 -webkit- | 10 | 16 5 -moz- | 9 4 -webkit- | 30 15 -webkit- 12 -o- |
Exemple Copier le code
<!DOCTYPE html> <html lang="fr"> <head> <meta charset="UTF-8"> <title> CSS propriété animation-timing-function </title> <style> div { width: 100px; height: 100px; background: red; border-radius:50%; position: relative; animation: mymove 5s infinite; animation-timing-function: linear; } @keyframes mymove { from {left: 0px;} to {left: 400px;} } </style> </head> <body> <h1>oujood.com </h1> <h2> La propriété css animation-timing-function </h2> <div></div> </body> </html>
Exemple Copier le code
<!DOCTYPE html> <html lang="fr"> <head> <meta charset="UTF-8"> <title> CSS propriété animation-timing-function </title> <style> div { width: 80px; height: 80px; background: red; border-radius: 50%; position: relative; animation: monAnimation 2s infinite; } @keyframes monAnimation { from {left: 0px;} to {left: 400px;} } </style> </head> <body> <h1>Modifier le timing de l'animation avec JavaScript</h1> <p>Cliquez sur le bouton "CHANGER" pour modifier le timing de l'animation :</p> <button onclick="maFonction()"> CHANGER </button> <script> function maFonction() { document.getElementById("monDiv").style.animationTimingFunction = "linear"; } </script> <div id="monDiv"></div> </body> </html>
Exemple Copier le code
<!DOCTYPE html> <html lang="fr"> <head> <meta charset="UTF-8"> <title> CSS propriété animation-timing-function </title> <style> div { width: 100px; height: 100px; border-radius:50%; text-align:center; background: #85c5d9; font-weight: bold; position: relative; animation: monAnimation 5s infinite; } #div1 {animation-timing-function: linear;} #div2 {animation-timing-function: ease;} #div3 {animation-timing-function: ease-in;} #div4 {animation-timing-function: ease-out;} #div5 {animation-timing-function: ease-in-out;} @keyframes monAnimation { from {left: 0px;} to {left: 500px;} } </style> </head> <body> <h1> Éléments ayant une fonction de synchronisation avec différentes Valeurs </h1> <div id="div1"> <br>linear </div> <div id="div2"><br>ease</div> <div id="div3"><br>ease-in</div> <div id="div4"><br>ease-out</div> <div id="div5"><br>ease-in-out</div> </body> </html>
Livre numérique court pour comprendre la méthode secrète permettant d'obtenir des likes sans fin sur Facebook.
GAGNER DE L'ARGENT