3d照片墙.html 3.52 KB
<!DOCTYPE html>
<html>
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <title>css3_demo</title>
<style>
.container {
  width: 100%;
}

.demo-perspective-photo {
  position: absolute;
  width: 100%;
  height: 200px;
  top: 15%;
  background-color: #fff;
  zoom: 2;
}

.demo-perspective-photo #stage {
  width: 100%;
  height: 200px;
  -webkit-perspective: 800px;
  -moz-perspective: 800px;
  perspective: 800px;
  -webkit-transition: top 0.5s;
  -moz-transition: top 0.5s;
  transition: top 0.5s;
  position: relative;
}

.demo-perspective-photo #container {
  position: absolute;
  width: 64px;
  height: 36px;
  left: 50%;
  top: 50%; 
  margin-left: -32px;
  margin-top: -18px;
  cursor: pointer;
  -webkit-transition: -webkit-transform 1s;
  -moz-transition: -moz-transform 1s;
  transition: transform 1s;
  -webkit-transform-style: preserve-3d;
  -moz-transform-style: preserve-3d;
  transform-style: preserve-3d;
  -webkit-animation: photoRotate 18s ease-in-out infinite 2s;
  animation: photoRotate 18s ease-in-out infinite 2s;
}

.demo-perspective-photo .piece {
  width: 128px;
  height:86px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
  -webkit-transition: opacity 1s, -webkit-transform 1s;
  -moz-transition: opacity 1s, -moz-transform 1s;
  transition: opacity 1s, transform 1s;
  position: absolute;
  bottom: 0;
}

@-webkit-keyframes photoRotate {
  0% {
    -webkit-transform: rotateY(0deg);
    transform: rotateY(0deg);
  }
  16.7% {
    -webkit-transform: rotateY(60deg);
    transform: rotateY(60deg);
  }
  33.3% {
    -webkit-transform: rotateY(120deg);
    transform: rotateY(120deg);
  }
  50% {
    -webkit-transform: rotateY(180deg);
    transform: rotateY(180deg);
  }
  66.7% {
    -webkit-transform: rotateY(240deg);
    transform: rotateY(240deg);
  }
  83.3% {
    -webkit-transform: rotateY(300deg);
    transform: rotateY(300deg);
  }
  100% {
    -webkit-transform: rotateY(360deg);
    transform: rotateY(360deg);
  }
}

@keyframes photoRotate {
  0% {
    -webkit-transform: rotateY(0deg);
    transform: rotateY(0deg);
  }
  16.7% {
    -webkit-transform: rotateY(60deg);
    transform: rotateY(60deg);
  }
  33.3% {
    -webkit-transform: rotateY(120deg);
    transform: rotateY(120deg);
  }
  50% {
    -webkit-transform: rotateY(180deg);
    transform: rotateY(180deg);
  }
  66.7% {
    -webkit-transform: rotateY(240deg);
    transform: rotateY(240deg);
  }
  83.3% {
    -webkit-transform: rotateY(300deg);
    transform: rotateY(300deg);
  }
  100% {
    -webkit-transform: rotateY(360deg);
    transform: rotateY(360deg);
  }
}
</style>
</head>
<body>
  <div class="container">  

    <!-- 3d照片墙 -->
    <div class="demo-perspective-photo">
      <div id="stage">
        <div id="container">
          <!-- 此处可上传自己的图片 -->
          <img src="./a_src/img/1.jpg" class='piece' style="-webkit-transform: rotateY(0deg) translateZ(196px);">
          <img src="./a_src/img/2.jpg" class='piece' style="-webkit-transform: rotateY(60deg) translateZ(196px);">
          <img src="./a_src/img/3.jpg" class='piece' style="-webkit-transform: rotateY(120deg) translateZ(196px);">
          <img src="./a_src/img/4.jpg" class='piece' style="-webkit-transform: rotateY(180deg) translateZ(196px);">
          <img src="./a_src/img/5.jpg" class='piece' style="-webkit-transform: rotateY(240deg) translateZ(196px);">
          <img src="./a_src/img/6.jpg" class='piece' style="-webkit-transform: rotateY(300deg) translateZ(196px);">       
        </div>
      </div>
    </div>
  </div>
</html>