gsap实现三维立体相册拖拽旋转木马效果代码

代码语言:html

所属分类:画廊相册

代码描述:gsap实现三维立体相册拖拽旋转木马效果代码,图片可换,拖拽就会旋转,像风车一样。

代码标签: gsap 三维 立体 相册 拖拽 旋转 木马

下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开

<!DOCTYPE html>
<html lang="en" >

<head>
  <meta charset="UTF-8">
  

  <meta name="viewport" content="width=device-width, initial-scale=1">

  
  
<style>

body {
  line-height: 2;
  font-family: Untitled, sans-serif;
  text-transform: uppercase;
  color: #333;
  font-size: 14px;
}

.spacer {
  height: 20vh;
  z-index: 0;
  text-align: center;
}

.intro {
  display: grid;
  place-content: center;
}
@-webkit-keyframes bounce {
  from {
    transform: translateY(-10%);
  }
  to {
    transform: translateY(10%);
  }
}
@keyframes bounce {
  from {
    transform: translateY(-10%);
  }
  to {
    transform: translateY(10%);
  }
}
.intro svg {
  width: 86px;
}
.intro span {
  display: inline-block;
  -webkit-animation: bounce 1s alternate infinite ease-in-out;
          animation: bounce 1s alternate infinite ease-in-out;
}

.container {
  overflow: hidden;
  width: 100%;
}

.wrapper {
  z-index: 1;
  perspective: 1800px;
  perspective-origin: center -300px;
  transform-style: preserve-3d;
  position: relative;
  min-height: 100vh;
  width: 100%;
  pointer-events: none;
  display: grid;
  place-content: center;
}

.spin-me {
  position: absolute;
  bottom: calc(20vh + 15px);
  left: 0;
  right: 0;
  text-align: center;
  pointer-events: none;
  z-index: 0;
}

.rolo {
  position: absolute;
  height: 100vh;
  width: 100%;
  top: 10%;
  left: 50%;
  transform-style: preserve-3d;
  transform-origin: center left;
}

.item {
  position: absolute;
  top: 0;
  left: 0;
  aspect-ratio: 3/2;
  width: 450px;
  z-index: 1;
  pointer-events: all;
  background: #777;
  transform-style: preserve-3d;
}
.item.active-item {
  z-index: 2;
}
.active .item {
  pointer-events: none;
}
.item .card-text {
  z-index: 1;
  position: absolute;
  bottom: 20px;
  right: 20px;
  padding: 20px;
  background: #fff;
  -webkit-backface-visibility: hidden;
          backface-visibility: hidden;
  transform: translateZ(0px);
.........完整代码请登录后点击上方下载按钮下载查看

网友评论0