双层文字扫光效果

文字扫光效果

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>
相关推荐
掘金者阿豪6 分钟前
Codex 怎么突然变慢了?一个需求跑几十分钟,我才发现它的工作方式已经变了
前端·后端
用户9314563556612 分钟前
从 3 秒到 300 毫秒:一次真实的前端首屏性能优化全记录
前端
whn197712 分钟前
dm9安装初体验
前端
阿黎梨梨19 分钟前
从零搞懂 JWT 登录鉴权:一张“电子通行证”的诞生记
前端
全栈项目管理程序猿19 分钟前
ArcGIS JS 基础教程(12):视图截图 takeScreenshot
javascript
用户9210802628619 分钟前
ChatMessageList 消息列表组件:基于 BubbleList 搭建 AI 对话展示区
前端
HjhIron23 分钟前
实战 React + JWT + Zustand:从零搭建登录鉴权系统
前端
小棉花的ai跨境之旅24 分钟前
Codex 子 Agent 分工实战:Sol 当军师、Luna 当搬砖工,单任务成本压到 $0.61
javascript
晴天1644 分钟前
DeepSeek Harness 全景技术解析-Day23
前端·deepseek
风月说与山鬼1 小时前
三、uni-app页面配置(pages.json)
前端·uni-app