码迷,mamicode.com
首页 > 其他好文 > 详细

3D旋转相册

时间:2021-04-07 10:49:56      阅读:0      评论:0      收藏:0      [点我收藏+]

标签:转换   baidu   callback   UNC   透明   one   空间   for   ram   

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>12生肖相册</title>
<style>
html{
    background: #000;
    height: 100%;    
}
/*最外层容器样式*/
.wrap{ 
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    width: 400px;
    height: 400px;
    margin: auto;
    /*改变左右上下,图片方块移动*/
    
}
/*包裹所有容器样式*/
.cube{
    width: 400px;
    height: 400px;
    margin: 0 auto;
    /*所有子元素在3D空间中呈现*/
    transform-style: preserve-3d;
    /*Transform属性应用于元素的2D或3D转换。*/
    /*沿着X轴旋转 -30度, 沿着Y轴旋转 -80度*/
    transform: rotateX(-30deg) rotateY(-80deg);
    /*把 animation 绑定到rotate*/
    -webkit-animation: rotate 20s infinite;
    /*匀速*/
    animation-timing-function: linear;
}
/*创建动画是通过逐步改变从一个CSS样式设定到另一个。*/
@-webkit-keyframes rotate{
    from{transform: rotateX(0deg) rotateY(0deg);}
    to{transform: rotateX(360deg) rotateY(360deg);}
}
.cube div{
    position: absolute;
    width: 400px;
    height: 400px;
    opacity: 0.8;  /*指定不透明度。从0.0(完全透明)到1.0(完全不透明)*/
    transition: all 5s;  /*所有属性 过度效果 持续5s*/
}
/*定义所有图片样式*/
.pic{
    width: 400px;
    height: 400px;
}
.cube .out_front{
    transform: rotateY(0deg) translateZ(200px);
}
.cube .out_back{
    transform: translateZ(-200px) rotateY(180deg);
}
.cube .out_left{
    transform: rotateY(90deg) translateZ(200px);
}
.cube .out_right{
    transform: rotateY(-90deg) translateZ(200px);
}
.cube .out_top{
    transform: rotateX(90deg) translateZ(200px);
}
.cube .out_bottom{
    transform: rotateX(-90deg) translateZ(200px);
}
/*定义小正方体样式*/
.cube span{
    display: bloack;
    width: 200px;
    height: 200px;
    position: absolute;
    top: 100px;
    left: 100px;
}
.cube .in_pic{
    width: 200px;
    height: 200px;
}
.cube .in_front{
    transform: rotateY(0deg) translateZ(100px);
}
.cube .in_back{
    transform: translateZ(-100px) rotateY(180deg);
}
.cube .in_left{
    transform: rotateY(90deg) translateZ(100px);
}
.cube .in_right{
    transform: rotateY(-90deg) translateZ(100px);
}
.cube .in_top{
    transform: rotateX(90deg) translateZ(100px);
}
.cube .in_bottom{
    transform: rotateX(-90deg) translateZ(100px);
}
/*鼠标移入后样式*/
.cube:hover .out_front{
    transform: rotateY(0deg) translateZ(400px);
}
.cube:hover .out_back{
    transform: translateZ(-400px) rotateY(180deg);
}
.cube:hover .out_left{
    transform: rotateY(90deg) translateZ(400px);
}
.cube:hover .out_right{
    transform: rotateY(-90deg) translateZ(400px);
}
.cube:hover .out_top{
    transform: rotateX(90deg) translateZ(400px);
}
.cube:hover .out_bottom{
    transform: rotateX(-90deg) translateZ(400px);
html{
    background: #000;
    height: 100%;    
}
/*最外层容器样式*/
.wrap{ 
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    width: 400px;
    height: 400px;
    margin: auto;
    /*改变左右上下,图片方块移动*/
    
}
/*包裹所有容器样式*/
.cube{
    width: 400px;
    height: 400px;
    margin: 0 auto;
    /*所有子元素在3D空间中呈现*/
    transform-style: preserve-3d;
    /*Transform属性应用于元素的2D或3D转换。*/
    /*沿着X轴旋转 -30度, 沿着Y轴旋转 -80度*/
    transform: rotateX(-30deg) rotateY(-80deg);
    /*把 animation 绑定到rotate*/
    -webkit-animation: rotate 20s infinite;
    /*匀速*/
    animation-timing-function: linear;
}
/*创建动画是通过逐步改变从一个CSS样式设定到另一个。*/
@-webkit-keyframes rotate{
    from{transform: rotateX(0deg) rotateY(0deg);}
    to{transform: rotateX(360deg) rotateY(360deg);}
}
.cube div{
    position: absolute;
    width: 400px;
    height: 400px;
    opacity: 0.8;  /*指定不透明度。从0.0(完全透明)到1.0(完全不透明)*/
    transition: all 5s;  /*所有属性 过度效果 持续5s*/
}
/*定义所有图片样式*/
.pic{
    width: 400px;
    height: 400px;
}
.cube .out_front{
    transform: rotateY(0deg) translateZ(200px);
}
.cube .out_back{
    transform: translateZ(-200px) rotateY(180deg);
}
.cube .out_left{
    transform: rotateY(90deg) translateZ(200px);
}
.cube .out_right{
    transform: rotateY(-90deg) translateZ(200px);
}
.cube .out_top{
    transform: rotateX(90deg) translateZ(200px);
}
.cube .out_bottom{
    transform: rotateX(-90deg) translateZ(200px);
}
/*定义小正方体样式*/
.cube span{
    display: bloack;
    width: 200px;
    height: 200px;
    position: absolute;
    top: 100px;
    left: 100px;
}
.cube .in_pic{
    width: 200px;
    height: 200px;
}
.cube .in_front{
    transform: rotateY(0deg) translateZ(100px);
}
.cube .in_back{
    transform: translateZ(-100px) rotateY(180deg);
}
.cube .in_left{
    transform: rotateY(90deg) translateZ(100px);
}
.cube .in_right{
    transform: rotateY(-90deg) translateZ(100px);
}
.cube .in_top{
    transform: rotateX(90deg) translateZ(100px);
}
.cube .in_bottom{
    transform: rotateX(-90deg) translateZ(100px);
}
/*鼠标移入后样式*/
.cube:hover .out_front{
    transform: rotateY(0deg) translateZ(400px);
}
.cube:hover .out_back{
    transform: translateZ(-400px) rotateY(180deg);
}
.cube:hover .out_left{
    transform: rotateY(90deg) translateZ(400px);
}
.cube:hover .out_right{
    transform: rotateY(-90deg) translateZ(400px);
}
.cube:hover .out_top{
    transform: rotateX(90deg) translateZ(400px);
}
.cube:hover .out_bottom{
    transform: rotateX(-90deg) translateZ(400px);
html{
    background: #000;
    height: 100%;    
}
/*最外层容器样式*/
.wrap{ 
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    width: 400px;
    height: 400px;
    margin: auto;
    /*改变左右上下,图片方块移动*/
    
}
/*包裹所有容器样式*/
.cube{
    width: 400px;
    height: 400px;
    margin: 0 auto;
    /*所有子元素在3D空间中呈现*/
    transform-style: preserve-3d;
    /*Transform属性应用于元素的2D或3D转换。*/
    /*沿着X轴旋转 -30度, 沿着Y轴旋转 -80度*/
    transform: rotateX(-30deg) rotateY(-80deg);
    /*把 animation 绑定到rotate*/
    -webkit-animation: rotate 20s infinite;
    /*匀速*/
    animation-timing-function: linear;
}
/*创建动画是通过逐步改变从一个CSS样式设定到另一个。*/
@-webkit-keyframes rotate{
    from{transform: rotateX(0deg) rotateY(0deg);}
    to{transform: rotateX(360deg) rotateY(360deg);}
}
.cube div{
    position: absolute;
    width: 400px;
    height: 400px;
    opacity: 0.8;  /*指定不透明度。从0.0(完全透明)到1.0(完全不透明)*/
    transition: all 5s;  /*所有属性 过度效果 持续5s*/
}
/*定义所有图片样式*/
.pic{
    width: 400px;
    height: 400px;
}
.cube .out_front{
    transform: rotateY(0deg) translateZ(200px);
}
.cube .out_back{
    transform: translateZ(-200px) rotateY(180deg);
}
.cube .out_left{
    transform: rotateY(90deg) translateZ(200px);
}
.cube .out_right{
    transform: rotateY(-90deg) translateZ(200px);
}
.cube .out_top{
    transform: rotateX(90deg) translateZ(200px);
}
.cube .out_bottom{
    transform: rotateX(-90deg) translateZ(200px);
}
/*定义小正方体样式*/
.cube span{
    display: bloack;
    width: 200px;
    height: 200px;
    position: absolute;
    top: 100px;
    left: 100px;
}
.cube .in_pic{
    width: 200px;
    height: 200px;
}
.cube .in_front{
    transform: rotateY(0deg) translateZ(100px);
}
.cube .in_back{
    transform: translateZ(-100px) rotateY(180deg);
}
.cube .in_left{
    transform: rotateY(90deg) translateZ(100px);
}
.cube .in_right{
    transform: rotateY(-90deg) translateZ(100px);
}
.cube .in_top{
    transform: rotateX(90deg) translateZ(100px);
}
.cube .in_bottom{
    transform: rotateX(-90deg) translateZ(100px);
}
/*鼠标移入后样式*/
.cube:hover .out_front{
    transform: rotateY(0deg) translateZ(400px);
}
.cube:hover .out_back{
    transform: translateZ(-400px) rotateY(180deg);
}
.cube:hover .out_left{
    transform: rotateY(90deg) translateZ(400px);
}
.cube:hover .out_right{
    transform: rotateY(-90deg) translateZ(400px);
}
.cube:hover .out_top{
    transform: rotateX(90deg) translateZ(400px);
}
.cube:hover .out_bottom{
    transform: rotateX(-90deg) translateZ(400px);
}
</style>
</head>
<body>
    <audio autoplay="autopaly">
        <source src="http://www.170mv.com/kw/antiserver.kuwo.cn/anti.s?rid=MUSIC_450897&response=res&format=mp3|aac&type=convert_url&br=128kmp3&agent=iPhone&callback=getlink&jpcallback=getlink.mp3" type="audio/mp3" />
    </audio>    
    <div class="wrap">
        <div class="cube">
            <div class="out_front"><img class="pic" src="https://img1.baidu.com/it/u=2075923439,130195505&fm=26&fmt=auto&gp=0.jpg" /></div>
            <div class="out_back"><img class="pic" src="https://img0.baidu.com/it/u=1618045890,1946795229&fm=26&fmt=auto&gp=0.jpg" /></div>
            <div class="out_left"><img class="pic" src="https://img1.baidu.com/it/u=1223391585,3286738355&fm=26&fmt=auto&gp=0.jpg" /></div>
            <div class="out_right"><img class="pic" src="https://img1.baidu.com/it/u=2200028431,483217992&fm=26&fmt=auto&gp=0.jpg" /></div>
            <div class="out_top"><img class="pic" src="https://img2.baidu.com/it/u=2993781392,3407187010&fm=26&fmt=auto&gp=0.jpg" /></div>
            <div class="out_bottom"><img class="pic" src="https://img0.baidu.com/it/u=2221924116,4011503413&fm=26&fmt=auto&gp=0.jpg" /></div>
            <span class="in_front"><img class="in_pic" src="https://img1.baidu.com/it/u=2200405074,417952639&fm=26&fmt=auto&gp=0.jpg" /></span>
            <span class="in_back"><img class="in_pic" src="https://img2.baidu.com/it/u=2608585042,3503219609&fm=26&fmt=auto&gp=0.jpg" /></span>
            <span class="in_left"><img class="in_pic" src="https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fwww.17qq.com%2Fimg_biaoqing%2F29716497.jpeg&refer=http%3A%2F%2Fwww.17qq.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=jpeg?sec=1620206293&t=81ab4cb402e99c0a29569d208c3f5574" /></span>
            <span class="in_right"><img class="in_pic" src="https://img2.baidu.com/it/u=3046194809,1441608319&fm=26&fmt=auto&gp=0.jpg" /></span>
            <span class="in_top"><img class="in_pic" src="https://img2.baidu.com/it/u=3441181052,2560166791&fm=26&fmt=auto&gp=0.jpg" /></span>
            <span class="in_bottom"><img class="in_pic" src="https://img0.baidu.com/it/u=2356217897,2053847174&fm=26&fmt=auto&gp=0.jpg" /></span>
        </div>
    </div>
</body>
</html>

 

3D旋转相册

标签:转换   baidu   callback   UNC   透明   one   空间   for   ram   

原文地址:https://www.cnblogs.com/HelloM/p/14618847.html

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