-
Notifications
You must be signed in to change notification settings - Fork 2
/
悬浮库洛牌.html
71 lines (60 loc) · 1.69 KB
/
悬浮库洛牌.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>骷髅里多创造的库洛牌啊,出来吧!</title>
<style>
*{padding:0px;margin:0px;} /*这是为了消除默认dom元素的内外边距,使得我们写css的时候更精确*/
body{
background: #000;
}
#pics{
width: 330px;
height: 540px;
border: 1px solid #ccc;
margin: 160px auto;
transform:rotateY(0deg);
transform:rotateZ(0deg);
transform-style: preserve-3d;/*设置3d环境*/
perspective: 800px;/*设置景深为800px*/
/* 所谓的景深, 简单说来,就是对好焦的范围。它能决定是把背景模糊化来突出拍摄对象,还是拍出清晰的背景。 */
}
#pics img{
width: 100%;
height: 100%;
position: absolute;
box-shadow: 0 0 8px #eaeaea;
box-shadow: 1px -1px 6px #666;
border-radius: 4px;
/* -webkit-box-reflect:below 3px -webkit-linear-gradient(top,rgba(0,0,0,0) 40%,rgba(0,0,0,0.5)); */
cursor:pointer;
}
</style>
</head>
<body>
<div id="pics">
<img src="images/1 (1).jpg" >
<img src="images/1 (2).jpg" >
<img src="images/1 (3).jpg" >
<img src="images/1 (4).jpg" >
<img src="images/1 (5).jpg" >
<img src="images/1 (6).jpg" >
<img src="images/1 (7).jpg" >
<img src="images/1 (8).jpg" >
</div>
<script>
function(){
var picsDom = document.getElementById("pics");
//获取图片数组
var images = picsDom.getElementsByTagName('img');
//获取图片数量
var len = images.length;
//计算每张图片按Y轴旋转的角度
var deg = Math.floor(360/len);
for (var i = 0; i < len; i++) {
images[i].style = 'transform:rotato('+deg*i+'deg)'; //deg前面不要加空格
}
}
</script>
</body>
</html>