css3控制图片先旋转120度,再旋转120度,然后就停止旋转

css3控制图片先旋转120度,再旋转120度,然后就停止旋转.

阅读 4.1k
2 个回答

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Document</title>
  <script src="jquery.min.js"></script>
  <style>

    div{
      height: 100px;
      width: 100px;
      background-color: red;
    }
    @keyframes animation {
      40% {
          transform: rotate(120deg);
      }
      60% {
          transform: rotate(120deg);
      }
      100% {
          transform: rotate(240deg);
      }
    }

  .animation {
    animation: animation 2s ease;
    animation-fill-mode : forwards;/*保持结束位置*/
  }
  </style>
</head>
<body>

  <div class="animation">

  </div>

</body>
</html>

可以尝试使用 @keyframes 自定义动画 + animation 来做到。

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题