Css-animation-flash

提供:Dev Guides
移動先:案内検索

CSS-フラッシュ効果

説明

要素の明るい光の突然の短いバースト。

構文

@keyframes flash {
   0%, 50%, 100% {
      opacity: 1;
   }
   25%, 75% {
      opacity: 0;
   }
}

パラメータ

  • Opacity -不透明度は要素に適用され、半透明になります。

<html>
   <head>
      <style>
         .animated {
            background-image: url(/css/images/logo.png);
            background-repeat: no-repeat;
            background-position: left top;
            padding-top:95px;
            margin-bottom:60px;
            -webkit-animation-duration: 1s;
            animation-duration: 1s;
            -webkit-animation-fill-mode: both;
            animation-fill-mode: both;
         }

         @keyframes flash {
            0%, 50%, 100% {
               opacity: 1;
            }
            25%, 75% {
               opacity: 0;
            }
         }

         .flash {
            animation-name: flash;
         }
      </style>
   </head>

   <body>

      <div id = "animated-example" class = "animated flash"></div>
      <button onclick = "myFunction()">Reload page</button>

      <script>
         function myFunction() {
            location.reload();
         }
      </script>

   </body>
</html>

それは次の結果を生成します-