console
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport"
content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no,minimal-ui">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>3D标签播放图</title>
<style>
body {
margin: 0;
padding: 0;
/* 设置flex布局 */
display: flex;
/* 在主轴上居中 */
justify-content: center;
/* 在测轴上居中 */
align-items: center;
height: 100vh;
background-color: #000000;
/* 透视 */
perspective: 900px;
//透视原理: 近大远小 。 浏览器透视:把近大远小的所有图像,透视在屏幕上。
//perspective的意义在于设置远近点大小的比例,让它产生3D感,但是并不改变物体在transform-origin处的大小。
}
section {
width: 50px;
height: 20px;
position: relative;
/* 所有子元素在3D空间中呈现。 */
transform-style: preserve-3d;
/* 设置动画属性 */
animation: dh 20s linear infinite;
}
section div {
position: absolute;
left: 0;
top: 0;
width: 100%;
height: 100%;
/* 图片居中 */
text-align: center;
/* 设置图片倒影 */
/* -webkit-box-reflect: below 15px linear-gradient(transparent 10%, rgba(255, 255, 255, 0.3)); */
}
/* 设置每一张图片的特有样式 div:nth-child(1)指当前div的第n个子元素,n是从1开始*/
section div:nth-child(1) {
background-color: #C14C39;
/* 在Z轴上移动300px */
transform: translateZ(50px);
}
section div:nth-child(2) {
background-color: #6E9C72;
/* 沿Y轴旋转60度,并在Z轴上移动300px */
transform: rotateX(60deg) translateZ(50px);
}
section div:nth-child(3) {
background-color: #5E5F7A;
transform: rotateX(120deg) translateZ(50px);
}
section div:nth-child(4) {
background-color: #F5EB98;
transform: rotateX(180deg) translateZ(50px);
}
section div:nth-child(5) {
background-color: #50A3BC;
transform: rotateX(240deg) translateZ(50px);
}
section div:nth-child(6) {
background-color: #F9A99A;
transform: rotateX(300deg) translateZ(50px);
}
/* 整体旋转动画 */
@keyframes dh {
from {
/* 起始角度 */
transform: rotateX(0deg);
}
to {
/* 最终角度 */
transform: rotateX(360deg)
}
}
</style>
</head>
<body>
<section>
<div><img src="./images/1.png" alt="">1111</div>
<div><img src="./images/2.png" alt="">222</div>
<div><img src="./images/3.png" alt="">333</div>
<div><img src="./images/4.png" alt="">444</div>
<div><img src="./images/5.png" alt="">555</div>
<div><img src="./images/6.png" alt="">666</div>
</section>
</body>
</html>