css实现光线滚动条效果代码

代码语言:html

所属分类:加载滚动

代码描述:css实现光线滚动条效果代码,像探照灯一样将滚动的文字区域照亮。

代码标签: css 光线 滚动条

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

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

<head>
  <meta charset="UTF-8">
  

  
  
  
<style>
@property --scroll-y-position {
  syntax: "<percentage>";
  initial-value: -10%;
  inherits: false;
}
@property --reflection-y-position {
  syntax: "<percentage>";
  initial-value: -50%;
  inherits: false;
}
@property --scrollbar-color {
  syntax: "<color>";
  inherits: false;
  initial-value: transparent;
}
@property --opacity-1 {
  syntax: "<number>";
  inherits: false;
  initial-value: 0.1;
}
@property --opacity-2 {
  syntax: "<number>";
  inherits: false;
  initial-value: 0.1;
}
@property --opacity-3 {
  syntax: "<number>";
  inherits: false;
  initial-value: 0.1;
}
@property --opacity-4 {
  syntax: "<number>";
  inherits: false;
  initial-value: 0.1;
}

@property --text-offset-1 {
  syntax: "<number>";
  inherits: false;
  initial-value: 10;
}
@property --text-offset-2 {
  syntax: "<number>";
  inherits: false;
  initial-value: 10;
}
@property --text-offset-3 {
  syntax: "<number>";
  inherits: false;
  initial-value: 10;
}
@property --text-offset-4 {
  syntax: "<number>";
  inherits: false;
  initial-value: 10;
}
html::-webkit-scrollbar {
  display: none;
}
body {
  margin: 0;
  background: black;
  height: 900px;
  font-family: sans-serif;
}
.scrollbar {
  width: 4px;
  height: 100%;
  background-color: var(--scrollbar-color);
  background-image: radial-gradient(
    circle at 0% var(--scroll-y-position),
    rgb(112, 153, 255) 0%,
    rgba(56, 106, 249, 0.79135) 10px,
    rgba(10, 76, 242, 0.53) 20px,
    rgba(255, 255, 255, 0) 40px,
    rgba(49, 49, 49, 0) 100%
  );
  animation: on-scrolling both linear;
  animation-timeline: scroll();
  animation-range: 10vh;
}

.container {
  width: 350px;
  height: 100%;
  background: linear-gradient(
    132deg,
    rgba(255, 255, 255, 0.09) 0%,
    rgba(238, 238, 238, 0.03) 20%,
    rgba(202, 202, 202, 0.04) 70%,
    rgba(171, 171, 171, 0.02) 100%
  );
  border: solid rgba(255, 255, 255, 0.06) 1px;
  margin-left: 15px;
  position: relative;
}
.container::before,
.container::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  display: block;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    180deg,
    rgba(10, 76, 242, 0) 0%,
    rgba(10, 76, 242, 0.75203) 38.288288288288285%,
    rgb(77, 127, 255) 50.9132179054054%,
    rgba(10, 76, 242, 0.75248) 63.06306306306306%,
    rgba(10, 76, 242, 0) 100%
  );
  background-repeat: no-repeat;
  background-position-y: var(--reflection-y-position);
  animation: on-scrolling both linear;
  animation-timeline: scroll();
  animation-range: 10vh;
}
.container::before {
  background-size: 1px 150px;
  filter: blur(1px);
}
.container::after {
  background-size: 10px 150px;
  filter: blur(10px);
}

main {
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  margin-top: 40vh;
  padding-bottom: 40vh;
}

p {
  background-image: linear-gradient(
    270deg,
    rgba(255, 255, 255, 0.4) 0%,
    rgba(255, 255, 255, 0.9) 90%,
    rgb(191, 209, 255) 100%
  );
  background-clip: text;
  -webkit-background-clip: text;
  color: transparent;
  padding: 20px;
  line-height: .........完整代码请登录后点击上方下载按钮下载查看

网友评论0