<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>3D旋转相册</title>
<link rel="stylesheet" href="style.css">
<style>
*{margin: 0;padding: 0;}
html,body{height: 100%;}
body{
display: flex;
perspective: 1000px;
transform-style: preserve-3d;
/* background-image: url(./img/3.png); */
height:100%;
width: 100%;
}
#box{
position: relative;
display: flex;
width: 130px;
height: 200px;
margin: auto;
transform-style: preserve-3d;
transform: rotateX(-10deg);
}
#box > div{
transform-style: preserve-3d;
position: absolute;
left: 0;
top: 0;
width: 100%;
height: 100%;
line-height: 200px;
font-size: 50px;
text-align: center;
box-shadow:0 0 10px #fff;
-webkit-box-reflect:below 10px -webkit-linear-gradient(top,rgba(0,0,0,0) 40%,rgba(0,0,0,.8) 100%);
}
#box p{
position: absolute;
left: 0;
top: 0;
bottom: 0;
right: 0;
margin: auto;
width: 1200px;
height: 1200px;
background: -webkit-radial-gradient(center center,600px 600px,rgba(50,50,50,1),rgba(0,0,0,0));
border-radius: 50%;
transform: rotateX(90deg) translate3d(-600px,0,-105px);
}
</style>
</head>
<body>
<audio autoplay="autopaly">
<source src="renxi.mp3" type="audio/mp3" />
</audio>
<!-- 相册 -->
<div id="box">
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<p></p>
</div>
<!-- 流星 -->
<div class="stars">
<div class="star"></div>
<div class="star"></div>
<div class="star"></div>
<div class="star"></div>
<div class="star"></div>
<div class="star"></div>
<div class="star"></div>
<div class="star"></div>
<div class="star"></div>
<div class="star"></div>
<div class="star"></div>
<div class="star"></div>
<div class="star"></div>
<div class="star"></div>
<div class="star"></div>
<div class="star"></div>
<div class="star"></div>
<div class="star"></div>
<div class="star"></div>
<div class="star"></div>
<div class="star"></div>
<div class="star"></div>
<div class="star"></div>
<div class="star"></div>
<div class="star"></div>
<div class="star"></div>
<div class="star"></div>
<div class="star"></div>
<div class="star"></div>
<div class="star"></div>
<div class="star"></div>
<div class="star"></div>
<div class="star"></div>
<div class="star"></div>
<div class="star"></div>
<div class="star"></div>
<div class="star"></div>
<div class="star"></div>
<div class="star"></div>
<div class="star"></div>
<div class="star"></div>
<div class="star"></div>
<div class="star"></div>
<div class="star"></div>
<div class="star"></div>
<div class="star"></div>
<div class="star"></div>
<div class="star"></div>
<div class="star"></div>
<div class="star"></div>
</div>
<script>
setTimeout(init,100);
function init(){
var obox = document.getElementById('box'),
aDiv = obox.getElementsByTagName('div');
for (var i = 0; i < aDiv.length; i++) {
aDiv[i].style.background = "url(img/"+(i+1)+".jpg) center/cover";
aDiv[i].style.transform = "rotateY("+(i*36)+"deg) translate3d(0,0,350px)";
aDiv[i].style.transition = "transform 1s "+(aDiv.length-i)*0.2+"s";
}
var sX,
sY,
nX,
nY,
desX = 0,
desY = 0,
tX = 0,
tY = 10,
index = 0;//滚轮初始值
document.onmousedown = function(e){
clearInterval(obox.timer);
e = e || window.event;
var sX = e.clientX,
sY = e.clientY;
this.onmousemove = function(e){
e = e || window.event;
var nX = e.clientX,
nY = e.clientY;
// 当前点的坐标和前一点的坐标差值
desX = nX - sX;
desY = nY - sY;
tX += desX*0.1;
tY += desY*0.1;
obox.style.transform = "rotateX("+(-tY)+"deg) rotateY("+tX+"deg)";
sX = nX;
sY = nY;
}
this.onmouseup = function(){
this.onmousemove = this.onmouseup = null;
obox.timer = setInterval(function(){
desX *= 0.95;
desY *= 0.95;
tX += desX*0.1;
tY += desY*0.1;
obox.style.transform = "rotateX("+(-tY)+"deg) rotateY("+tX+"deg)";
if (Math.abs(desX)<0.5 && Math.abs(desY)<0.5) {
clearInterval(obox.timer);
}
},13);
}
return false;
}
//滚轮放大缩小
mousewheel(document,function(e){
e = e || window.event;
var d = e.wheelDelta/120 || -e.detail/3;
if (d>0) {
index-=20;
}else{
index+=30;
}
(index<(-1050)&&(index=(-1050)));
document.body.style.perspective = 1000 + index + "px";
})
function mousewheel(obj,fn){
document.onmousewheel===null?obj.onmousewheel=fn:addEvent(obj,"DOMMouseScroll",fn)
}
function addEvent(obj,eName,fn){
obj.attachEvent?obj.attachEvent("on"+eName,fn):obj.addEventListener(eName,fn);
}
}
</script>
</body>
</html>
@老人与海鲜
- 粉丝: 265
- 资源: 15
最新资源
- 基于 AT89C51 的电梯控制系统嵌入式系统实验详细文档+全部资料+高分项目+源码.zip
- 本科毕设-基于嵌入式arm的人脸识别智能门禁,包括代码、电路图,具体流程详细文档+全部资料+高分项目+源码.zip
- 毕设-基于WIFI车间设备监测与控制系统的研究)的主程序,采用Qt框架编写,以嵌入式ARM Linux系统作为软件运行平台详细文档+全部资料+高分项目+源码.zip
- 基于 react + koa, 开箱即用的 Material Design 风格博客系统..详细文档+全部资料+高分项目+源码.zip
- Project2.zip
- 用c++语言实现的各种算法源代码.zip
- 基于 u8g2 的单色 OLED 菜单 UI 框架。MiaoUI使用 C 语言实现,,适用于具有小型OLED屏幕的嵌入式设备。详细文档+全部资料+高分项目+源码
- 基于ARM的嵌入式小系统,在系统挂掉之后,提取现场的dump信息详细文档+全部资料+高分项目+源码.zip
- 基于Android基于WebView的嵌入式Youtube视频播放器,可识别多种Youtube分享视频的url详细文档+全部资料+高分项目+源码.zip
- 基于ARM-Linux的嵌入式视觉移动追踪系统,并通过Android APP进行无线控制详细文档+全部资料+高分项目+源码.zip
- 基于C++11,协作式调度物联网嵌入式操作系统详细文档+全部资料+高分项目+源码.zip
- 基于ARM架构Cortex-A8的IC卡嵌入式刷卡考勤系统详细文档+全部资料+高分项目+源码.zip
- 基于cc2530的嵌入式详细文档+全部资料+高分项目+源码.zip
- 基于ChatGPT的智能音箱嵌入式课程设计详细文档+全部资料+高分项目+源码.zip
- 基于Cortex-M内核的嵌入式操作系统,针对新手设计,简单易懂详细文档+全部资料+高分项目+源码.zip
- 基于contiki与ucGUI的嵌入式微操作系统例程详细文档+全部资料+高分项目+源码.zip
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
评论0