动画背景

by jkhaoqi110

HTML

<div class="bg-block bg-rainbow-anim"></div>
<div class="bg-block bg-gradient-purple-anim"></div>

CSS

.bg-block {
  width: 200px;
  height: 100px;
  display: block;
}

.bg-rainbow-anim {
  background: linear-gradient(277deg, #fffde5, #e9ffda, #dffbff, #ecefff, #f6e1ff, #ffe5f0);
  background-size: 1200% 1200%;
  -webkit-animation: AnimationName 10s ease infinite;
  -moz-animation: AnimationName 10s ease infinite;
  animation: AnimationName 10s ease infinite
}

.bg-gradient-purple-anim {
  background: linear-gradient(214deg, #6e5494, #a896c3, #6d49a1);
  background-size: 600% 600%;
  -webkit-animation: AnimationName 5s ease infinite;
  -moz-animation: AnimationName 5s ease infinite;
  animation: AnimationName 5s ease infinite
}

@-webkit-keyframes AnimationName {
  0% {
    background-position: 83% 0%
  }

  50% {
    background-position: 18% 100%
  }

  100% {
    background-position: 83% 0%
  }
}

@-moz-keyframes AnimationName {
  0% {
    background-position: 83% 0%
  }

  50% {
    background-position: 18% 100%
  }

  100% {
    background-position: 83% 0%
  }
}

@keyframes AnimationName {
  0% {
    background-position: 83% 0%
  }

  50% {
    background-position: 18% 100%
  }

  100% {
    background-position: 83% 0%
  }
}