ホームページ  >  記事  >  ウェブフロントエンド  >  CSS を使用してアニメーションの再生時間を設定する

CSS を使用してアニメーションの再生時間を設定する

WBOY
WBOY転載
2023-09-10 08:53:07981ブラウズ

使用 CSS 设置动画播放次数

animation-iteration-count プロパティを使用して、CSS 経由でアニメーションを再生する回数を設定します。

Example

ライブ デモンストレーション

#
<!DOCTYPE html>
<html>
   <head>
      <style>
         div {
            width: 150px;
            height: 200px;
            position: relative;
            background-color: yellow;
            animation-name: myanim;
            animation-duration: 2s;
            animation-direction: alternate-reverse;
            animation-iteration-count: 3;
         }
         @keyframes myanim {
            from {left: 100px;}
            to {left: 200px;}
         }
         #demo1 {animation-timing-function: ease;}
         #demo2 {animation-timing-function: ease-in;}
      </style>
   </head>
   <body>
      <div id = "demo1">ease effect</div>
      <div id = "demo2">ease-in effect</div>
   </body>
</html>

以上がCSS を使用してアニメーションの再生時間を設定するの詳細内容です。詳細については、PHP 中国語 Web サイトの他の関連記事を参照してください。

声明:
この記事はtutorialspoint.comで複製されています。侵害がある場合は、admin@php.cn までご連絡ください。