gsap+svg实现拖动液体弯曲动画切换效果代码

代码语言:html

所属分类:拖放

代码描述:gsap+svg实现拖动液体弯曲动画切换效果代码

代码标签: 液体 弯曲 动画 切换 效果

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


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

<head>

  <meta charset="UTF-8">


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

body {
  background-color: #fff;
  overflow-x: hidden;
  font-family: "Helvetica Neue", Helvetica, sans-serif;
  font-size: 0.8em;
  color: #3D4773;
}

.background {
  position: fixed;
  width: 100vw;
  height: 100vh;
}

.sliderContainer {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 320px;
  height: 550px;
}

.sliderParent {
  position: relative;
  overflow: hidden;
  border-radius: 20px;
  width: 100%;
  height: 100%;
  background-color: white;
  box-shadow: 0.5rem 1rem 3rem rgba(0, 0, 0, 0.4);
}

.slider {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 330px;
  height: 560px;
  cursor: -webkit-grab;
  cursor: grab;
}

.text {
  position: absolute;
  top: 60px;
  left: 60px;
  z-index: 2;
  font-size: 1.2em;
  opacity: 0;
  transition: opacity 0.2s;
  transform: translateZ(0);
  line-height: 1.8;
}
.text-1 {
  letter-spacing: 10px;
  font-size: inherit;
  text-transform: uppercase;
}

.fadeIn {
  opacity: 1;
}

.hide {
  visibility: hidden;
}

.twitLink {
  width: 35px;
  height: 27px;
  transform: translate(6%, 0%);
  display: inline-block;
  vertical-align: top;
}

.dribLink {
  width: 35px;
  display: inline-block;
  transform: translate(5%, -15%);
}
.dribLink img {
  width: 100%;
  vertical-align: top;
}

svg, path, .slider {
  -webkit-user-select: none;
     -moz-user-select: none;
      -ms-user-select: none;
          user-select: none;
}
</style>



</head>

<body translate="no" >
  <div class="background">
  <svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="100%" height="100%" viewBox="0 0 960 560" preserveAspectRatio="xMidYMid slice">
        <path fill="#23F0FF" d="M-6.1,535.9c48-30.2,86.9-85.8,103.6-114.5c18.2-31.4,103.3-166.7,252.9-91.8
	c131.7,65.9,284.2,149.4,476.4,35.5c21-12.4,75.9-57.8,139.2-55V-6.4L830.7-6.3C808.8,26.4,807.7,249,545,165.4S165,199,106.6,263.4
	S-5.9,321.4-5.9,321.4L-6.1,535.9z"/>
        <path fill="#3D4773" d="M-5.8,569.6l-0.2-33.6c48-30.2,86.9-85.8,103.6-114.5c18.2-31.4,103.3-166.7,252.9-91.8
	c131.7,65.9,284.2,149.4,476.4,35.5c21-12.4,76-57.8,139.2-55v259.5"/>
    </svg>
</div>

<div class="sliderContainer">
  <div class="sliderParent">
    <div class="text text-1 fadeIn">
      <p>Glue</p>
      <p>Slider</p>
    </div>
    <div class="text text-2 hide">
      Original Dribbble shot:
     
    </div>
    <div class="text text-3 hide">
      Follow me on Twitter:
      <div class="twitLink">
        <svg viewbox="0 0 35 23" class="china"><a xlink:href="https://twitter.com/AntonMudrenok" target="_blank">
          <path d="M31.3,2.7c-1,0.5-2.2,0.8-3.3,0.9c1.2-0.7,2.1-1.9,2.6-3.2c-1.1,0.7-2.4,1.1-3.7,1.4C25.8,0.7,24.3,0,22.6,0               c-3.2,0-5.8,2.6-5.8,5.8c0,0.5,0.1,0.9,0.1,1.3C12.1,6.9,7.8,4.6,5,1.1C4.5,1.9,4.2,2.9,4.2,4c0,2,1,3.8,2.6,4.8               c-1,0-1.8-0.3-2.6-0.7c0,0,0,0,0,0.1c0,2.8,2,5.2,4.7,5.7c-0.5,0.1-1,0.2-1.5,0.2c-0.4,0-0.7,0-1.1-0.1c0.7,2.3,2.9,4,5.4,4               c-2,1.6-4.5,2.5-7.2,2.5c-0.5,0-0.9,0-1.4-0.1C5.6,22,8.6,23,11.9,23c10.7,0,16.5-8.8,16.5-16.5c0-0.3,0-0.5,0-0.8               C29.5,4.9,30.5,3.9,31.3,2.7z" fill="#55ACEE"></path></a></svg>
      </div>
    </div>

    <div class="slider">
      <svg version="1.1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 320 550">
                <path id="pBot" fill="#3D4773" d="M0,521.6c61.5,4.4,76.9-47.4,157.4-34.4c95.3,15.4,150.5-9,168.9-57.7c15.6-41.3,32.1-271.6,20.1-316.6
	c-8.1-30.3-29-18.2-29-18.2s-32.5,24.5-50.7,61.3c-27.9,56.6-35.3,79.3-78.5,103.1c-52.2,28.7-79.5,4.8-123.5,3.3
	c-47.3-1.6-67.7,10-85.3,30c-25.5,29-42,53.8-41.5,94.8c0.3,28.8-2.6,82.6,7,113C-53.6,505-71.7,516.5,0,521.6z"/>
                <path id="pTop" fill="#23F0FF" d="M-12,348.3c12-8.7,36.3-30,76.3-23.6c40.3,0.7,103.2,17.6,152.5-15.8c26.1-17.7,48.5-49.6,61.5-105.6
	c9.3-40,34.7-55.3,41.7-55.3s67.5-16.1,64.3-65.8C381,30,263.7-174.7,196-187c-17.7-5.7-32.3,15.3-41.7,55.3
	c-13.1,56-35.4,87.9-61.5,105.6C43.5,7.3-19.4-9.7-59.7-10.3c-47.3-0.8-50.7,29.7-52.4,53C-113.7,64.9-96.4,229-82.3,275
	C-64.3,334-33.3,364.3-12,348.3z"/>
            </svg>
    </div>
  </div>
</div>


<script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/jquery.3.4.1.js"></script>
<script type="text/jav.........完整代码请登录后点击上方下载按钮下载查看

网友评论0