×

CSS3转动的三围正方体

作者:andy0012018.11.26来源:Web前端之家浏览:409评论: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人参与

发表评论:

最新留言

  • admin

    是的,新版也是不错的。...

  • Qanmy

    火狐56版本最经典。。。...

  • 前端大爆炸

    交换一下链接前端大爆炸!-WEBBANG!BANG!!BANG!!!https://a...

  • Wreb

    加群讨论...

  • 访客

    非常感谢...

  • 访客

    那如果自定义转发的图片未生成完,他给我转发的是默认截屏怎么办...

  • 男装品牌

    文章不错支持一下...

  • 女装品牌

    文章不错非常喜欢...

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

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

Copyright Your WebSite.Some Rights Reserved.

Powered By Z-BlogPHP 1.5.2 Zero