想要的效果是,旋转到屏幕前变大,旋转到屏幕里面变小(近大远小)。
img_3D@keyframes an1{
0%{
transform: rotateY(0deg) ;
}
50%{
transform: rotateY(180deg) ;
}
100%{
transform: rotateY(360deg) ;
}
}
.container{
margin: 200px auto;
perspective: 2000px;
transform-style: preserve-3d;
animation: an1 18s linear 0s infinite;
}
.container img{
width: 80px;
height: 100px;
margin: auto;
top: 0;
bottom: 0;
left: 0;
right: 0;
position: absolute;
}
.container img:nth-child(1){
transform: rotateY(0deg) translateZ(300px);
}
.container img:nth-child(2){
transform: rotateY(36deg) translateZ(300px);
}
.container img:nth-child(3){
transform: rotateY(72deg) translateZ(300px);
}
.container img:nth-child(4){
transform: rotateY(108deg) translateZ(300px);
}
.container img:nth-child(5){
transform: rotateY(144deg) translateZ(300px);
}
.container img:nth-child(6){
transform: rotateY(180deg) translateZ(300px);
}






本文介绍了一种使用CSS实现的3D旋转动画效果,通过不同的旋转角度使图片呈现出近大远小的视觉体验。该效果利用了关键帧动画和3D变换属性,使多个图片元素在旋转过程中产生立体感。
1284

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



