CSS 闪光特效
描述
元素突然出现的明亮闪光效果。
语法
@keyframes flash {
   0%, 50%, 100% {
      opacity: 1;
   }
   25%, 75% {
      opacity: 0;
   }
}
参数
- opacity - 不透明度应用于元素以使其半透明。
 
示例
<html>
   <head>
      <style>
         .animated {
            background-image: url(https://geek-docs.com/static/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>
它将产生以下结果−
极客教程