在透镜圆正中加了一个描边空心字

在透镜圆正中加了一个描边空心字,默认用「码」(想换「舒」或任何字,改 <text> 里的字即可):

svg 复制代码
<svg xmlns="http://www.w3.org/2000/svg" width="240" height="240" viewBox="0 0 240 240">
  <defs>
    <clipPath id="bA"><rect x="10" y="10" width="220" height="220" rx="50"/></clipPath>
    <linearGradient id="bAbg" x1="0" y1="0" x2="0" y2="1">
      <stop offset="0%" stop-color="#FBFCFF"/><stop offset="100%" stop-color="#E9EDF6"/>
    </linearGradient>
    <linearGradient id="bAlens" x1="0" y1="0" x2="0" y2="1">
      <stop offset="0%" stop-color="#FFFFFF" stop-opacity="0.55"/>
      <stop offset="100%" stop-color="#FFFFFF" stop-opacity="0.15"/>
    </linearGradient>
    <linearGradient id="bAring" x1="0" y1="0" x2="1" y2="1">
      <stop offset="0%" stop-color="#0A84FF"/><stop offset="50%" stop-color="#BF5AF2"/>
      <stop offset="100%" stop-color="#FF375F"/>
    </linearGradient>
    <filter id="bAb" x="-60%" y="-60%" width="220%" height="220%"><feGaussianBlur stdDeviation="24"/></filter>
    <filter id="bAb2" x="-60%" y="-60%" width="220%" height="220%"><feGaussianBlur stdDeviation="3"/></filter>
  </defs>
  <g clip-path="url(#bA)">
    <rect x="10" y="10" width="220" height="220" fill="url(#bAbg)"/>
    <circle cx="56" cy="62" r="52" fill="#9EC1FF" opacity="0.6" filter="url(#bAb)"/>
    <circle cx="190" cy="52" r="46" fill="#D9B3FF" opacity="0.55" filter="url(#bAb)"/>
    <circle cx="186" cy="194" r="50" fill="#FFC2D4" opacity="0.55" filter="url(#bAb)"/>
    <circle cx="52" cy="190" r="46" fill="#B3E5FF" opacity="0.5" filter="url(#bAb)"/>
    <circle cx="120" cy="120" r="80" fill="url(#bAlens)"/>
    <circle cx="120" cy="120" r="80" fill="none" stroke="url(#bAring)" stroke-width="2" opacity="0.45" filter="url(#bAb2)"/>
    <circle cx="120" cy="120" r="77.5" fill="none" stroke="#FFFFFF" stroke-width="1.2" opacity="0.9"/>
    <path d="M64,74 A70,70 0 0 1 158,52" fill="none" stroke="#FFFFFF" stroke-width="5"
          stroke-linecap="round" opacity="0.85" filter="url(#bAb2)"/>
    <text x="120" y="156" font-family="KaiTi, STKaiti, 'Noto Serif SC', serif" font-size="100" font-weight="bold"
          fill="none" stroke="#FFFFFF" stroke-width="2.5" text-anchor="middle">舒</text>
  </g>
  <rect x="10" y="10" width="220" height="220" rx="50" fill="none" stroke="#FFFFFF" stroke-width="1.5" opacity="0.8"/>
</svg>

关键参数说明:

  • 居中 :x="120" + text-anchor="middle" 水平居中;y="156" 是按字号 100 算出的视觉垂直居中基线(字面中心落在 120)
  • 不超出圆:字号 100 的汉字约占 100×100px,透镜圆直径 160px,四周留白约 30px;想再大可以到 110,再大就会顶到彩色环
  • 透明填充 + 白描边 :fill="none" stroke="#FFFFFF" stroke-width="2.5",呈现空心描边字
    一个提醒:中心背景接近白色,纯白描边对比度低,会呈现「幽灵字」效果(若这是你要的通透感就没问题)。如果觉得太淡,两个微调方向任选:
  1. 描边加粗:stroke-width 调到 3.5~4
  2. 描边换成淡色系统色,比如 stroke="#5E5CE6"(紫)或 stroke="#0A84FF"(蓝),和边缘色差环呼应,同时保持空心感。
相关推荐
定栓1 小时前
Vite-legacy产物console删除机制
前端·javascript·vue.js
程序员大阳9 小时前
副队长JavaScript教程(49)-主动抛出异常与错误类型
javascript·异常处理·error·throw·错误类型
hhhjhl9 小时前
Protobuf.js 跨端三方库仓颉适配全流程
javascript·网络·udp
康小汪9 小时前
AI 写 Vue 总写成同一个味道:给它装 Skills,装的不是知识是边界
前端·vue.js·人工智能·ai编程·最佳实践
智能运维指南10 小时前
研制过程“两张皮“怎么破:研制一体化支撑平台的定位、能力边界与落地前提
java·前端·人工智能·嘉为蓝鲸
白山编程大哥12 小时前
Java 后端如何优雅地把 List 集合返回给前端
java·前端·list
Flynt12 小时前
我把热榜那篇"禁用 axios"逐条实测了一遍:结论大体对,坑在它没讲的地方
前端·javascript·axios
Csvn13 小时前
bundle优化
前端
slongzhang_13 小时前
linux 递归删除源码文件|递归删除目录下 *.js,但排除 *.min.js
linux·开发语言·javascript