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" styl.........完整代码请登录后点击上方下载按钮下载查看

网友评论0