纯css实现一个右边滑出,挥手n次的css动画
侧边栏壁纸
  • 累计撰写 108 篇文章
  • 累计收到 220 条评论
Web

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

moxiaonai
2021-12-02 / 0 评论 / 443 阅读 / 正在检测是否收录...

效果如下:

直接见代码:

 <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;
}
0

评论 (0)

取消