svg实现视频背景蒙版滚动效果代码

代码语言:html

所属分类:背景

代码描述:svg实现视频背景蒙版滚动效果代码

代码标签: svg 视频 背景 蒙版 滚动

下面为部分代码预览,完整代码请点击下载或在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('//repo.bfw.wiki/bfwrepo/css/normalize.5.0.css') layer(normalize);

@layer normalize, base, demo, scroll, debug;

@layer scroll {
  @supports (animation-timeline: scroll()) {
    @property --active {
      initial-value: 0;
      inherits: true;
      syntax: '<number>';
    }

    p span {
      -webkit-animation: activate both ease-in-out;
              animation: activate both ease-in-out;
      animation-timeline: view();
      opacity: 0;
    }

    @-webkit-keyframes activate {
      50% {
        opacity: 1;
      }
    }

    @keyframes activate {
      50% {
        opacity: 1;
      }
    }

    :root {
      --scroll-ease: linear(
        -0 0%,
        0.0048 9.8%,
        0.0192 19.5%,
        0.043 29.02%,
        0.0761 38.26%,
        0.1181 47.13%,
        0.1685 55.56%,
        0.227 63.44%,
        0.2929 70.71%,
        0.3656 77.3%,
        0.4445 83.15%,
        0.5285 88.19%,
        0.6173 92.39%,
        0.7099 95.7%,
        0.805 98.08%,
        0.9021 99.52%,
        1 100%
      );
    }

    .section__content svg:nth-of-type(1) path {
      --dest: 0;
      stroke-dashoffset: 1.025;
      stroke-dasharray: 1.025;
      -webkit-animation: draw both var(--scroll-ease);
              animation: draw both var(--scroll-ease);
      animation-timeline: view();
      animation-range: entry 25% entry 75%;
    }

    .section__content {
      margin-bottom: 15vh;
    }

    .section__buffer {
      position: absolute;
      top: 100%;
      left: 0;
      right: 0;
      height: 15vh;
  .........完整代码请登录后点击上方下载按钮下载查看

网友评论0