H5 实现一个正方体旋转

html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Titletitle>
    <style>
        ul{
            position: relative;
            width: 200px;
            height: 200px;
            transform-style: preserve-3d;
            margin: 250px auto;
            animation: run 5s infinite linear;
        }
        li{
            list-style: none;
            width:200px;
            height: 200px;
            position: absolute;
            left: 0;
            top: 0;
            opacity: 0.4;
        }
        li:first-child{
            background: red;
            transform: translateZ(100px)
        }
        li:nth-child(2){
            background: green;
            transform: translateY(-100px) rotateX(90deg);
        }
        li:nth-child(3){
            background: pink;
            transform: translateY(100px) rotateX(90deg);
        }
        li:nth-child(4){
            background: orange;
            transform: translateX(-100px) rotateY(90deg);
        }
        li:nth-child(5){
            background: blue;
            transform: translateX(100px) rotateY(90deg);
        }
        li:nth-child(6){
            background: blue;
            transform: translateZ(-100px);
        }
        @keyframes run {
            0%{
                transform:rotateX(0deg) rotateY(0deg);
            }
            100%{
                transform:rotateX(360deg) rotateY(360deg);
            }
        }
    style>
head>
<body>
    <ul>
        <li>1li>
        <li>2li>
        <li>3li>
        <li>4li>
        <li>5li>
        <li>6li>
    ul>

body>
html>

你可能感兴趣的:(H5 实现一个正方体旋转)