返回资讯中心
外部精选
软件工程
#开发者实时流

Kuba's Last Merged Commits 讲述 arthel159 的故事

来源标题:Kuba's Last Merged Commits: the story of arthel159

Kuba's Last Merged Commits 发布了关于 arthel159 的故事。内容涉及在线状态动画的 CSS 实现细节,包括光标动画和姓名着色效果。

Hacker News 最新jMyles2026/11/11 · 6 天前30 分钟阅读

以下正文由 AI 翻译自 Hacker News 最新(原文版权归原站所有),可能存在偏差,重要内容请以原文为准。

nav .nm.live.a-wake, nav .nm.live.a-think { background-size: 100% 100%; --band: calc(100% / var(--n, 8)); } nav .nm.live.a-wake { animation: cursor 3.2s steps(var(--n, 8), jump-start) infinite; background-image: linear-gradient(90deg, var(--muted) calc(var(--at) - var(--band)), var(--who) calc(var(--at) - var(--band)), var(--who) var(--at), var(--muted) var(--at)); } nav .nm.live.a-think { animation: cursor 1.6s steps(var(--n, 8), jump-start) infinite; background-image: linear-gradient(90deg, var(--who) calc(var(--at) - var(--band)), var(--muted) calc(var(--at) - var(--band)), var(--muted) var(--at), var(--who) var(--at)); } /* 一个人正在打字:用思考时的光标,取这个人的颜色(Justin,11 月 1 日);录语音备忘时像工具那样脉动。 名字若是用艺术字写的,则保留其颜色:光标改用一个淡出的字母(即蒙版),步进方式相同。 / nav .nm.live.a-think-art { opacity: 1; --band: calc(100% / var(--n, 8)); animation: cursor 1.6s steps(var(--n, 8), jump-start) infinite; -webkit-mask-image: linear-gradient(90deg, #000 calc(var(--at) - var(--band)), rgba(0,0,0,.25) calc(var(--at) - var(--band)), rgba(0,0,0,.25) var(--at), #000 var(--at)); mask-image: linear-gradient(90deg, #000 calc(var(--at) - var(--band)), rgba(0,0,0,.25) calc(var(--at) - var(--band)), rgba(0,0,0,.25) var(--at), #000 var(--at)); } nav .nm.live.a-remember { background-size: 100% 100%; animation: closeIn 2.6s ease-in-out infinite; background-image: linear-gradient(90deg, var(--who) var(--inset), var(--muted) var(--inset), var(--muted) calc(100% - var(--inset)), var(--who) calc(100% - var(--inset))); } 64% { --inset: 22%; } 80% { --inset: 44%; } } nav .nm.live.a-wiki { opacity: 1; animation: none; } nav .nm.live.a-wiki .l0 { animation: flipA 1.1s steps(1) infinite; } nav .nm.live.a-wiki .l1 { animation: flipB 1.1s steps(1) infinite; } nav .nm.live.a-wiki:not(:has(.l0)) { animation: flipA 1.1s steps(1) infinite; } / 名字以艺术字书写:整体处理 / / 名字按本人的习惯书写:等宽字体,保留空格,就像 BBS 上的样子。 / .art { font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace; white-space: pre; font-size: .95em; } / 每个字符取 ANSI 十六色之一,按 CGA 的顺序,与 BBS 上一致(settings.name_colours)。 / .art .a0 { color: #000000; } .art .a1 { color: #0000aa; } .art .a2 { color: #00aa00; } .art .a3 { color: #00aaaa; } .art .a4 { color: #aa0000; } .art .a5 { color: #aa00aa; } .art .a6 { color: #aa5500; } .art .a7 { color: #aaaaaa; } .art .a8 { color: #555555; } .art .a9 { color: #5555ff; } .art .aa { color: #55ff55; } .art .ab { color: #55ffff; } .art .ac { color: #ff5555; } .art .ad { color: #ff55ff; } .art .ae { color: #ffff55; } .art .af { color: #ffffff; } / 每个字符背后也都有背景,如同 BBS 的单元格有它的底色(iCE 配色:全部十六色)。 / .art .b0 { background: #000000; } .art .b1 { background: #0000aa; } .art .b2 { background: #00aa00; } .art .b3 { background: #00aaaa; } .art .b4 { background: #aa0000; } .art .b5 { background: #aa00aa; } .art .b6 { background: #aa5500; } .art .b7 { background: #aaaaaa; } .art .b8 { background: #555555; } .art .b9 { background: #5555ff; } .art .ba { background: #55ff55; } .art .bb { background: #55ffff; } .art .bc { background: #ff5555; } .art .bd { background: #ff55ff; } .art .be { background: #ffff55; } .art .bf { background: #ffffff; } #lookBox .paint { display: flex; flex-wrap: wrap; gap: 2px; margin: 8px 0 4px; user-select: none; touch-action: none; } #lookBox .paint > span { min-width: 1.35em; height: 1.7em; display: inline-flex; align-items: center; justify-content: center; font: 16px ui-monospace, Menlo, Consolas, monospace; border: 1px solid var(--line); border-radius: 3px; background: var(--code); cursor: crosshair; white-space: pre; } #lookBox .swatches { display: flex; flex-wrap: wrap; gap: 4px; margin: 6px 0; } #lookBox .charsLink { display: inline-block; margin: 8px 0 2px; font: inherit; font-size: 13px; color: var(--accent); background: none; border: 1px solid var(--line); border-radius: 12px; padding: 2px 10px; cursor: pointer; } #lookBox .layer { font-size: 13px; color: var(--muted); display: flex; gap: 12px; align-items: center; margin: 2px 0; } #lookBox .layer label { display: inline-flex; gap: 4px; margin: 0; color: var(--ink); } #lookBox .charsChart { display: grid; grid-template-columns: repeat(16, 1fr); gap: 1px; margin: 4px 0 6px; background: var(--line); border: 1px solid var(--line); } #lookBox .paint > span > span { padding: 0 .12em; } / 字符周围的背景,将按绘制时的样子呈现 / #lookBox .charsChart[hidden] { display: none; } / 否则它的 display: grid 会盖过 [hidden]:它一直关不上 */ #lookBox .charsChart > * { height: 1.75em; display: flex; align-items: center; justify-content: center; background: var(--panel); } #lookBox .charsChart button { border: 0; padding: 0; cursor: pointer; color: var(--ink); font: 15px ui-monospace, Menlo, Consolas, "DejaVu Sans Mono", monospace; } #lookBox .charsChart button:hover { background: var(--accent); color: #fff; } #lookBox .swatches button { width: 22px; height: 22px; padding: 0; border: 1px solid var(--line); border-radius: 4px; } #lookBox .swatches .break { flex-basis: 100%; height: 0; } #lookBox .swatches .any { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; color: var(--muted); margin-left: 4px; } #lookBox .swatches .any input { width: 30px; height: 22px; padding: 0; border: 1px solid var(--line); border-radius: 4px; background: none; } #lookBox .swatches button.on { outline: 2px solid var(--accent); outline-offset: 1px; } #lookBox .swatches .none { background: linear-gradient(135deg, transparent 45%, var(--muted) 45% 55%, transparent 55%), var(--panel); }

(原文较长,此处译出前 6000 字,完整内容请点「打开原文」。)

正文由 探How 从来源站点 RSS 同步,内容未经改写;遇到排版缺失或需要图片、视频时请以原文为准。

打开原文
去社区讨论 →