按钮闪光动画css html源码

按钮闪光动画css html源码

演示

源码

html

[lv]

<div class="btn-animate btn-animate__shiny">
    QQ资源吧m.qqzy8.com
</div>

[/lv]

css

[lv]

.btn-animate {
  position: relative;
  width: 130px;
  height: 40px;
  line-height: 40px;
  border: none;
  border-radius: 5px;
  background: #027efb;
  color: #fff;
  text-align: center;
}

@keyframes shiny-btn {
  0% {
    transform: scale(0) rotate(45deg);
    opacity: 0;
  }
  10% {
    transform: scale(0) rotate(45deg);
    opacity: 0.5;
  }
  21% {
    transform: scale(4) rotate(45deg);
    opacity: 1;
  }
  100% {
    transform: scale(50) rotate(45deg);
    opacity: 0;
  }
}

.btn-animate__shiny {
  overflow: hidden;

  &::before {
    content: '';
    position: absolute;
    top: -150%;
    left: 0;
    width: 30px;
    height: 100%;
    background-color: #fff;
  }

  &:hover {
    &::before {
      animation: shiny-btn .8s ease-in-out;
    }
  }
}

[/lv]