先上个图吧!
再贴个源代码:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>3D相册</title>
<style type="text/css">
html{
background:linear-gradient(#FF6666 0%,#336699 20%);/*背景渐变颜色*/
height: 100%;
color:#99cc33;/*文字颜色*/
}
/*最外层容器样式*/
.wrap{
width: 300px;
height: 300px;
/*改变左右上下,图片方块移动*/
margin: 150px auto;
position: relative;
}
/*包裹所有容器样式*/
.cube{
width: 300px;
height: 300px;
margin: 0 auto;
transform-style: preserve-3d;
transform: rotateX(-30deg) rotateY(-80deg);
-webkit-animation: rotate 20s infinite;
/*匀速*/
animation-timing-function: linear;
}
@-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.95;
transition: all .4s;
}
/*定义所有图片样式*/
.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: 50px;
left: 50px;
}
.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(250px);
}
.cube:hover .out_back{
transform: translateZ(-250px) rotateY(180deg);
}
.cube:hover .out_left{
transform: rotateY(90deg) translateZ(250px);
}
.cube:hover .out_right{
transform: rotateY(-90deg) translateZ(250px);
}
.cube:hover .out_top{
transform: rotateX(90deg) translateZ(250px);
}
.cube:hover .out_bottom{
transform: rotateX(-90deg) translateZ(250px);
}
.hovertreeinfo{text-align:center;}
.hovertreeinfo a{color:white}
</style>
</head>
<body>
<div class="hovertreeinfo">
<h2>美女.love</h2>
</div>
<!--/*外层最大容器*/-->
<div class="wrap">
<!-- /*包裹所有元素的容器*/-->
<div class="cube">
<!--前面图片 -->
<div class="out_front">
<img src="https://img-blog.csdnimg.cn/20200412162647353.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L1FRNTc2NDk0Nzk5,size_16,color_FFFFFF,t_70" class="pic" />
</div>
<!--后面图片 -->
<div class="out_back">
<img src="https://img-blog.csdnimg.cn/20200412162647353.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L1FRNTc2NDk0Nzk5,size_16,color_FFFFFF,t_70" class="pic" />
</div
<!--左图片 -->
<div class="out_left">
<img src="https://img-blog.csdnimg.cn/20200412162647353.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L1FRNTc2NDk0Nzk5,size_16,color_FFFFFF,t_70" class="pic" />
</div>
<div class="out_right">
<img src="https://img-blog.csdnimg.cn/20200412162647353.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L1FRNTc2NDk0Nzk5,size_16,color_FFFFFF,t_70" class="pic" />
</div>
<div class="out_top">
<img src="https://img-blog.csdnimg.cn/20200412162647353.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L1FRNTc2NDk0Nzk5,size_16,color_FFFFFF,t_70" class="pic" />
</div>
<div class="out_bottom">
<img src="https://img-blog.csdnimg.cn/20200412162647353.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L1FRNTc2NDk0Nzk5,size_16,color_FFFFFF,t_70" class="pic" />
</div>
<!--小正方体 -->
<span class="in_front">
<img src="https://img-blog.csdn.net/20170716094246620" class="in_pic" />
</span>
<span class="in_back">
<img src="https://img-blog.csdn.net/20170716094246620" class="in_pic" />
</span>
<span class="in_left">
<img src="https://img-blog.csdn.net/20170716094246620" class="in_pic" />
</span>
<span class="in_right">
<img src="https://img-blog.csdn.net/20170716094246620" class="in_pic" />
</span>
<span class="in_top">
<img src="https://img-blog.csdn.net/20170716094246620" class="in_pic" />
</span>
<span class="in_bottom">
<img src="https://img-blog.csdn.net/20170716094246620" class="in_pic" />
</span>
</div>
</div>
<!-- 网易云外链音乐 -->
<!-- 只有发布和编译到端口才会自动播放 -->
<div style="position:absolute;right:0px;bottom:0px;">
<iframe frameborder="no" border="0" marginwidth="0" marginheight="100%" width=330 height=86
src="https://www.kugou.com/song/#hash=5B7F8DCFB2CB2240D5EE8E917A0B1AEF&album_id=33194412"></iframe>
</div>
<script>
var music = document.getElementById('video');
var state = 0;
document.addEventListener('touchstart', function(){
if(state==0){
music.play();
state=1;
}
}, false);
document.addEventListener("WeixinJSBridgeReady", function () {
music.play();
}, false);
//循环播放
music.onended = function () {
music.load();
music.play();
}
</script>
</body>
</html>
直接把上面的代码,保存为html格式,就可以在电脑上直接运行了!
<img src="https://img-blog.csdnimg.cn/20200412162647353.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L1FRNTc2NDk0Nzk5,size_16,color_FFFFFF,t_70" class="pic" />
修改图片的src来源,就可以进行个人的私人定制的照片相册显示!
有需要的朋友动动手呗!而且还可以改背景音乐呢!