当前位置: 首页 > web >正文

文字光影扫过动效

列子1

<!DOCTYPE html>
<html lang="zh-CN">
<head><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><title>光影扫过文字动效</title><style>body {display: flex;justify-content: center;align-items: center;min-height: 100vh;background-color: #222;margin: 0;font-family: 'Arial', sans-serif;}.text-container {position: relative;font-size: 5rem;font-weight: bold;color: #333;text-transform: uppercase;letter-spacing: 3px;}.text {position: relative;display: inline-block;}.light-overlay {position: absolute;top: 0;left: 0;width: 100%;height: 100%;background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.8), transparent);background-size: 200% 100%;background-position: -100% 0;-webkit-background-clip: text;background-clip: text;color: transparent;animation: lightSweep 3s infinite ease-in-out;}@keyframes lightSweep {0% {background-position: -100% 0;}50% {background-position: 100% 0;}100% {background-position: -100% 0;}}</style>
</head>
<body>
<div class="text-container"><div class="text">光影扫过效果</div><div class="light-overlay">光影扫过效果</div>
</div>
</body>
</html>

例子2

<template><div class="wrapperStyle" :style="wrapperStyle" style="text-align:left;"><!-- <div>{{ item.textName }}</div> --><div class="text-container"><div class="text">{{ item.textName }}</div><div class="light-overlay">{{ item.textName }}</div></div></div>
</template><script setup>
const props = defineProps({item: {type: Object,default: {},},editOrPreview: {type: String,default: "edit",}
});
const { proxy } = getCurrentInstance();
const wrapperStyle = computed(() => {return proxy.componentStyle(props.item, props.editOrPreview);
});const radiantTextStyle       = computed(() => {return {radiantBackgroundColor:props.item.radiantBackgroundColor || 'transparent',}
});
</script><style lang="scss" scoped>
@import "@/views/lowCode/myMoveable/styles/custom-low-code.scss";.text-container {--radiant-background-color: v-bind(radiantTextStyle.radiantBackgroundColor);position: relative;// font-size: 5rem;// font-weight: bold;// color: #fff;// text-transform: uppercase;// letter-spacing: 3px;
}.text {position: relative;display: inline-block;
}.light-overlay {position: absolute;top: 0;left: 0;width: 100%;height: 100%;background: linear-gradient(90deg, transparent, var(--radiant-background-color), transparent);background-size: 200% 100%;background-position: -100% 0;-webkit-background-clip: text;background-clip: text;color: transparent;animation: lightSweep 3s infinite ease-in-out;
}@keyframes lightSweep {0% {background-position: -100% 0;}50% {background-position: 100% 0;}100% {background-position: -100% 0;}
}
</style>
http://www.xdnf.cn/news/2431.html

相关文章:

  • 1999-2022年各省研究与试验发展经费内部支出数据/研发经费内部支出数据/RD经费内部支出数据
  • 鸿蒙NEXT开发正则工具类(ArkTs)
  • Qt/C++开发监控GB28181系统/设备注册/设备注销/密码认证/心跳保活/校时
  • [MCU]SRAM
  • JVM指令手册:深入理解字节码执行机制
  • 图像生成新势力:GPT-Image-1 与 GPT-4o 在智创聚合 API 的较量
  • 大数据学习栈记——Hive4.0.1安装
  • 整合 | 大模型时代:微调技术在医疗智能问答矩阵的实战应用20250427
  • 正则表达式详解
  • π0.5:带开放世界泛化的视觉-语言-动作模型
  • C++学习:六个月从基础到就业——模板编程:模板特化
  • web字符转义
  • Maven概述
  • Leetcode837.新21点
  • GRS认证审核内容?GRS认证基本概述?GRS认证的好处?
  • 【应用密码学】实验二 分组密码(2)
  • 「浏览器即OS」:WebVM技术栈如何用Wasm字节码重构冯·诺依曼体系?
  • 革新桌面自动化:微软UFO²操作系统深度解析与未来展望
  • C++笔记-模板进阶和继承(上)
  • 最佳实践-HENGSHI SENSE 可视化创作中如何引入数据集市的成果
  • 企业数据赋能 | 应用模板分享:汽车销售仪表板
  • Ubuntu下MySQL的安装
  • 前端高频面试题day2
  • 【MySQL】表的CRUD
  • 第1讲、#PyTorch教学环境搭建与Tensor基础操作详解
  • 计算机网络学习笔记 4-6章
  • 量子网络:构建未来通信的超高速“高速公路”
  • css面板视觉高度
  • 爬虫技术入门:基本原理、数据抓取与动态页面处理
  • Git 全面解析:从核心概念到生态应用