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

css 边框流光效果

旋转流光

// html
<div class="demo">
  <div class="demo-content">
    旋转流光
  </div>
</div>
------------------------------------------------------
// 样式
body {
  background-color: black;
}

:root {
  --outer-radius: 0.5rem;
  --border-size: 5px;
}

@property --border-gradient-angle {
  syntax: "<angle>";
  inherits: true;
  initial-value: 0turn;
}

.demo {
  background-image: conic-gradient(from var(--border-gradient-angle) at 50% 50%, transparent, #70ffaf 14%, transparent 17%);
  border-radius: var(--outer-radius);
  background-size: contain;
  padding: var(--border-size);
  animation: buttonBorderSpin 9s linear infinite 0ms;
  width: 300px;
  height: 200px;
}

@keyframes buttonBorderSpin {
  0% {
    --border-gradient-angle: 0turn;
  }

  100% {
    --border-gradient-angle: 1turn;
  }
}

.demo-content {
  width: 100%;
  height: 100%;
  background-color: black;
}

平移流光

// html
<div class="demo2">
  <div class="demo2-content">
    平移流光
  </div>
</div>
----------------------------------------------------------------
// 样式
:root {
  --outer-radius: 0.5rem;
  --border-size: 5px;
}

@property --border-gradient-angle {
  syntax: "<angle>";
  inherits: true;
  initial-value: 0turn;
}
.demo {
  margin-top: 10px;
  height: 50px;
  width: 300px;
  background-image: conic-gradient(from var(--border-gradient-angle) at 30% -30%, transparent 25%, #70ffaf 75%, transparent);
  animation: badgeBorderSpin 10s linear infinite;
  border-radius: var(--outer-radius);
  padding: var(--border-size);
}

@keyframes badgeBorderSpin {
  0% {
    --border-gradient-angle: 0turn;
  }

  100% {
    --border-gradient-angle: -1turn;
  }
}

.demo-content {
  width: 100%;
  height: 100%;
  background-color: black;
}

http://www.kler.cn/news/327766.html

相关文章:

  • 算法刷题笔记 约数个数(详细注释的C++实现)
  • 钉钉如何请求webhook发送信息
  • 基于JAVA+SpringBoot+Vue的校园商铺管理系统
  • Java之线程篇七
  • 解读 Story Protocol:IP 与区块链的潜力与障碍
  • 从零开始Ubuntu24.04上Docker构建自动化部署(四)Docker安装gitlab
  • 微信小程序转化为uni-app项目
  • 这个科技工厂藏着拼多多的「数字田园梦」
  • OpenHarmony(鸿蒙南向)——平台驱动指南【PWM】
  • 学Java还是c++好?
  • 如何在字节跳动的marscode上部署AI API,却意外地将功能搞废了?——分享踩坑经历
  • SpringCloud源码:服务端分析(二)- EurekaServer分析
  • 滚雪球学Oracle[1.1讲]:Oracle数据库基础概念
  • RabbitMQ高级特性-发送方确认
  • 使用scroll-behavior属性实现页面平滑滚动的几个问题
  • 力扣经典笔试题 最小K个数 小根堆 大根堆 快速排序 一题多解
  • C语言初识(二)
  • Springboot项目实现easyExcel批量导入到数据库
  • Python人工智能使用OpenCV进行图片形状的中心检测
  • linux 查看端口占用
  • 利用SpringBoot构建高效社区医院平台
  • 大数据埋点方案Openresty+Nginx+Lua踩坑日志
  • QSpice (9) --结合Python仿真
  • PostgreSQL是否有等待事件
  • Android常用C++特性之std::abs
  • Clickhouse分布式表初体验
  • python的内存管理机制
  • DOM元素导出图片与PDF:多种方案对比与实现
  • 数据集-目标检测系列-豹子 猎豹 检测数据集 leopard>> DataBall
  • 线程池:线程池的实现 | 日志