Border Beam new 边框流光 web

PRO Team plan ¥99/mo Upgrade
FREE Starter ¥0/mo Current plan

标本可交互,可以直接操作。

Anatomy — every part, named解剖 —— 每个部件的名字

  1. 1 Border ring边框环 mask-composite

    The 1.5px band where the light is allowed to show.

    允许光显示的 1.5px 边框带。

    Prompt fragmentPrompt 片段

    a 1.5px border ring produced by masking

    用遮罩得到的 1.5px 边框环

  2. 2 Beam光段 conic-gradient

    One short bright segment in an otherwise transparent gradient.

    透明渐变里唯一的一小段亮色。

    Prompt fragmentPrompt 片段

    a conic gradient with one short purple-to-cyan segment

    只有一小段紫到青亮色的锥形渐变

  3. 3 Rotation旋转 --angle

    The gradient's start angle turns to move the beam around.

    渐变起始角度转动,带着光段绕圈。

    Prompt fragmentPrompt 片段

    the start angle rotating 360° every 3.2 seconds

    起始角度每 3.2 秒转 360°

  4. 4 Plain neighbours普通的邻居 —

    Other cards stay plain so the beam marks one choice.

    其它卡片保持普通,流光只标出一个选择。

    Prompt fragmentPrompt 片段

    neighbouring cards left without a beam

    相邻卡片不加流光

Prompt — paste into your agentPrompt —— 直接粘贴给你的代理

Add a border beam to the recommended card: wrap the card in a 1.5px padded container; draw a conic-gradient that is transparent except for one short purple-to-cyan segment, start angle stored in --angle; mask it to the border ring with mask-composite: exclude; rotate --angle 360° every 3.2 seconds (via @property animation or requestAnimationFrame); keep the plain cards without a beam so it highlights one choice; pause offscreen and show a static highlight under prefers-reduced-motion.

给推荐卡片加边框流光:卡片外面包一层 1.5px 内边距的容器;画一个锥形渐变,除了一小段紫到青的亮色外全部透明,起始角度存在 --angle;用 mask-composite: exclude 把它裁到只剩边框那一圈;让 --angle 每 3.2 秒转 360°(用 @property 动画或 requestAnimationFrame);其它卡片保持普通,不加流光,这样才能突出一个选择;离开视口时暂停,prefers-reduced-motion 时显示静态高亮。

Debug prompt — when it misbehaves调试 Prompt —— 当它不听话时

Debug my border beam. Check that the mask leaves only the border visible (not the whole card); the inner card radius is the outer radius minus the border width; the angle animates smoothly in all target browsers (register --angle with @property or drive it from JS); only one card on the screen has a beam; the animation stops offscreen and under reduced motion; and the glow does not get clipped by a parent with overflow: hidden. The symptom:

调试我的边框流光。检查:遮罩是否只露出边框而不是整张卡片;内层卡片圆角是否等于外层圆角减去边框宽度;角度动画在所有目标浏览器里是否顺滑(用 @property 注册 --angle 或用 JS 驱动);屏幕上是否只有一张卡片有流光;离开视口和减少动态效果时动画是否停止;以及光晕是否被父级的 overflow: hidden 裁掉。症状是:

In code代码里叫什么

Framework框架Symbol符号Note说明
CSS conic-gradient(from var(--angle)) a gradient with one bright segment that is rotated over time只有一段亮色、随时间旋转的锥形渐变
CSS mask + mask-composite: exclude cut the gradient down to just the border ring把渐变裁到只剩边框那一圈
CSS @property --angle register the angle so CSS can animate it; or update it from JavaScript注册角度变量让 CSS 能做动画;也可以用 JS 更新
Magic UI <BorderBeam /> a ready-made React component with the same effect现成的 React 组件,效果相同

See also相关词条

我的参考集

组合知名网站、UI 元素、视觉风格和平面设计案例,导出给 AI。

你的下一份设计,从这里开始。

在任意案例旁点击「加入参考」,就能把品牌、组件、风格和平面设计案例组合成一份 AI 设计说明。

搜索参考库Search the library

输入关键词,搜索所有参考。