旋转放大动画

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>
    *{
      margin: 0;
      padding: 0;
    }

    body {
      height: 100vh;
      width: 100vw;
      font-size: 0;
      display: grid;
      place-items: center;
      background-color: rgba(0, 255, 0, 0.2);
    }

    div {
      width: 100vw;
      height: 500px;
      border: 2px solid black;
      box-sizing: border-box;
      background-color: rgba(255, 0, 0, 0.2);
      display: grid;
      place-items: center;
    }

    .mix {
      width: 100vh;
      height: 100vw;
      transition: all ease 2s;
      transform-origin: center center;
      transform: rotate(90deg) translateX(calc((100vh - 100vw) / 2));
    }

    .pot {
      display: block;
      width: 10px;
      height: 10px;
      background-color: red;
      border-radius: 50%;
    }
  </style>
</head>
<body>
  <div>
    <div class="pot"></div>
  </div>

  <script>
    window.onload= function(){
      const div = document.getElementsByTagName('div')[0];
      div.addEventListener('click', function(){
        this.classList = 'mix';
      }, false)
    }

  </script>
</body>
</html>


版权声明:本文为qq_33807889原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。