gsap实现海底鬼鱼动画效果代码

代码语言:html

所属分类:动画

代码描述:gsap实现海底鬼鱼动画效果代码

代码标签: 鬼鱼 动画 效果

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

<!DOCTYPE html>

<html lang="en">

<head>

    <meta charset="UTF-8">





    <style>
        body {
          min-height: 100vh;
          width: 100vw;
          display: flex;
          justify-content: center;
          margin: 0;
          flex-direction: column;
          background: lightblue;
          overflow: hidden;
        }
        
        .jellyfish-area {
          display: block;
          padding: 40px;
          width: 100%;
          flex-grow: 1;
          text-align: center;
          margin: auto;
          margin-top: 0;
          background: linear-gradient(180deg, #00acc1, #064273);
        }
        
        #jellyfish {
          max-height: 80vh;
          margin: auto;
          overflow: visible;
          opacity: 0.8;
        }
        
        #jellyfish .body, #jellyfish .tentacle {
          filter: drop-shadow(0 0 5px rgba(255, 255, 255, 0.3));
        }
        
        .body {
          fill: rgba(255, 255, 255, 0.4);
          stroke: #fff;
          stroke-width: 0.1;
          opacity: 0.6;
        }
        
        .tentacle.outer {
          fill: rgba(255, 255, 255, 0.28);
        }
        
        .tentacle.alt {
          visibility: hidden;
        }
        
        .tentacle.inner, .tentacle.middle {
          stroke: #fff;
          stroke-width: 3;
          fill: none;
          opacity: 0.3;
        }
        
        .waves-area {
          position: relative;
          align-self: flex-start;
          margin: 0;
          margin-top: 20px;
          width: 100%;
        }
        .waves-area svg {
          width: 100%;
          display: block;
          height: 15vh;
          position: relative;
        }
        
        .parallax > use {
          transform: translate3d(0px, 0, 0);
          animation: move-forever 19s cubic-bezier(0.55, 0.5, 0.45, 0.5) infinite;
        }
        
        .parallax > use:nth-child(1) {
          animation-delay: -2s;
          animation-duration: 6s;
        }
        
        .parallax > use:nth-child(2) {
          animation-delay: -3s;
          animation-duration: 19s;
        }
        
        .parallax > use:nth-child(3) {
          animation-delay: -4s;
          animation-duration: 13s;
        }
        
        .parallax > use:nth-child(4) {
          animation-delay: -5s;
          animation-duration: 17s;
        }
        
        @keyframes move-forever {
          0% {
            transform: translate3d(-90px, 0, 0);
          }
          100% {
            transform: translate3d(85px, 0, 0);
          }
        }
    </style>



</head>

<body>
    <!-- waves adapted from this pen by GoodKatz https://codepen.io/goodkatz/pen/LYPGxQz -->
    <div class="waves-area">
        <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 24 150 28" style="enable-background:new 0 0 36 30;" preserveAspectRatio="none" shape-rendering="auto" id="waves">
        <defs>
<path id="moving-wave" d="M-160 44c30 0 58-18 88-18s 58 18 88 18 58-18 88-18 58 18 88 18 v44h-352z" >
</defs>

<g class="parallax">
<use xlink:href="#moving-wave" x="48" y="0" fill="rgba(6,66,115,0.8)" />
<use xlink:href="#moving-wave" x="48" y="3" fill="rgba(84,58,183,0.7)" />
<use xlink:href="#moving-wave" x="48" y="5" fill="rgba(29,162,216,0.8)" />
<use xlink:href="#moving-wave" x="48" y="7" fill="rgba(0,172,193,1)" />
</g>
    </svg>
    </div>
    <div class="jellyfish-area">

        <svg version="1.1" id="jellyfish" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 130 130" style="enable-background:new 0 0 130 130;" xml:space="preserve">

