在这里插入图片描述

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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>旋转木马</title>
<style>
*{
margin: 0;
padding:0;
}
body{
display: flex;
justify-content: center;
align-items: center;/*以上三行是旋转木马网页居中*/
height: 100vh;/*高度占网页全部*/
background-color: black;
perspective: 900px;/*视距*/
}
section{
position: relative;
width: 300px;
height: 200px;
cursor: pointer;/*hover时鼠标箭头变手指*/
transform-style: preserve-3d;/*写这个才能实现3d效果*/
animation:rotate 20s linear infinite;
}
img{
width: 300px;
height: 200px;
}
section:hover{
animation-play-state: paused;/*hover是旋转木马停止*/
}
section div{
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
text-align: center;
-webkit-box-reflect:below 15px
-webkit-linear-gradient(transparent 10%,rgba(255,255,255,.3));
/*实现倒影 below-倒影在原方块的下方 15px-原方块距离倒影的距离 倒影的10%设置为全透明, rgba设置剩下倒影的透明度*/
}
section div:nth-child(1){
transform: translatez(300px);/*函数将元素从屏幕“向外”移动300像素到用户。这使得在2D显示器上观看时元素显得更大,*/
background-color: #c14c39;
}
section div:nth-child(2){
transform:rotateY(60deg) translatez(300px);/*rotateY表示绕y轴旋转60° */
background-color: #6e9c72;
}
section div:nth-child(3){
transform:rotateY(120deg) translatez(300px);
background-color: #5e5f7a;
}
section div:nth-child(4){
transform:rotateY(180deg) translatez(300px);
background-color: #f5eb98;
}
section div:nth-child(5){
transform:rotateY(240deg) translatez(300px);
background-color: #50a3bc;
}
section div:nth-child(6){
transform:rotateY(300deg) translatez(300px);
background-color: #f9a99a;
}
@keyframes rotate {
to{
transform: rotateY(360deg);
}
}
</style>
</head>
<body>
<section>
<div><img src="img2/1.jpg"></div>
<div><img src="img2/2.jpg"></div>
<div><img src="img2/3.jpg"></div>
<div><img src="img2/4.jpg"></div>
<div><img src="img2/5.jpg"></div>
<div><img src="img2/6.jpg"></div>
</section>
</body>
</html>

图片要自己加啊啊啊!
效果图视频我不会加。。。
有什么问题欢迎大家在评论区讨论!!