用3D写书页样式

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <style>
      body {
        perspective: 1000px;
      }
      .main {
        width: 300px;
        height: 400px;
        border: 1px solid red;
        margin: 100px auto;
        transform-style: preserve-3d;
        position: relative;
        animation: rotateAni 4s linear infinite ;
        animation-fill-mode: both;
      }
      .main > div {
        width: 100%;
        height: 100%;
        position: absolute;
        transform-origin: 0% 0%;
     
      }
      .one {
        background-color: pink;
        animation: onea 2s linear;
        animation-fill-mode: both;
      }
      .two {
        background-color: orange;
        animation: twoa 2s linear;
        animation-fill-mode: both;
      }
      .three {
        background-color: red;
        animation: threea 2s linear;
        animation-fill-mode: both;
      }
      .four {
        background-color: yellow;
        animation: foura 2s linear;
        animation-fill-mode: both;
      }
      .five {
        background-color: green;
        animation: fivea 2s linear;
        animation-fill-mode: both;
      }
      /* @keyframes rotateAni {
        0% {
          transform: rotateY(0deg);
        }
        100% {
          transform: rotateY(-360deg);
        }
      } */
      @keyframes onea {
        0% {
          transform: rotateY(0deg);
        }
        100% {
          transform: rotateY(-120deg);
        }
      }
      @keyframes twoa {
        0% {
          transform: rotateY(0deg);
        }
        100% {
          transform: rotateY(-90deg);
        }
      }
      @keyframes threea {
        0% {
          transform: rotateY(0deg);
        }
        100% {
          transform: rotateY(-60deg);
        }
      }
      @keyframes foura {
        0% {
          transform: rotateY(0deg);
        }
        100% {
          transform: rotateY(-45deg);
        }
      }
      @keyframes fivea {
        0% {
          transform: rotateY(0deg);
        }
        100% {
          transform: rotateY(-30deg);
        }
      }
    </style>
  </head>
  <body>
    <div class="main">
      <div class="one">
          <h1>3D 效果</h1>
      </div>
      <div class="two">简述</div>
      <div class="three">左左</div>
      <div class="four">悠悠</div>
      <div class="five">上上</div>
    </div>
  </body>
</html>
posted @ 2020-11-05 22:06  阳菜  阅读(106)  评论(0)    收藏  举报