前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >3d魔方动画

3d魔方动画

作者头像
河湾欢儿
发布2018-09-06 17:11:13
5340
发布2018-09-06 17:11:13
举报
代码语言:javascript
复制
<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title></title>
    <style>
        .parent{
            width: 100px;
            height: 100px;
            border: 10px solid black;
            padding: 100px;
            margin: 30px auto;
        }
        .son{
            position: relative;
            width: 100px;
            height: 100px;
            transition: 1s;
            transform-style: preserve-3d;
            perspective:500px;
            transform-origin: center center 50px;
            animation: 1s move6 5s both linear  infinite;
        }
        .son div{
            position: absolute;
            width: 100px;
            height: 100px;
        }
        .son div:nth-child(1){
           animation: 1s move1 both;
        }
        .son div:nth-child(2){
            animation: 1s move2 1s both;
        }
        .son div:nth-child(3){
            animation: 1s move3 2s both;
        }
        .son div:nth-child(4){
            animation: 1s move4 3s both;
        }
        .son div:nth-child(5){
            animation: 1s move5 4s both;
        }
        .son div:nth-child(6){
            background: yellow;
        }
        @keyframes move1 {
            100%{
                position: absolute;
                top: -100px;
                width: 100px;
                height: 100px;
                background: magenta;

                transform-origin: bottom;
                transform: rotateX(-90deg);
            }
        }
        @keyframes move2 {
            100%{
                position: absolute;
                left: -100px;
                width: 100px;
                height: 100px;
                background: greenyellow;
                transform-origin: right;
                transform: rotateY(90deg);
            }
        }
        @keyframes move3 {
            100%{
                position: absolute;
                top: 100px;
                width: 100px;
                height: 100px;
                background: lemonchiffon;
                transform-origin: top;
                transform: rotateX(90deg);
            }
        }
        @keyframes move4 {
            100%{
                position: absolute;
                left: 100px;
                width: 100px;
                height: 100px;
                background: mediumblue;
                transform-origin: left;
                transform: rotateY(-90deg);
            }
        }
        @keyframes move5 {
            100%{
                position: absolute;
                width: 100px;
                height: 100px;
                background: lightcoral;
                transform: translateZ(100px);
            }
        }
        @keyframes move6 {
            100%{
                transform: rotateX(360deg) rotateY(360deg);
            }
        }
    </style>
</head>
<body>
<div class="parent">
    <div class="son">
        <div>1</div>
        <div>2</div>
        <div>3</div>
        <div>4</div>
        <div>5</div>
        <div>6</div>
    </div>
</div>
</body>
</html>
本文参与 腾讯云自媒体分享计划,分享自作者个人站点/博客。
原始发表:2017.04.20 ,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档