性能
需注意帧率: 平均 60 fps,p5 59.9 · 长任务: 0 个,共 0 毫秒,最长 0 毫秒 · 源码 gzip 8.5 KB · 运行时 155 KB
ASCII wakeMIT图案Bencho
由 Lorenzo Cabra 制作的图案 React 组件。依据 MIT 许可从 Bencho 原样收录,此处为实时预览。
质量报告
等级和分数来自构建或测试时跑过的自动检查。没跑过的项目会标成「未检测」,不会填假数据。
帧率: 平均 60 fps,p5 59.9 · 长任务: 0 个,共 0 毫秒,最长 0 毫秒 · 源码 gzip 8.5 KB · 运行时 155 KB
问题 0 · 读屏: 通过
没有持续动效
无溢出
帧率和长任务是在无界面的 Chromium 里用软件 WebGL 测的,只适合在本站组件之间比较,不代表真机表现。
不适用:静止时没有可见动画;由悬停触发的动画没有测试。
没有 axe-core 违规。

检测于 2026年11月15日 · 数据来自自动脚本,不是手工填写。
按实际尺寸显示。
复制内容以许可声明开头,使用代码时请保留。
<div id="root"></div>:root{--bg:#f6f4f0;--ink:#17181a;--background:40 20% 96%;--foreground:24 10% 8%;--card:0 0% 100%}html,body{min-height:100%;margin:0;background:var(--bg);color:var(--ink)}html,body{height:100%;overflow:hidden}body{display:grid;place-items:center}#root{display:grid;place-items:center;max-width:100%;max-height:100%;box-sizing:border-box;padding:16px;color:hsl(var(--foreground))}#root.full{width:100%;height:100%;padding:0}@media(prefers-reduced-motion:reduce){*,*::before,*::after{animation-play-state:paused!important;transition-duration:0s!important}}
/*
MIT License
Copyright (c) 2026 Lorenzo Cabra
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
---
Not covered by this licence: the Bencho name and the goat mark, and the
photographs shown on bencho.dev (none are included here). Third-party
material keeps its own licence; see THIRD_PARTY.md.
Icon substitution (this copy only): lucide-react (ISC) was replaced with @tabler/icons-react (MIT).
Sample photographs were replaced with Incidental AI assets. The Bencho name and goat mark are not licensed for marketing use.
*/
/* ── Bencho tokens ─────────────────────────────────────────
The custom properties the free blocks read, at the values
bencho.dev draws them with. Light by default; dark under
[data-theme="dark"] on any ancestor, or automatically with
the system setting unless [data-theme="light"] says otherwise.
Map these to your own theme rather than keeping two: a block
only ever reads the names, never the values. */
:root {
--font-ui: "Inter", "Helvetica Neue", Helvetica, Arial, sans-serif;
--bg: #ffffff;
--board: #ffffff;
--card: #f7f7f6;
--surface: #f7f7f6;
--surface-2: #f1f1f0;
--surface-3: #ecebe7;
--ink: #17181a;
--ink-rgb: 23, 24, 26;
--ink-2: #3c3b37;
--ink-3: #5c5b56;
--ink-4: #6f6e68;
--ink-5: #85847e;
--on-ink: #ffffff;
--on-ink-rgb: 255, 255, 255;
--slab: #17181a;
--on-slab: #ffffff;
--slab-dark: #0e0f11;
--fill-slab: #ffffff;
--fill-on: #17181a;
--fill-on-rgb: 23, 24, 26;
--pane: var(--fill-slab);
--pane-edge: rgba(23, 24, 26, 0.08);
--pane-thumb: rgba(23, 24, 26, 0.07);
--inlay: rgba(255, 255, 255, 0.55);
--inlay-hi: rgba(23, 24, 26, 0.09);
--elev-rgb: 255, 255, 255;
--glass-rgb: 255, 255, 255;
--shadow-rgb: 23, 24, 26;
--wash: 0.06;
--pick: #0d99ff;
--signal: #2231dd;
--focus: #2231dd;
--ok: #15803d;
--ember: #b8431c;
color-scheme: light;
}
[data-theme="dark"] {
--bg: #000000;
--board: #1a1a1a;
--card: #0a0a0a;
--surface: #0f0f0f;
--surface-2: #181818;
--surface-3: #202020;
--ink: #ffffff;
--ink-rgb: 255, 255, 255;
--ink-2: #b4b4b4;
--ink-3: #9a9a9a;
--ink-4: #828282;
--ink-5: #6b6b6b;
--on-ink: #000000;
--on-ink-rgb: 0, 0, 0;
--slab: #1a1a1a;
--on-slab: #ffffff;
--slab-dark: #262626;
--fill-slab: #262626;
--fill-on: #ffffff;
--fill-on-rgb: 255, 255, 255;
--pane-edge: rgba(255, 255, 255, 0.08);
--pane-thumb: rgba(255, 255, 255, 0.07);
--inlay: rgba(255, 255, 255, 0.1);
--inlay-hi: rgba(255, 255, 255, 0.09);
--elev-rgb: 32, 32, 32;
--shadow-rgb: 0, 0, 0;
--wash: 0.09;
--pick: #3aa9ff;
--ok: #34d17a;
color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
:root:not([data-theme="light"]) {
--bg: #000000;
--board: #1a1a1a;
--card: #0a0a0a;
--surface: #0f0f0f;
--surface-2: #181818;
--surface-3: #202020;
--ink: #ffffff;
--ink-rgb: 255, 255, 255;
--ink-2: #b4b4b4;
--ink-3: #9a9a9a;
--ink-4: #828282;
--ink-5: #6b6b6b;
--on-ink: #000000;
--on-ink-rgb: 0, 0, 0;
--slab: #1a1a1a;
--on-slab: #ffffff;
--slab-dark: #262626;
--fill-slab: #262626;
--fill-on: #ffffff;
--fill-on-rgb: 255, 255, 255;
--pane-edge: rgba(255, 255, 255, 0.08);
--pane-thumb: rgba(255, 255, 255, 0.07);
--inlay: rgba(255, 255, 255, 0.1);
--inlay-hi: rgba(255, 255, 255, 0.09);
--elev-rgb: 32, 32, 32;
--shadow-rgb: 0, 0, 0;
--wash: 0.09;
--pick: #3aa9ff;
--ok: #34d17a;
color-scheme: dark;
}
}
/* AsciiWake.css */
/*
MIT License
Copyright (c) 2026 Lorenzo Cabra
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
---
Not covered by this licence: the Bencho name and the goat mark, and the
photographs shown on bencho.dev (none are included here). Third-party
material keeps its own licence; see THIRD_PARTY.md.
Icon substitution (this copy only): lucide-react (ISC) was replaced with @tabler/icons-react (MIT).
Sample photographs were replaced with Incidental AI assets. The Bencho name and goat mark are not licensed for marketing use.
*/
/* ══ ASCII wake ════════════════════════════════════════════ */
.asc {
position: relative;
cursor: crosshair;
touch-action: none;
-webkit-tap-highlight-color: transparent;
user-select: none;
-webkit-user-select: none;}
.asc-canvas { display: block; color: var(--fill-on, var(--ink)); }
// bencho source (MIT). npm i motion react · Tailwind CSS v4
// ── blocks/ascii-wake/AsciiWake.tsx (https://github.com/cabralorenzo/bencho/blob/c65992417427bb09e661674ffa800bef29adef49/blocks/ascii-wake/AsciiWake.tsx)
/*
MIT License
Copyright (c) 2026 Lorenzo Cabra
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
---
Not covered by this licence: the Bencho name and the goat mark, and the
photographs shown on bencho.dev (none are included here). Third-party
material keeps its own licence; see THIRD_PARTY.md.
Icon substitution (this copy only): lucide-react (ISC) was replaced with @tabler/icons-react (MIT).
Sample photographs were replaced with Incidental AI assets. The Bencho name and goat mark are not licensed for marketing use.
*/
import { useEffect, useRef } from "react";
/* ══ ASCII wake ═══════════════════════════════════════════
A cube drawn in ink dots, the dots shrinking toward
its edge like a halftone. The pointer drags a wake through it:
right under the hand the characters thicken to their densest
and stay that way while the hand rests, and
along the path it came from they thin back out, @ to # to + to
a dot, as the wake cools. The glyphs lean toward the hand while
it is near. Press and a ring goes out from the press.
── A GRID OF NUMBERS, THEN A RAMP ──────────────────────
Every cell holds one number. The hand adds to it along the
line it moved,
so a fast stroke leaves no gaps; every frame the whole grid
cools by the same fraction. The number picks a character off
a ramp of glyphs, lightest to densest. That is the whole
effect — the same field-then-palette idea as the Heat map,
with characters where the heat map has colours.
── THE SHIMMER ─────────────────────────────────────────
A cell that is in the wake picks its glyph with a little
noise, re-dealt every few frames, so the warm part of the wake
flickers between neighbouring characters the way a terminal
redraw does. The cold field never flickers. */
const W = 360;
const H = 240;
const clamp = (v: number, a: number, b: number) => Math.min(b, Math.max(a, v));
/* lightest to densest; the first is always a blank */
export const RAMPS: Record<string, string[]> = {
Classic: [" ", ".", ":", "-", "=", "+", "*", "#", "%", "@"],
Blocks: [" ", "·", "░", "▒", "▓", "█"],
Dots: [" ", "·", "•", "●"],
Binary: [" ", ".", ":", "0", "1"],
};
/* ── the shape: a cube, seen corner on ──────────────────────
A solid, perfectly symmetric shape: three faces of an isometric
cube make a hexagon, lit from above so each face has its own
strength — the top brightest, the left in half light, the right
in shade — with a little gradient across each for depth and a
crisp line where two faces meet. Returns the dot size directly,
0 to 1, so the halftone is dense right to the outline.
The dots are the ink, so which face is dense depends on the page:
on dark the dots are light and the lit top is the dense one; on
light they are dark, so it is printed like a halftone — the lit top
sparse, the shaded side dense. `lit` is the dot size for a face's
light: the same value, read the right way round for the page. */
const CUBE = 112;
function cube(x: number, y: number, dark: boolean) {
/* no face lighter than a third of a full dot: the faintest still
reads as a face, and is still a field the wake can write on */
const lit = (v: number) => 0.35 + 0.65 * clamp(dark ? v : 1.09 - v, 0, 1);
const R = CUBE;
const c = Math.cos(Math.PI / 6) * R, h = R / 2;
/* the corners: top, upper right, bottom, lower left, upper left; the middle is 0,0 */
const T = [0, -R], UR = [c, -h], B = [0, R], LL = [-c, h], UL = [-c, -h];
/* where (x, y) sits in a face spanned from o along a and b: s, t in 0..1 when inside */
const along = (o: number[], p: number[], q: number[]) => {
const ax = p[0] - o[0], ay = p[1] - o[1], bx = q[0] - o[0], by = q[1] - o[1];
const dx = x - o[0], dy = y - o[1];
const det = ax * by - ay * bx;
return [(dx * by - dy * bx) / det, (ax * dy - ay * dx) / det];
};
const inside = ([s, t]: number[]) => s >= 0 && s <= 1 && t >= 0 && t <= 1;
/* the seams: a bright line where two faces meet, and the outline */
const seam = (v: number) => (v < 0.045 ? 1 : 0);
const top = along(T, UR, UL);
if (inside(top)) {
const [s, t] = top;
return seam(1 - s) || seam(1 - t) ? 1 : lit(0.96 - 0.1 * (s + t) / 2);
}
const left = along(UL, [0, 0], LL);
if (inside(left)) {
const [s, t] = left;
return seam(s) ? 1 : lit(0.56 - 0.12 * t);
}
const right = along([0, 0], UR, B);
if (inside(right)) {
const [s, t] = right;
return seam(s) || seam(t) ? 1 : lit(0.13 - 0.05 * s);
}
return 0;
}
/* the face is the system's own monospace — nothing downloaded */
const MONO = `ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace`;
/* below this much heat a cell is the field: a dot */
const COLD = 0.04;
/* how long a press's ring takes to spread and fade, s */
const RING_S = 2.2;
export function AsciiWake({
/* the ramp of glyphs */
glyphs = "Classic",
/* how big a character is, px */
size = 10,
/* how wide the wake is, 0..100 */
reach = 50,
/* seconds for the wake to cool */
trail = 1.2,
/* how far the glyphs lean toward the hand, 0..100 */
pull = 40,
}: {
glyphs?: string;
size?: number;
reach?: number;
trail?: number;
pull?: number;
} = {}) {
const cv = useRef<HTMLCanvasElement>(null);
const knobs = useRef({ glyphs, reach, trail, pull });
knobs.current = { glyphs, reach, trail, pull };
const st = useRef({
cols: 0, rows: 0, cw: 0, ch: 0, ox: 0, oy: 0, font: "",
/* the wake, one number per cell */
heat: new Float32Array(0),
/* how far inside the shape each cell is, 0 outside to 1 */
mask: new Float32Array(0),
/* the hand: where it is, where it was last stamped, and how
present it is (for the lean, which follows it out) */
hx: -999, hy: -999, lx: NaN, ly: NaN, near: 0, inside: false,
/* rings going out from presses */
rings: [] as { x: number; y: number; t: number }[],
deal: 0, tick: 0,
raf: 0, ratio: 1,
});
/* the grid for a character size, cut to the shape */
const build = () => {
const s = st.current;
const c = cv.current;
if (!c) return;
const r = Math.min(2, window.devicePixelRatio || 1);
s.ratio = r;
c.width = Math.round(W * r);
c.height = Math.round(H * r);
/* which way round the shading reads: is the ink light (a dark page)? */
const ink = getComputedStyle(c).color.match(/[\d.]+/g)?.map(Number) ?? [0, 0, 0];
const dark = (ink[0] * 0.299 + ink[1] * 0.587 + ink[2] * 0.114) > 128;
/* rows a little tighter than the face's own leading, so the
resting dots sit on an even grid rather than in stripes */
s.ch = size * 0.82;
s.cw = size * 0.62;
s.cols = Math.floor(W / s.cw - 0.5);
s.rows = Math.floor(H / s.ch);
s.font = `500 ${size}px ${MONO}`;
s.heat = new Float32Array(s.cols * s.rows);
s.mask = new Float32Array(s.cols * s.rows);
/* the grid centred in the block, whatever is left over split */
const ox = (s.ox = (W - s.cols * s.cw) / 2), oy = (s.oy = (H - s.rows * s.ch) / 2);
for (let j = 0; j < s.rows; j++) {
for (let i = 0; i < s.cols; i++) {
const x = ox + (i + 0.5 + (j & 1) * 0.5) * s.cw - W / 2, y = oy + (j + 0.5) * s.ch - H / 2;
s.mask[j * s.cols + i] = cube(x, y, dark);
}
}
};
/* heat dropped on the grid in a soft round at a point */
const stamp = (x: number, y: number, rad: number, amt: number) => {
const s = st.current;
x -= s.ox; y -= s.oy;
const c0 = Math.max(0, Math.floor((x - rad) / s.cw));
const c1 = Math.min(s.cols - 1, Math.ceil((x + rad) / s.cw));
const r0 = Math.max(0, Math.floor((y - rad) / s.ch));
const r1 = Math.min(s.rows - 1, Math.ceil((y + rad) / s.ch));
const R2 = rad * rad;
for (let j = r0; j <= r1; j++) {
const dy = (j + 0.5) * s.ch - y;
for (let i = c0; i <= c1; i++) {
const dx = (i + 0.5) * s.cw - x;
const q = (dx * dx + dy * dy) / R2;
if (q >= 1) continue;
const t = 1 - q;
const k = j * s.cols + i;
s.heat[k] = Math.min(1, s.heat[k] + amt * t * t);
}
}
};
/* the wake's width: one cell's worth at 0, a broad swathe at 100 */
const radius = () => 12 + (clamp(knobs.current.reach, 0, 100) / 100) * 58;
const paint = () => {
const s = st.current;
const c = cv.current;
if (!c || !s.cols) return;
const g = c.getContext("2d")!;
g.setTransform(s.ratio, 0, 0, s.ratio, 0, 0);
g.clearRect(0, 0, W, H);
/* one ink for everything, the theme's own */
g.fillStyle = getComputedStyle(c).color;
/* the resting dot: a real circle rather than a full stop, so
it can be bigger than the face draws one */
/* a halftone: the dot's AREA follows the density, up to nearly
touching its neighbours where the shape is fullest */
const dot = Math.min(s.cw, s.ch) * 0.44;
g.font = s.font;
g.textAlign = "center";
g.textBaseline = "middle";
const ramp = RAMPS[knobs.current.glyphs] ?? RAMPS.Classic;
const top = ramp.length - 1;
/* the lean: up to most of a cell toward the hand, fading with
distance over twice the wake's width */
const lean = (clamp(knobs.current.pull, 0, 100) / 100) * s.near;
const rad = radius();
const far = rad * 2;
const far2 = far * far;
/* the hand's own heat, worked out fresh each frame rather than
stored, so it never cools: a hand at rest keeps its patch */
const R2 = rad * rad;
/* the rings, as a band that passes rather than heat that stays:
a press leaves nothing behind it, only the wave going out */
const rings = s.rings.map((r) => {
/* slow and smooth: it eases out as it spreads, a soft wide band
that fades over its whole life rather than snapping off */
const p = r.t / RING_S;
const e = 1 - Math.pow(1 - p, 3);
return { x: r.x, y: r.y, R: 8 + e * 260, amp: 0.6 * (1 - p) * (1 - p) * Math.min(1, p * 6) };
});
for (let j = 0; j < s.rows; j++) {
const y = s.oy + (j + 0.5) * s.ch;
for (let i = 0; i < s.cols; i++) {
const k = j * s.cols + i;
const m = s.mask[k];
if (m <= 0) continue;
/* odd rows sit half a cell over: a halftone screen */
const cx = s.ox + (i + 0.5 + (j & 1) * 0.5) * s.cw;
let h = s.heat[k];
if (s.near > 0.002) {
const q = ((cx - s.hx) ** 2 + (y - s.hy) ** 2) / R2;
if (q < 1) h = Math.max(h, 0.95 * s.near * (1 - q) * (1 - q));
}
for (const r of rings) {
/* a wide band, so the ring is a soft swell rather than a line */
const d = (Math.hypot(cx - r.x, y - r.y) - r.R) / 24;
if (d > -2.5 && d < 2.5) h += r.amp * Math.exp(-d * d);
}
/* the faint faces take a little less of the wake, but only a
little: scaled by the density outright, the lightest face
never got warm enough to show a glyph at all */
h *= 0.55 + 0.45 * m;
const v = Math.min(1, h);
/* the warm part shimmers, the cold field holds still */
let u = v * top + 0.5;
if (h > COLD) u += (hash(k, s.deal) - 0.5) * 1.6 * Math.min(1, h * 2);
const idx = clamp(Math.floor(u), 1, top);
let x = cx;
let yy = y;
if (lean > 0.002) {
const dx = s.hx - x, dy = s.hy - yy;
const d2 = dx * dx + dy * dy;
if (d2 < far2) {
const f = 1 - d2 / far2;
const d = Math.sqrt(d2) || 1;
/* toward the hand by a share of the gap, never past it */
const m = Math.min(d * 0.6, 14 * lean * f * f);
x += (dx / d) * m;
yy += (dy / d) * m;
}
}
/* cold, or the lightest step: the dot, smaller toward the
shape's edge, so the wake fades back into the field
without a glyph popping in or out */
if (h <= COLD || idx === 1) {
g.globalAlpha = 1;
g.beginPath();
g.arc(x, yy, Math.max(0.45, dot * Math.sqrt(m)), 0, Math.PI * 2);
g.fill();
continue;
}
g.globalAlpha = 1;
g.fillText(ramp[idx], x, yy);
}
}
g.globalAlpha = 1;
};
/* the loop runs only while the wake is warm or the hand is moving */
const run = () => {
const s = st.current;
if (s.raf) return;
let prev = performance.now();
const step = (t: number) => {
const dt = Math.min(0.05, (t - prev) / 1000);
prev = t;
/* the cooling: the same fraction off every cell, so a trail
of seconds T is down to a twentieth after T */
const keep = Math.exp((-dt * 3) / Math.max(0.1, knobs.current.trail));
let warm = 0;
for (let k = 0; k < s.heat.length; k++) {
const h = s.heat[k] * keep;
s.heat[k] = h < 0.003 ? 0 : h;
if (h > warm) warm = h;
}
/* the rings run outward for RING_S and are gone */
s.rings = s.rings.filter((r) => (r.t += dt) < RING_S);
/* the lean follows the hand in and out */
s.near += ((s.inside ? 1 : 0) - s.near) * (1 - Math.pow(0.004, dt));
s.tick += dt;
if (s.tick > 0.07) { s.tick = 0; s.deal++; }
paint();
const still = warm === 0 && !s.rings.length && Math.abs((s.inside ? 1 : 0) - s.near) < 0.004;
s.raf = still ? 0 : requestAnimationFrame(step);
};
s.raf = requestAnimationFrame(step);
};
useEffect(() => {
build();
paint();
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [size]);
useEffect(() => { paint(); }, [glyphs]);
useEffect(() => () => { cancelAnimationFrame(st.current.raf); st.current.raf = 0; }, []);
useEffect(() => {
/* a theme flip turns the shading round, so the field is rebuilt */
const mo = new MutationObserver(() => { build(); paint(); });
mo.observe(document.documentElement, { attributes: true, attributeFilter: ["data-theme"] });
return () => mo.disconnect();
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);
/* the pointer in the block's own units — the wall zooms cards */
const where = (e: React.PointerEvent) => {
const r = e.currentTarget.getBoundingClientRect();
const k = r.width / W;
return { x: (e.clientX - r.left) / k, y: (e.clientY - r.top) / k };
};
/* the hand stamps along the whole line since its last frame, a
stamp every third of a radius, so a flick is one stroke */
const move = (e: React.PointerEvent) => {
const s = st.current;
const { x, y } = where(e);
const rad = radius();
if (Number.isNaN(s.lx)) { s.lx = x; s.ly = y; }
const d = Math.hypot(x - s.lx, y - s.ly);
const n = Math.max(1, Math.ceil(d / (rad / 3)));
for (let k = 1; k <= n; k++) {
const f = k / n;
stamp(s.lx + (x - s.lx) * f, s.ly + (y - s.ly) * f, rad, 0.5);
}
s.lx = x; s.ly = y; s.hx = x; s.hy = y;
s.inside = true;
run();
};
return (
<div
className="asc"
style={{ width: W, height: H }}
onPointerEnter={(e) => { const s = st.current; s.lx = NaN; move(e); }}
onPointerMove={move}
onPointerLeave={() => { const s = st.current; s.inside = false; s.lx = NaN; run(); }}
onPointerDown={(e) => {
const { x, y } = where(e);
st.current.rings.push({ x, y, t: 0 });
run();
}}
role="img"
aria-label="A cube of dots that a pointer drags a wake through"
>
<canvas ref={cv} className="asc-canvas" style={{ width: W, height: H }} aria-hidden="true" />
</div>
);
}
/* a stable 0..1 per cell per deal, so the shimmer is noise that
holds for a few frames rather than flicker every frame */
function hash(k: number, n: number) {
let h = (k * 374761393 + n * 668265263) | 0;
h = Math.imul(h ^ (h >>> 13), 1274126177);
return ((h ^ (h >>> 16)) >>> 0) / 4294967296;
}控件 · HTML · CSS · JS
直接改代码,再用控件微调,预览会随输入实时更新。

在线编辑每个组件,用控件微调,下载完整源码,复制进阶提示词。
一次性 $49占位价格
测试模式:不会真实扣款。
免费:预览、复制按钮和课程说明。
重复的图案增加质感,又不和文字抢戏。
首屏背景、分区分隔和空白区域。
缩放图块大小、降低对比度、选两种颜色。
把 Bencho (github.com/cabralorenzo/bencho)(MIT)中的「ASCII 尾迹」组件加入我的 React + Tailwind CSS 应用。源文件:https://github.com/cabralorenzo/bencho/blob/c65992417427bb09e661674ffa800bef29adef49/blocks/ascii-wake/AsciiWake.tsx。重复的图案增加质感,又不和文字抢戏。 适用场景:首屏背景、分区分隔和空白区域。 可调参数:缩放图块大小、降低对比度、选两种颜色。 支持浅色与深色主题,遵循 prefers-reduced-motion。保留 MIT 许可声明。
更完整的提示词,包含调参、无障碍和接入步骤。