gsap实现网页滚动文字上下滑动效果代码

代码语言:html

所属分类:加载滚动

代码描述:gsap实现网页滚动文字上下滑动效果代码

代码标签: gsap 网页 滚动 文字 上下 滑动

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

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

<head>
  <meta charset="UTF-8">
  
  <meta
      name="viewport"
      content="width=device-width, initial-scale=1, user-scalable=0, maximum-scale=1.0"
    />
  

  
<style>
@import url('https://fonts.googleapis.com/css2?family=Geist:wght@100..900&display=swap');
@import url('//repo.bfw.wiki/bfwrepo/css/normalize.5.0.css') layer(normalize);

@layer normalize, base, demo, stick, effect, srollbar;

@layer scrollbar {
  @property --scroller {
    initial-value: 0;
    syntax: '<number>';
    inherits: true;
  }
  @property --chroma {
    initial-value: 0;
    syntax: '<number>';
    inherits: true;
  }
  
  [data-sync-scrollbar='false'] {
    scrollbar-color: light-dark(black, white) #0000;
  }

  [data-sync-scrollbar='true'] {
    scrollbar-color: oklch(var(--lightness) var(--chroma) var(--scroller)) #0000;
  }
  @supports (animation-timeline: scroll()) and (animation-range: 0% 100%) {
    [data-sync-scrollbar='true'] {
      timeline-scope: --list;
      scrollbar-color: oklch(var(--lightness) var(--chroma, 0) var(--scroller))
        #0000;
      -webkit-animation-name: change, chroma-on, chroma-off;
              animation-name: change, chroma-on, chroma-off;
      -webkit-animation-fill-mode: both;
              animation-fill-mode: both;
      -webkit-animation-timing-function: linear;
              animation-timing-function: linear;
      /* animation-timeline: scroll(root); */
      animation-range: entry 50% exit 50%, entry 40% entry 50%,
        exit 30% exit 40%;
      animation-timeline: --list;
      ul {
        view-timeline: --list;
      }
    }
  }

  @-webkit-keyframes change {
    to {
      --scroller: var(--end);
    }
  }

  @keyframes change {
    to {
      --scroller: var(--end);
    }
  }
  @-webkit-keyframes chroma-on {
    to {
      --chroma: 0.3;
    }
  }
  @keyframes chroma-on {
    to {
      --chroma: 0.3;
    }
  }
  @-webkit-keyframes chroma-off {
    to {
      --chroma: 0;
    }
  }
  @keyframes chroma-off {
    to {
      --chroma: 0;
    }
  }
}

@layer effect {
  :root {
    --start: 0;
    --end: 360;
    --lightness: 65%;
    --base-chroma: 0.3;
  }
  [data-theme='dark'] {
    --lightness: 75%;
  }
  [data-theme='light'] {
    --lightn.........完整代码请登录后点击上方下载按钮下载查看

网友评论0