gsap实现3d图文卡片堆叠点击轮换幻灯片效果代码

代码语言:html

所属分类:幻灯片

代码描述:gsap实现3d图文卡片堆叠点击轮换幻灯片效果代码

代码标签: gsap 3d 图文 卡片 堆叠 点击 轮换 幻灯片

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

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

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


  
  
<style>
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

p,
a {
  text-decoration: none;
  font-weight: 500;
  font-size: 14px;
  color: #000;
}

.container {
  position: relative;
  width: 100%;
  height: 100vh;
  overflow: hidden;
  background-color: #dfe1c8;
}

.slider {
  position: absolute;
  top: 15vh;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  perspective: 300px;
  perspective-origin: 50% 50%;
}

.card {
  position: absolute;
  top: 35%;
  left: 50%;
  width: 50%;
  height: 400px;
  border-radius: 10px;
  overflow: hidden;
  transform: translate3d(-50%, -50%, 0);
  background-color: #000;
}

@media (max-width: 500px) {
  .slider {
    top: 27vh;
  }

  .card {
    height: 300px;
  }
}
.card img {
  position: absolute;
  opacity: 0.75;
}

.copy {
  position: absolute;
  top: 40%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 100%;
  clip-path: polygon(0 0, 100% 0, 100% 100%, 0% 100%);
}

h1 {
  position: relative;
  text-align: center;
  font-size: 6vw;
  font-weight: 300;
  letter-spacing: -0.05em;
  text-transform: uppercase;
  color: #dfe1c8;
}

h1 span {
  position: relative;
  display: inline-block;
}
</style>


  
</head>

<body translate="no">
  <div class="container">
      <div class="slider">
        <div class="card">
          <img
            src="//repo.bfw.wiki/bfwrepo/image/5d6539613d08b.png"
            alt=""
          />
          <div class="copy">
            <h1>Lorem, ipsum.</h1>
          </div>
        </div>

        <div class="card">
          <img
            src="//repo.bfw.wiki/bfwrepo/image/5e323253cf4d2.png"
            alt=""
          />
          <div class="copy">
            <h1>Lorem, ipsum.</h1>
          </div>
        </div>

        <div class="card">
          <img
            src="//repo.bfw.wiki/bfwrepo/image/6284289d87d73.png"
            alt=""
          />
          <div class="copy">
            <h1>Lorem, ipsum.</h1>
          </div>
        </div>

        <div class="card">
          <img
            src="//repo.bfw.wiki/bfwrepo/image/628435eb01be2.png"
            alt=""
          />
          <div class="copy">
            <h1>Lorem, ipsum.</h1>
          </div>
        </div>

        <div class="card">
          <img
            src="//repo.bfw.wiki/bfwrepo/image/62af9cad6c5db.png"
            alt=""
          />
          <div class="copy">
            <h1>Lorem, ipsum.</h1>
          </div>
        </div>
      </div>
    </div>
<.........完整代码请登录后点击上方下载按钮下载查看

网友评论0