×

CSS3转动的三围正方体

作者:andy0012018.11.26来源:Web前端之家浏览:2235评论:0
关键词:CSS3
微信公众号

微信公众号

CSS3转动的三围正方体。

<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
     <style>
         .box {
            height: 250px;
            width:250px;
            border:brown solid 1px;
            margin:100px auto; 
            position: relative;
            /* 将平面的变的有立体感 */
            transform-style: preserve-3d;
            /* 过渡效果 */
            transition: all 1s;
            /* 使用动画*/
            animation: move 5s infinite;

         }
         .box div {
            height: 100%;
            width:100%;
            position: absolute;
            top:0px;
            left:0px;
         }

         .top {

             transform:rotateX(90deg) translateZ(125px);
             background: url(./1.jpg);
         }
         .before {
             transform: rotateX(180deg) translateZ(125px);
             background: url(./2.jpg);
         }
         .bottom {
             transform: rotateX(270deg) translateZ(125px);
             background: url(./3.jpg);
         }
         .left {
             transform: rotateY(90deg) translateZ(125px);
             background: url(./4.jpg);
         }
         .right {
            transform: rotateY(270deg) translateZ(125px);
            background: url(./5.jpg);
         }
         .after {
            transform:translateZ(125px);
            background: url(./6.jpg);
         }
         /* 设置动画 --此处相当于定义动画*/
         @keyframes move {
             0% {
                 transform: rotateX(0deg) rotateY(0deg) rotateZ(0deg);
             }
             20% {
                transform: rotateX(90deg) rotateY(90deg) rotateZ(90deg);
             }
             40% {
                transform: rotateX(180deg) rotateY(180deg) rotateZ(180deg);
             }
             60% {
                transform: rotateX(90deg) rotateY(90deg) rotateZ(90deg);
             }
             80% {
                transform: rotateX(0deg) rotateY(0deg) rotateZ(0deg); 
             }
             100% {
                transform: rotateX(-90deg) rotateY(-90deg) rotateZ(-90deg);
             }
         }
     </style>
</head>
<body>
    <div class="box">
        <!-- 上面 -->
        <div class="top"> </div>
        <!-- 下面 -->
        <div class="bottom"></div>
        <!-- 前面 -->
        <div class="after"></div>
        <!-- 后面 -->
        <div class="before"></div>
        <!-- 左面 -->
        <div class="left"></div>
        <!-- 右面 -->
        <div class="right"> </div>
    </div>
</body>
</html>


温馨提示:本文作者系 ,经Web前端之家编辑修改或补充,转载请注明出处和本文链接:
https://www.jiangweishan.com/article/css3htjksdjfksj.html

网友评论文明上网理性发言 已有0人参与

发表评论:

最新留言

  • www.micai18.com

    写的很详细...

  • 子午物联网

    这个博客,由衷的喜欢...

  • 访客

    文章不错,非常喜欢...

  • cnwebe

    新媒体运营交换友情链接https://www.cnwebe.com换吗...

  • admin

    请加上链接...

  • admin

    已加上...

  • 物联网应用

    交换个链接如何?物联网应用www.ziwuiot.com...

  • zzzmh

    你好自己写的个人技术博客https://zzzmh.cn麻烦友链申请...

首页|JavaScript|HTML|HTML4|HTML5|CSS3|开发工具|性能优化|移动开发|前端教程|性能优化|开发工具|酷站欣赏|UI设计|前端教程

Copyright © 2019 Web前端之家(www.jiangweishan.com) 版权所有 All Rights Reserved.
粤ICP备12067512号-1

Copyright Your WebSite.Some Rights Reserved.

Powered By Z-BlogPHP 1.5.2 Zero