双层文字扫光效果

文字扫光效果

html 复制代码
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8" />
<title>Animated Shiny Text -- Correct</title>

<style>
  body {
    margin: 0;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    background: #0b0b0b;
    font-family: system-ui, -apple-system, BlinkMacSystemFont;
  }

  .shiny-wrapper {
    position: relative;
    font-size: 64px;
    font-weight: 700;
    line-height: 1.2;
  }

  /* 底层文字(永远可见) */
  .shiny-base {
    color: rgba(229, 231, 235, 0.7);
  }

  /* 上层扫光 */
  .shiny-overlay {
    position: absolute;
    inset: 0;
    color: transparent;

    background-image: linear-gradient(
      90deg,
      transparent,
      rgba(255, 255, 255, 0.9),
      transparent
    );
    background-repeat: no-repeat;
    background-size: 120px 100%;
    background-position: 0 0;

    -webkit-background-clip: text;
    background-clip: text;

    animation: shine 1.5s linear infinite;
    pointer-events: none;
  }

  @keyframes shine {
  from {
    background-position: -120% 0;
  }
  to {
    background-position: 220% 0;
  }
}
</style>
</head>

<body>

<div class="shiny-wrapper">
  <span class="shiny-base">Animate</span>
  <span class="shiny-overlay">Animate</span>
</div>

</body>
</html>
相关推荐
狒狒AI3 分钟前
Remotion / GSAP+Three / HyperFrames / Skia 四栈实测:代码渲染知识视频的选栈方法(附开源技能)
前端·人工智能·aigc
修炼的dance4 分钟前
浏览器里导出H.265,8.5秒和55.5秒差在硬件
前端
补码缩写5 分钟前
WebCodecs选编码器,探测之后还要验解码和播放
前端
大文说跨境6 分钟前
亚马逊多账号管理浏览器怎么选?云登/紫鸟/AdsPower 对比
java·前端·自动化
hunter_0768 分钟前
iOS 首页复杂嵌套滚动技术方案:头部固定 + 网格滚动 + Tab 吸顶 + 每 Tab 独立下拉刷新
前端
CoderYanger21 分钟前
Java EE 进阶:4.Spring Web MVC 入门(第一弹)
java·开发语言·前端·spring·面试·java-ee·mvc
用户27886072856722 分钟前
fallback 会盖掉平台提示词:system、空数组和 systemAppend 的差别
前端·后端
peach24 分钟前
大模型和传统编程:同为程序,差异不在硬件,在"逻辑从哪来"
前端
ALONE阿龙太原微码33 分钟前
微信小程序包体积优化:2MB 到 400KB 的实操记录
前端
掘金挖土35 分钟前
前端手摸手跑路之 AI 应用开发(十一)
前端·后端