<!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>Document</title>
<style>
body {
perspective: 800px;
}
section {
position: relative;
width: 300px;
height: 206px;
margin: 150px auto;
transform-style: preserve-3d;
animation: rotate 5s linear infinite;
background: url(images/下载.jpg) no-repeat;
}
section:hover {
animation-play-state: paused;
}
@keyframes rotate {
0% {
transform: rotateY(0);
}
100% {
transform: rotateY(360deg);
}
}
section div {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: url(images/下载.jpg) no-repeat;
}
section div:nth-child(1) {
transform: translateZ(300px);
}
section div:nth-child(2) {
transform: rotateY(60deg) translateZ(300px) ;
}
section div:nth-child(3) {
transform: rotateY(120deg) translateZ(300px) ;
}
section div:nth-child(4) {
transform: rotateY(180deg) translateZ(300px) ;
}
section div:nth-child(5) {
transform: rotateY(240deg) translateZ(300px) ;
}
section div:nth-child(6) {
transform: rotateY(300deg) translateZ(300px) ;
}
</style>
</head>
<body>
<section>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
</section>
</body>
</html>
利用CSS3动画属性实现旋转木马
最新推荐文章于 2022-05-01 15:13:59 发布
本文介绍如何使用HTML、CSS和JavaScript创建一个具有立体旋转效果的3D视觉组件,通过`transform-style: preserve-3d`和关键帧动画实现。点击暂停时,div层按Y轴逐个旋转展示下载图片的不同视角。
895

被折叠的 条评论
为什么被折叠?



