gsap实现炫酷图片堆叠散开排列拖动动画效果代码

代码语言:html

所属分类:动画

代码描述:gsap实现炫酷图片堆叠散开排列拖动动画效果代码,图片密集堆叠出场,然后散开圆弧排列,这个时候可用鼠标拖动选择。

代码标签: gsap 炫酷 图片 堆叠 散开 排列 拖动 动画

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

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

<head>
    <meta charset="UTF-8">
<style>
    *,
*::after,
*::before {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: black;
  background-color: white;
  font-weight: 600;
  width: 100%;
  overflow-x: hidden;
}

.container {
  width: 100vw;
  height: 100vh;
  height: -webkit-fill-available;
  position: absolute;
  left: 0;
  top: 0;
  user-select: none;
  overflow: hidden;
}

.center {
  height: 100vh;
  position: absolute;
  left: 50%;
  top: 28%;
  transform: translate(-50%);
  user-select: none;
}

.items {
  transform-origin: center 200vh;
  transform: rotate(0);
  user-select: none;
  display: flex;
}

.item {
  position: absolute;
  user-select: none;
  cursor: pointer;
  transform: translateX(-50%);
}

.card {
  display: block;
  width: 430px;
  height: 610px;
  color: #fff;
  user-select: none;
  border-radius: 17px;
  overflow: hidden;
  cursor: grab;
  position: relative;
  border: 10px solid black;
}

.image {
  height: 100%;
  width: 100%;
  object-fit: cover;
  position: absolute;
  top: 0;
  left: 0;
  filter: grayscale(100);
  pointer-events: none;
}

@media screen and (max-height: 1000px) {
  .card {
    width: 350px;
    height: 497px;
  }
}

@media screen and (max-height: 800px) {
  .card {
    width: 300px;
    height: 400px;
  }
}

.info {
  position: absolute;
  z-index: 20;
  top: 10px;
  left: 10px;
}

a {
  color: black;
  opacity: 80;
  text-decoration: underline;
}
</style>

</head>

<body>
    <!-- partial:index.partial.html -->


    <div class="container">
        <div class="center">
            <div class="items">
                <div class="item">
                    <div class="card">
                        <img class="image" src="//repo.bfw.wiki/bfwrepo/image/5fc1ae951e91a.png" />
                    </div>
                </div>
                <div class="item">
                    <div class="card">
                        <img class="image" src="//repo.bfw.wiki/bfwrepo/image/5fc1aecf36d5a.png" />
                    </div>
                </div>
                <div class="item">
                    <div class="card">
                        <img class="image" src="//repo.bfw.wiki/bfwrepo/image/5fc1af0ba6cc8.png" />
                    </div>
                </div>
                <div class="item">
                    <div class="card">
                        <img class="image" src="//repo.bfw.wiki/bfwrepo/image/5fe1bc8e0ed82.png" />
                    </div>
                </div>
                <div class="item">
                    <div class="card">
                        <img class="image" src="//repo.bfw.wiki/bfwrepo/image/5fe1bcbdf1b79.png" />
                    </div>
                </div>
                <div class="item">
                    <div class="card">
                        <img class="image" src="//repo.bfw.wiki/bfwrepo/image/5fe1bd1861604.png" />
                    </div>
                </div>
                <div class="item">
                    <div class="card">
                        <img class="image" src="//repo.bfw.wiki/bfwrepo/image/61c837d449c88.png" />
                    </div>
                </div>
                <div class="item">
                    <div class="card">
                        <img class="image" src="//repo.bfw.wiki/bfwrepo/image/6454c4ca0d59b.png" />
                    </div>
                </div>
                <div class="item">
                    <div class="card">
                        <img class="image" src="//repo.bfw.wiki/bfwrepo/image/6454c4fd64064.png" />
                    </div>
                </div>
                <div class="item">
                    <div class="card">
                        <img class="image" src="//repo.bfw.wiki/bfwrepo/image/6454c5130564f.png" />
                    </div>
                </div>
                <div class="item">
                    <div class="card">
                        <img class="image" src="//repo.bfw.wiki/bfwrepo/image/5fe1bd1861604.png" />
                    </div>.........完整代码请登录后点击上方下载按钮下载查看

网友评论0