css布局实现三维立体多彩箱子打开跳动动画效果代码

代码语言:html

所属分类:动画

代码描述:css布局实现一排三维立体多彩箱子依次打开后跳动循环动画效果代码

代码标签: css 三维 箱子 跳跃 动画

下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开

<!DOCTYPE html>

<html lang="en">

<head>

    <meta charset="UTF-8">




    <style>
        *, *::before, *::after {
          padding: 0;
          margin: 0 auto;
          box-sizing: border-box;
        }
        
        body {
          background-color: #000;
          min-height: 100vh;
          display: grid;
          place-items: center;
          perspective: 1000px;
          font-size: 50px;
          overflow: hidden;
        }
        body *:not(:empty) {
          transform-style: preserve-3d;
        }
        
        .matryoshBox {
          position: relative;
          transform: translateX(-3.5em) rotateX(60deg) rotateZ(60deg);
        }
        .matryoshBox .box {
          position: absolute;
          left: 0;
          width: 1em;
          height: 1em;
          -webkit-animation: boxMove 20s var(--delay) infinite linear;
                  animation: boxMove 20s var(--delay) infinite linear;
        }
        @-webkit-keyframes boxMove {
          0% {
            transform: translate(-50%, calc(-50% + 0em)) scale(0.75);
          }
          10% {
            transform: translate(-50%, calc(-50% - 2em)) scale(0.75);
          }
          20% {
            transform: translate(-50%, calc(-50% + 0em)) scale(1);
          }
          100% {
            transform: translate(-50%, calc(-50% - 16em)) scale(1);
          }
        }
        @keyframes boxMove {
          0% {
            transform: translate(-50%, calc(-50% + 0em)) scale(0.75);
          }
          10% {
            transform: translate(-50%, calc(-50% - 2em)) scale(0.75);
          }
          20% {
            transform: translate(-50%, calc(-50% + 0em)) scale(1);
          }
          100% {
            transform: translate(-50%, calc(-50% - 16em)) scale(1);
          }
        }
        .matryoshBox .box:nth-child(1) {
          --color: #ffa602;
          --delay: 0s;
        }
        .matryoshBox .box:nth-child(2) {
          --color: #ff6362;
          --delay: -4s;
        }
        .matryoshBox .box:nth-child(3) {
          --color: #bc5090;
          --delay: -8s;
        }
        .matryoshBox .box:nth-child(4) {
          --color: #58508d;
          --delay: -12s;
        }
        .matryoshBox .box:nth-child(5) {
          --color: #00405c;
          --delay: -16s;
        }
 .........完整代码请登录后点击上方下载按钮下载查看

网友评论0