<path class="body" d="M52,34.6c0.1,0.1,0.4,0.4,0.5,0.5c1.9,1.9,4.5,1.3,5.6,0.9c-0.8-6-0.7-10.5-0.7-10.5c0.8,6.3,1.5,9.3,1.8,10.6
	c2.8,2.3,5.8,0.1,5.8,0.1s2.9,2.1,5.7-0.1c0.4-1.3,1.1-4.2,1.8-10.7c0,0,0.1,4.3-0.8,10.4c1.1,0.4,4,1.2,6.2-1.4c0,0,2.5,1.7,5,0.1
	c0.4-0.8,1.2-3.5,2.1-11.4c0,0,0.3,4.4-0.4,10.5c0.9,0.4,3.2,0.8,5.2-1.5l2.1-4.6c1.9-5.4,0.5-11.4-3.6-15.5
	c-0.1-0.1-0.1-0.1-0.2-0.2c-3.7-3.6-8.6-6.2-12.8-7.1C68.9,3.3,65,4.2,65,4.2S62,3,54.7,4.8c-4.1,1-9,3.5-12.8,7.1
	c-4.2,4.1-5.8,10.2-3.8,15.7l1.6,4.8c0.1,0.1,0.2,0.2,0.3,0.3c1.8,1.8,3.7,1.4,4.7,1.1c-0.6-5.9-0.4-10-0.4-10
	c0.7,6.4,1.4,9.3,1.8,10.7C48.5,36.8,52,34.6,52,34.6z"/>
<g>

		<path class="tentacle middle left" d="M52.4,38.5c0,4.6-2.6,4.6-2.6,9.3c0,4.6,2.6,4.6,2.6,9.3c0,4.6-2.6,4.6-2.6,9.3c0,4.6,2.6,4.6,2.6,9.3
			c0,4.6-2.6,4.6-2.6,9.3c0,4.6,2.6,4.6,2.6,9.3s-2.6,4.6-2.6,9.3"/>

		<path class="tentacle middle left alt" d="M52.6,38.5c0,6.2-3,6.2-3,12.5c0,6.2,3,6.2,3,12.5c0,6.3-3,6.3-3,12.5c0,6.2,3,6.2,3,12.5c0,6.3-3,6.3-3,12.5
			c0,6.3,3,6.3,3,12.5"/>

</g>
<g>

		<path class="tentacle middle right alt" d="M80.1,38.5c0,4.6-2.6,4.6-2.6,9.3c0,4.6,2.6,4.6,2.6,9.3c0,4.6-2.6,4.6-2.6,9.3c0,4.6,2.6,4.6,2.6,9.3
			c0,4.6-2.6,4.6-2.6,9.3c0,4.6,2.6,4.6,2.6,9.3s-2.6,4.6-2.6,9.3"/>

		<path class="tentacle middle right" d="M80.3,38.5c0,6.2-3,6.2-3,12.5c0,6.2,3,6.2,3,12.5c0,6.3-3,6.3-3,12.5c0,6.2,3,6.2,3,12.5c0,6.3-3,6.3-3,12.5
			c0,6.3,3,6.3,3,12.5"/>

</g>
<g>
		<path class="tentacle left inner" d="M62.1,40.8c0,5.4-3.4,5.4-3.4,10.7c0,5.4,3.4,5.4,3.4,10.7c0,5.4-3.4,5.4-3.4,10.7c0,5.4,3.4,5.4,3.4,10.7
			c0,5.4-3.4,5.4-3.4,10.8c0,5.4,3.4,5.4,3.4,10.7c0,5.4-3.4,5.4-3.4,10.8s3.4,5.4,3.4,10.8"/>
		<path class="tentacle left inner alt" d="M61.9,40.8c0,4.7-3,4.7-3,9.4c0,4.7,3,4.7,3,9.4c0,4.7-3,4.7-3,9.4c0,4.7,3,4.7,3,9.4c0,4.7-3,4.7-3,9.4
			.........完整代码请登录后点击上方下载按钮下载查看

网友评论0