先放上效果图:
相册会随着一定路劲翻滚移动

把鼠标指向相册会触发

另外也可以跟二次元人物(相册的观众)进行“友好”的互动,骚起来!


相关源码:https://download.csdn.net/download/m0_50654102/19860698
也可以按照下面的教程自己制作:
相册的具体制作:
文件命名及目录:

image文件夹中照片的命名方式:

“audio”标签记得改为自己的音乐文件名
例如我的:
<audio autoplay="autoplay" controls="controls" loop="loop" preload="auto"
src="尹昔眠 _ 小田音乐社 - 奔赴星空.mp3">
你的浏览器版本太低,不支持audio标签
</audio>
另外,感兴趣的话也可以加上自己喜欢的背景图片,以及百度下“L2Dwidget”找下相关的源码更改二次元人物哦。
其他相册的属性修改就自行研究css中的内容吧
提示:想要改变相册的移动路劲可以修改这个:
@-webkit-keyframes mystyle{
from{transform: rotateX(-180deg) rotateY(-180deg);}
to{transform: rotateX(180deg) rotateY(180deg);}
html文件中的具体源码:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<audio autoplay="autoplay" controls="controls" loop="loop" preload="auto"
src="改为你自己的音乐文件名">
你的浏览器版本太低,不支持audio标签
</audio>
<title>title</title>
<style type="text/css">
html{
width: 100%;
height: 100%;
}
.bigbox{
width: 10px;
height: 10px;
margin: 200px 400px;
position: relative;
}
.box{
width:500px;
height:300px;
margin: 0 auto;
transform-style: preserve-3d;
transform: rotateX(-30deg) rotateY(-80deg);
-webkit-animation: mystyle 15s infinite;
animation-timing-function: linear;
}
@-webkit-keyframes mystyle{
from{transform: rotateX(-180deg) rotateY(-180deg);}
to{transform: rotateX(180deg) rotateY(180deg);}
}
.box div{
position: absolute;
width: 200px;
height: 200px;
opacity: 0.8;
transition: all .4s;
}
.bigpic{
width: 200px;
height: 200px;
}
.box .bigfront{
transform: rotateY(0deg) translateZ(100px);
}
.box .bigback{
transform: translateZ(-100px) rotateY(180deg);
}
.box .bigleft{
transform: rotateY(90deg) translateZ(100px);
}
.box .bigright{
transform: rotateY(-90deg) translateZ(100px);
}
.box .bigtop{
transform: rotateX(90deg) translateZ(100px);
}
.box .bigbottom{
transform: rotateX(-90deg) translateZ(100px);
}
.box span{
display: block;
position: absolute;
width: 140px;
height: 140px;
top: 25px;
left: 25px;
}
.box .smallpic{
width: 140px;
height: 140px;
}
.box .smallleft{
transform: rotateY(90deg) translateZ(70px);
}
.box .smallright{
transform: rotateY(-90deg) translateZ(70px);
}
.box .smalltop{
transform: rotateX(90deg) translateZ(70px);
}
.box .smallbottom{
transform: rotateX(-90deg) translateZ(70px);
}
.box .smallfront{
transform: rotateY(0deg) translateZ(70px);
}
.box .smallback{
transform: translateZ(-70px) rotateY(180deg);
}
/*让鼠标指向的时候触发*/
.box:hover .bigleft{
transform: rotateY(90deg) translateZ(300px);
}
.box:hover .bigright{
transform: rotateY(-90deg) translateZ(300px);
}
.box:hover .bigtop{
transform: rotateX(90deg) translateZ(300px);
}
.box:hover .bigbottom{
transform: rotateX(-90deg) translateZ(300px);
}
.box:hover .bigfront{
transform: rotateY(0deg) translateZ(300px);
}
.box:hover .bigback{
transform: translateZ(-300px) rotateY(180deg);
}
</style>
</head>
<body>
<div class="bigbox">
<div class="box">
<div class="bigfront">
<img src="image/1.jpg" class="bigpic" >
</div>
<div class="bigback">
<img src="image/2.jpg" class="bigpic">
</div>
<div class="bigleft">
<img src="image/3.jpg" class="bigpic">
</div>
<div class="bigright">
<img src="image/4.jpg" class="bigpic">
</div>
<div class="bigtop">
<img src="image/5.jpg" class="bigpic">
</div>
<div class="bigbottom">
<img src="image/6.jpg" class="bigpic">
</div>
<span class="smallfront">
<img src="image/7.jpg" class="smallpic" />
</span>
<span class="smallback">
<img src="image/8.jpg" class="smallpic" />
</span>
<span class="smallleft">
<img src="image/9.jpg" class="smallpic" />
</span>
<span class="smallright">
<img src="image/10.jpg" class="smallpic" />
</span>
<span class="smalltop">
<img src="image/11.jpg" class="smallpic" />
</span>
<span class="smallbottom">
<img src="image/12.jpg" class="smallpic" />
</span>
</div>
</div>
<script src="https://cdn.jsdelivr.net/npm/live2d-widget@3.0.4/lib/L2Dwidget.min.js"></script>
<script>
L2Dwidget.init();
</script>
<script src="https://cdn.jsdelivr.net/npm/jquery/dist/jquery.min.js"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/font-awesome/css/font-awesome.min.css"/>
<script src="https://cdn.jsdelivr.net/gh/ChrisZy1/live2d-widget/autoload.js"></script>
</body>
</html>
}
本文介绍了一种使用HTML和CSS实现的3D翻转相册效果,相册能够沿着特定路径滚动并响应鼠标悬停事件。此外,还介绍了如何通过修改CSS样式来调整相册的运动轨迹,并提供了背景音乐和二次元人物互动的功能。

被折叠的 条评论
为什么被折叠?



