综合前面学习的3d旋转制作技巧写的第一个简单的图片旋转特效,源码
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width,inital-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=7">
<title>小朋友的日常</title>
<style>
body{
background-color: black;
}
.wrap{
width:230px;
height:300px;
margin: 200px auto;
position: relative;
transform-style: preserve-3d;
transform: rotateX(-12deg);
animation:xpy 20s infinite;
animation-timing-function: linear;
}
.p{
position: absolute;
left: 0;
right: 0;
width: 100%;
height:100%;
}
.p:nth-child(1){
transform:rotateY(0deg) translateZ(275px);
}
.p:nth-child(2){
transform:rotateY(45deg) translateZ(275px);
}
.p:nth-child(3){
transform:rotateY(90deg) translateZ(275px);
}
.p:nth-child(4){
transform:rotateY(135deg) translateZ(275px);
}
.p:nth-child(5){
transform:rotateY(180deg) translateZ(275px);
}
.p:nth-child(6){
transform:rotateY(225deg) translateZ(275px);
}
.p:nth-child(7){
transform:rotateY(270deg) translateZ(275px);
}
.p:nth-child(8){
transform:rotateY(315deg) translateZ(275px);
}
@keyframes xpy{
from{
transform: rotateX(-12deg) rotateY(0deg);
}
to{
transform: rotateX(-12deg) rotateY(360deg);
}
}
</style>
</head>
<body>
<div class="wrap">
<div class="p">
<img src="E:\photos\1.jpg" width="230" height="300">
</div>
<div class="p">
<img src="E:\photos\2.jpg" width="230" height="300">
</div>
<div class="p">
<img src="E:\photos\3.jpg" width="230" height="300">
</div>
<div class="p">
<img src="E:\photos\4.jpg" width="230" height="300">
</div>
<div class="p">
<img src="E:\photos\5.jpg" width="230" height="300">
</div>
<div class="p">
<img src="E:\photos\6.jpg" width="230" height="300">
</div>
<div class="p">
<img src="E:\photos\xmc2.jpg" width="230" height="300">
</div>
<div class="p">
<img src="E:\photos\xmc3.jpg" width="230" height="300">
</div>
</div>
</body>
</html>