双层文字扫光效果

文字扫光效果

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>
相关推荐
华玥作者10 小时前
[特殊字符] VitePress 对接 Algolia AI 问答(DocSearch + AI Search)完整实战(下)
前端·人工智能·ai
Mr Xu_11 小时前
告别冗长 switch-case:Vue 项目中基于映射表的优雅路由数据匹配方案
前端·javascript·vue.js
前端摸鱼匠11 小时前
Vue 3 的toRefs保持响应性:讲解toRefs在解构响应式对象时的作用
前端·javascript·vue.js·前端框架·ecmascript
sleeppingfrog11 小时前
zebra通过zpl语言实现中文打印(二)
javascript
lang2015092811 小时前
JSR-340 :高性能Web开发新标准
java·前端·servlet
好家伙VCC12 小时前
### WebRTC技术:实时通信的革新与实现####webRTC(Web Real-TimeComm
java·前端·python·webrtc
未来之窗软件服务12 小时前
未来之窗昭和仙君(六十五)Vue与跨地区多部门开发—东方仙盟练气
前端·javascript·vue.js·仙盟创梦ide·东方仙盟·昭和仙君
baidu_2474386112 小时前
Android ViewModel定时任务
android·开发语言·javascript
嘿起屁儿整13 小时前
面试点(网络层面)
前端·网络
VT.馒头13 小时前
【力扣】2721. 并行执行异步函数
前端·javascript·算法·leetcode·typescript