使用 CSS 設定緩慢開始和結束的動畫


使用具有 緩入緩出 值的動畫時間功能屬性,使用 CSS 設定動畫,使其緩慢開始並結束

例項

線上演示

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

更新於: 2020 年 6 月 24 日

269 次瀏覽

啟動您的 職業生涯

透過完成本課程獲得認證

開始
廣告
© . All rights reserved.