zoukankan      html  css  js  c++  java
  • css3实现立方体效果

    <!DOCTYPE html>
    <html>
    <head>
    <meta charset="utf-8" />
    <title></title>
    <style>
    @keyframes spin {from { transform: rotateY(0); }to { transform: rotateY(-360deg); }}
    @keyframes spin-vertical {from { transform: rotateX(0); }to { transform: rotateX(360deg); }}
    /*************** 水平立方体 **************-moz-animation: spin 20s infinite linear;*/
    .cube-wrap {perspective: 800px;perspective-origin: -50% -100px;float:left;margin:150px 0 0 200px;}
    .cube {position: relative; 200px;-moz-transform-style: preserve-3d;}
    .cube div{position: absolute; 200px;height: 200px;background: rgba(255,255,255,0.1);box-shadow: inset 0 0 30px rgba(125,125,125,0.8);text-align: center;line-height: 200px;font-weight:bold;text-shadow:-1px 1px 5px #f60;color:#fff;font-family: sans-serif;text-transform: uppercase;font-size:30px;}
    .depth div.back-pane {transform: translateZ(-100px) rotateY(180deg);}
    .depth div.right-pane {transform:rotateY(-270deg) translateX(100px);transform-origin: top right;}
    .depth div.left-pane {transform:rotateY(270deg) translateX(-100px);transform-origin: center left;}
    .depth div.top-pane {transform:rotateX(-90deg) translateY(-100px);transform-origin: top center;}
    .depth div.bottom-pane {transform:rotateX(90deg) translateY(100px);transform-origin: bottom center;}
    .depth div.front-pane {transform: translateZ(100px);}
    /*************** 垂直旋转的立方体 ***************/
    .cube-wrap.vertical .cube {transform-origin: 0 100px;animation: spin-vertical 5s infinite linear;}
    .cube-wrap.vertical .depth div.top-pane {transform:rotateX(-270deg) translateY(-100px);}
    .cube-wrap.vertical .depth div.back-pane {transform: translateZ(-100px) rotateX(180deg);}
    .cube-wrap.vertical .depth div.bottom-pane {transform: rotateX(-90deg) translateY(100px);}
    /*************** 平面旋转的立方体 ***************/
    .cube-wrap.flat {perspective: none;perspective-origin: 0 0;}
    </style>

    </head>

    <body>
    <div class="cube-wrap">
    <div class="cube depth">
    <div class="front-pane">front</div>
    <div class="back-pane">back</div>
    <div class="top-pane">top</div>
    <div class="bottom-pane">bottom</div>
    <div class="left-pane">left</div>
    <div class="right-pane">right</div>
    </div>
    </div>
    <div class="cube-wrap vertical">
    <div class="cube depth">
    <div class="front-pane">front</div>
    <div class="back-pane">back</div>
    <div class="top-pane">top</div>
    <div class="bottom-pane">bottom</div>
    <div class="left-pane">left</div>
    <div class="right-pane">right</div>
    </div>
    </div>
    <div class="cube-wrap flat">
    <div class="cube depth">
    <div class="front-pane">front</div>
    <div class="back-pane">back</div>
    <div class="top-pane">top</div>
    <div class="bottom-pane">bottom</div>
    <div class="left-pane">left</div>
    <div class="right-pane">right</div>
    </div>
    </div>
    </body>
    </html>

  • 相关阅读:
    修改Anaconda中Jupyter Notebook默认工作路径
    npm卸载和安装淘宝镜像原
    hash和history两种模式的区别
    威胁建模之WEB应用自动化截图
    Ubuntu系统清理
    Ubuntu环境的docker实践——ONOS
    BUUCTF-crypto:信息化时代的步伐
    BUUCTF-crypto:四面八方
    BUUCTF-crypto:[HDCTF2019]basic rsa
    BUUCTF-crypto:rsarsa
  • 原文地址:https://www.cnblogs.com/dearxinli/p/3806231.html
Copyright © 2011-2022 走看看