css 闪光效果 - 在标题等中使用闪光级别

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了css 闪光效果 - 在标题等中使用闪光级别相关的知识,希望对你有一定的参考价值。

@import url('http://fonts.googleapis.com/css?family=Alegreya+Sans:300');
body{
    background: #000;
}
.shimmer{
    /* styling stuff */
    font-family:"Alegreya Sans";
    font-weight:300;
    font-size:3em;
    margin:0 auto;
    padding: 0 40px;
    text-align: center;
    color: rgba(255,255,255,0.1);
}
.shimmer {
  /* the shimmer magic */
  background: -webkit-gradient(linear,left top,right top,from(#222),to(#222),color-stop(.5,#fff));
  background: -moz-gradient(linear,left top,right top,from(#222),to(#222),color-stop(.5,#fff));
  background: gradient(linear,left top,right top,from(#222),to(#222),color-stop(.5,#fff));
  -webkit-background-size: 125px 100%;
  -moz-background-size: 125px 100%;
  background-size: 125px 100%;
  -webkit-background-clip: text;
  -moz-background-clip: text;
  background-clip: text;
  -webkit-animation-name: shimmer;
  -moz-animation-name: shimmer;
  -webkit-animation-name: shimmer;
  animation-name: shimmer;
  -webkit-animation-duration: 2s;
  -moz-animation-duration: 2s;
  -webkit-animation-duration: 2s;
  animation-duration: 2s;
  -webkit-animation-iteration-count: infinite;
  -moz-animation-iteration-count: infinite;
  -webkit-animation-iteration-count: infinite;
  animation-iteration-count: infinite;
  background-repeat: no-repeat;
  background-position: 0 0;
  background-color: #222;
}

@-moz-keyframes shimmer {
  0% {
    background-position: top left;
  }

  100% {
    background-position: top right;
  }
}

@-webkit-keyframes shimmer {
  0% {
    background-position: top left;
  }

  100% {
    background-position: top right;
  }
}

@-o-keyframes shimmer {
  0% {
    background-position: top left;
  }

  100% {
    background-position: top right;
  }
}

@-ms-keyframes shimmer {
  0% {
    background-position: top left;
  }

  100% {
    background-position: top right;
  }
}

@keyframes shimmer {
  0% {
    background-position: top left;
  }

  100% {
    background-position: top right;
  }
}

以上是关于css 闪光效果 - 在标题等中使用闪光级别的主要内容,如果未能解决你的问题,请参考以下文章

颜色的“闪光”,使用纯​​ css 过渡

闪光效果不适用于高度 wrap_content

安卓开发打造闪光控件效果

flutter闪屏过渡动画,闪光占位动画

Cocos Creator3.x实现拍照闪光灯效果

Cocos Creator3.x实现拍照闪光灯效果