纯css实现一个右边滑出,挥手n次的css动画


效果如下:

直接见代码:

 <div class="box">
      box body
      <div class="img"></div>
  </div>
@keyframes leftIn {
  0% {
    right: -100px;
  }

  100% {
    right: 0;
  }
}
@keyframes handShake {
  0% {
    transform: rotate(0deg);
  }

  14.3% {
    transform: rotate(-9deg);
  }

  25.7% {
    transform: rotate(-1deg);
  }

  34.3% {
    transform: rotate(-10deg);
  }

  42.9% {
    transform: rotate(0deg);
  }

  100% {
    transform: rotate(0deg);
  }
}

.box {
  width: 300px;
  height: 300px;
  border: 1px solid red;
  margin: 0 auto;
  margin-top: 50px;
  position: relative;
}

.img {
  position: absolute;
  right: -20px;
  bottom: 100px;
  width: 0;
  height: 0;
  height: auto;
  border-top: 50px solid transparent;
  border-bottom: 50px solid transparent;
  border-left: 100px solid red;
  transform-origin: 100px 50px;
  animation-name: leftIn, handShake;
  animation-duration: .8s, 1.6s;
  animation-timing-function: ease-in-out, ease-in-out;
  animation-delay: 1s, 2s;
  animation-iteration-count: 1, 8;
  animation-fill-mode: both, both;
}

声明:A Maverick Pig -|版权所有,违者必究|如未注明,均为原创|本网站采用BY-NC-SA协议进行授权

转载:转载请注明原文链接 - 纯css实现一个右边滑出,挥手n次的css动画


Stay hungry, Stay foolish.