Home  >  Article  >  Web Front-end  >  css3, you can add multiple animations to one element_html/css_WEB-ITnose

css3, you can add multiple animations to one element_html/css_WEB-ITnose

WBOY
WBOYOriginal
2016-06-24 11:38:441684browse

例如:

.screen3.on .text5 {

  animation: 1.4s 3s ease-out forwards show, 1.6s 4.4s ease forwards text5, 1.2s 6s linear infinite wobble;
  -webkit-animation: 1.4s 3s ease-out forwards show, 1.6s 4.4s ease forwards text5, 1.2s 6s linear infinite wobble;

}

@keyframes show {
  0% {
    opacity: 0;
  }
  100% {
    opacity: 1;
  }
}
@-webkit-keyframes show {
  0% {
    opacity: 0;
  }
  100% {
    opacity: 1;
  }
}

@keyframes text5 {
  0% {
    transform: scale(0.8);
  }
  50% {
    transform: scale(1.2);
  }
  100% {
    transform: scale(0.8);
  }
}


@keyframes wobble {
  0% {
    transform: translateX(0) rotate(0) scale(0.8);
  }
  15% {
    transform: translateX(-2px) rotate(-1deg) scale(0.8);
  }
  30% {
    transform: translateX(2px) rotate(1deg) scale(0.8);
  }
  45% {
    transform: translateX(-2px) rotate(-1deg) scale(0.8);
  }
  60% {
    transform: translateX(2px) rotate(1deg) scale(0.8);
  }
  75% {
    transform: translateX(-2px) rotate(-1deg) scale(0.8);
  }
  100% {
    transform: translateX(0px) rotate(0) scale(0.8);
  }
}
@-webkit-keyframes wobble {
  0% {
    -webkit-transform: translateX(0) rotate(0) scale(0.8);
  }
  15% {
    -webkit-transform: translateX(-2px) rotate(-1deg) scale(0.8);
  }
  30% {
    -webkit-transform: translateX(2px) rotate(1deg) scale(0.8);
  }
  45% {
    -webkit-transform: translateX(-2px) rotate(-1deg) scale(0.8);
  }
  60% {
    -webkit-transform: translateX(2px) rotate(1deg) scale(0.8);
  }
  75% {
    -webkit-transform: translateX(-2px) rotate(-1deg) scale(0.8);
  }
  100% {
    -webkit-transform: translateX(0px) rotate(0) scale(0.8);
  }
}
@-webkit-keyframes text5 {
  0% {
    -webkit-transform: scale(0.8);
  }
  50% {
    -webkit-transform: scale(1.2);
  }
  100% {
    -webkit-transform: scale(0.8);
  }
}

不过动画播放的时间点要错开。

版权声明:本文为博主原创文章,未经博主允许不得转载。

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn