码迷,mamicode.com
首页 > Web开发 > 详细

css3 3d 效果

时间:2015-07-18 18:28:36      阅读:119      评论:0      收藏:0      [点我收藏+]

标签:

1
2
3
4
5
6
7
8
1
2
3
4
5
6
7
8
1
2
3
4
5
6
7
8

 

 

 

 

 

 

 

 

 

$color:red ,yellow ,blue ,green ,gray ,black ,purple ,orange;


@-webkit-keyframes move {
    0% {
        transform: rotateY(0deg);
    }
    100% {
        transform: rotateY(360deg);
    }
}

body {
    padding: 200px;
    @at-root .content {
        width: 500px;
        height: 500px;
        margin: -350px auto;
        border: 1px solid transparent;
        position: relative;
        -webkit-perspective: 500px;
        -webkit-perspective-origin: center 100px;
        @for $i from 1 to 10 {
            &:nth-of-type(#{$i}) {
                z-index: 10 - $i
            }
        }
        .main {
            width: 100px;
            height: 100px;
            margin: 200px auto;
            position: relative;
            transform-style: preserve-3d;
            animation: move 8s linear infinite;
            div {
                width: 100px;
                height: 100px;
                position: absolute;
                bottom: 0;
                font-size: 100px;
                color: white;
                text-align: center;
                line-height: 100px;
                transform-style: preserve-3d;
                @for $i from 1 to 9 {
                    &:nth-of-type(#{$i}) {
                        background: nth($color, $i);
                        transform: rotateY(45deg * $i) translateZ(150px);
                    }
                }
            }
        }
    }
}
<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <title>Examples</title>
    <meta name="description" content="">
    <meta name="keywords" content="">
    <link href="stylesheets/test.css" rel="stylesheet">
</head>

<body>
    <div class="content">
        <div class="main">
            <div>1</div>
            <div>2</div>
            <div>3</div>
            <div>4</div>
            <div>5</div>
            <div>6</div>
            <div>7</div>
            <div>8</div>    
        </div>
    </div>
    <div class="content">
        <div class="main">
            <div>1</div>
            <div>2</div>
            <div>3</div>
            <div>4</div>
            <div>5</div>
            <div>6</div>
            <div>7</div>
            <div>8</div>    
        </div>
    </div>
    <div class="content">
        <div class="main">
            <div>1</div>
            <div>2</div>
            <div>3</div>
            <div>4</div>
            <div>5</div>
            <div>6</div>
            <div>7</div>
            <div>8</div>    
        </div>
    </div>

</body>

</html>

 

css3 3d 效果

标签:

原文地址:http://www.cnblogs.com/liujin0505/p/4657236.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!