-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path3DPhoto.html
102 lines (91 loc) · 4.43 KB
/
3DPhoto.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
<!DOCTYPE html>
<!-- saved from url=(0031)http://www.albee.me/index2.html -->
<html onselectstart="return false"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="keywords" content="">
<meta name="description" content="">
<title>3D相册拖拽动画</title>
<style type="text/css">
*{ margin:0; padding:0;}
body{ background:#000; width:100%; height:100%; overflow:hidden}
#wrap{ width:133px; height:200px; margin:25% auto 0;
position:relative;
top:-100px;
transform-style:preserve-3d;
transform:perspective(800px) rotateX(-10deg) rotateY(0deg);
}
#wrap ul li{
list-style:none;
width:120px;
height:180px;
position:absolute;
top:0;left:0;
border-radius:3px;
box-shadow:0 0 10px #fff;
background-size:100%;
transform:rotateY(0deg) translateZ(0px);
-webkit-box-reflect:below 10px -webkit-linear-gradient(top,rgba(0,0,0,0) 40%,rgba(0,0,0,.5) 100%);
}
#wrap p{ width:1200px; height:1200px; position:absolute; border-radius:100%;
left:50%; top:100%; margin-left:-600px; margin-top:-600px;
background:-webkit-radial-gradient(center center,600px 600px,rgba(50,50,50,1),rgba(0,0,0,0));
transform:rotateX(90deg);}
</style>
</head>
<body>
<audio src="love.mp3" id="music" autoplay="autoplay"></audio>
<div id="wrap" style="transform: perspective(800px) rotateX(-6.82225deg) rotateY(-128.716deg);">
<ul>
<li style="background-image: url("img/1.jpg"); transition: transform 1s 1.65s, opacity 0.5s 2.65s; transform: rotateY(0deg) translateZ(350px);"></li>
<li style="background-image: url("img/2.jpg"); transition: transform 1s 1.5s, opacity 0.5s 2.65s; transform: rotateY(32.7273deg) translateZ(350px);"></li>
<li style="background-image: url("img/3.jpg"); transition: transform 1s 1.35s, opacity 0.5s 2.65s; transform: rotateY(65.4545deg) translateZ(350px);"></li>
<li style="background-image: url("img/4.jpg"); transition: transform 1s 1.2s, opacity 0.5s 2.65s; transform: rotateY(98.1818deg) translateZ(350px);"></li>
<li style="background-image: url("img/5.jpg"); transition: transform 1s 1.05s, opacity 0.5s 2.65s; transform: rotateY(130.909deg) translateZ(350px);"></li>
<li style="background-image: url("img/6.jpg"); transition: transform 1s 0.9s, opacity 0.5s 2.65s; transform: rotateY(163.636deg) translateZ(350px);"></li>
<li style="background-image: url("img/7.jpg"); transition: transform 1s 0.75s, opacity 0.5s 2.65s; transform: rotateY(196.364deg) translateZ(350px);"></li>
<li style="background-image: url("img/8.jpg"); transition: transform 1s 0.6s, opacity 0.5s 2.65s; transform: rotateY(229.091deg) translateZ(350px);"></li>
<li style="background-image: url("img/9.jpg"); transition: transform 1s 0.45s, opacity 0.5s 2.65s; transform: rotateY(261.818deg) translateZ(350px);"></li>
<li style="background-image: url("img/10.jpg"); transition: transform 1s 0.3s, opacity 0.5s 2.65s; transform: rotateY(294.545deg) translateZ(350px);"></li>
<li style="background-image: url("img/11.jpg"); transition: transform 1s 0.15s, opacity 0.5s 2.65s; transform: rotateY(327.273deg) translateZ(350px);"></li>
</ul>
<p></p>
</div>
<script src="./files/jquery-1.11.3.min.js"></script>
<script>
$(function(){
var oL = $('#wrap ul li').size();
var Deg = 360/oL;
var xDeg = 0,yDeg = -10,xs,ys,p=null;
for (var i=oL-1;i>=0;i--)
{
$('#wrap ul li').eq(i).css({
transition:"1s "+(oL-i)*0.15+"s transform,.5s "+(1+oL*0.15)+"s opacity",
'transform':'rotateY('+Deg*i+'deg) translateZ(350px)'
});
}
$(document).mousedown(function(e){
clearInterval(p);
var x1 = e.clientX;
var y1 = e.clientY;
$(this).bind('mousemove',function(e){
xs = e.clientX - x1;
ys = e.clientY - y1;
x1 = e.clientX;
y1 = e.clientY;
xDeg += xs*0.3;
yDeg -= ys*0.1;
$('#wrap').css('transform',"perspective(800px) rotateX("+yDeg+"deg) rotateY("+xDeg+"deg)");
});
}).mouseup(function(){
$(this).unbind('mousemove');
p = setInterval(function(){
if(Math.abs(xs)<0.5&&Math.abs(ys)<0.5){clearInterval(p)};
xs = xs*0.95;
ys = ys*0.95
xDeg += xs*0.3;
yDeg -= ys*0.1;
$('#wrap').css('transform',"perspective(800px) rotateX("+yDeg+"deg) rotateY("+xDeg+"deg)");
},30);
});
});
</script>
</body></html>