Maison  >  Article  >  interface Web  >  Définir si l'animation est lue vers l'avant ou utiliser CSS

Définir si l'animation est lue vers l'avant ou utiliser CSS

WBOY
WBOYavant
2023-09-20 18:53:02641parcourir

设置动画是向前播放还是使用 CSS

Utilisez l'attribut animation-direction pour définir si l'animation est lue en avant, en arrière ou en boucle alternativement :

Exemple

Démonstration en temps réel

<!DOCTYPE html>
<html>
   <head>
      <style>
         div {
            width: 150px;
            height: 200px;
            background-color: yellow;
            animation-name: myanim;
            animation-duration: 2s;
            animation-direction: reverse;
         }
         @keyframes myanim {
            from {
               background-color: green;
            }
            to {
               background-color: blue;
            }
         }
      </style>
   </head>
   <body>
      <div></div>
   </body>
</html>

Ce qui précède est le contenu détaillé de. pour plus d'informations, suivez d'autres articles connexes sur le site Web de PHP en chinois!

Déclaration:
Cet article est reproduit dans:. en cas de violation, veuillez contacter admin@php.cn Supprimer