From 27c1970a7f97c9d86d16b4363a0b818007c7dacc Mon Sep 17 00:00:00 2001 From: DoodleBear Date: Wed, 30 Sep 2026 15:01:22 +0900 Subject: [PATCH] feat: the playground shows shapes and motions instead of describing them MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `sides` and `silhouette` sat in one slider list under one "shape" heading, so a reader had no way to tell which moved the whole field and which moved each dot — and both were numbers, which is the wrong shape of answer for "what does a hexagon look like". The preset was a `` of bare names, which cannot convey that `spiral` and `ring` differ; they are cards that run the engine, and they animate once the pointer or focus reaches them rather than twelve at once. +- Every card draws the engine's own output — `field()` for a still, `cellsFor()` for a silhouette, the live field for a motion. A card that drew its own approximation of a dot would be a second implementation of the thing it advertises, and would drift the moment the glyph code changed. The phase is deliberately not 0: a traversal lives in the difference between cells, and at t=0 they are all at rest, so a still card showed a uniform blob. +- Rows and columns are steppers on the stage rather than sliders in the side column, and `dot/cell` moved onto the stage too: they are what you reach for while looking at the field. Overall `size` moved to last, because it decides how much room the field takes rather than what it looks like. + - `check-registry.mjs` now fails the build when a published package has no README, no `repository` pointing at this repo, no homepage or no bugs URL. diff --git a/CHANGELOG.zh.md b/CHANGELOG.zh.md index 318509e..d464f57 100644 --- a/CHANGELOG.zh.md +++ b/CHANGELOG.zh.md @@ -12,6 +12,10 @@ BotUI 的所有值得注意的变更都记录在此。格式遵循 ### 变更 +- **Playground 的形状与动效控件改成了卡片,不再是滑杆。** `sides` 和 `silhouette` 曾挤在同一个列表、同一个"形状"标题下,读者无法分辨哪个改变整体点阵、哪个改变每一个点;现在剪影是一组卡片(改变整个点阵的外轮廓),点是另一组卡片(改变每一个点本身),每组都在同一位置写明自己的作用范围。preset 曾是一个只列名字的 ` onChange(option.value)} + /> + + {option.label} + + ); + })} + + + ); +} + +/** + * The field's outline, drawn as the cells that exist. + * + * NOT a `Still`. A still frame at phase 0 runs the motion, and at phase 0 most cells + * sit at the resting level — so `ring` and `circle` both came out as a uniform smudge + * of near-invisible dots, and the card that exists to answer "which cells does this + * silhouette keep?" answered it with "a faint blob". The silhouette is a question about + * the LATTICE, not about the motion, so this asks the lattice directly. + * + * `cellsFor` is the engine's own function, so this cannot disagree with what the field + * below it renders; the only thing decided here is the dot size, chosen to fill the + * cell so the shape reads at 44px. + */ +export function SilhouetteCard({ + value, + size = 44, + cols = 7, + rows = 7, +}: { + value: Silhouette; + size?: number; + cols?: number; + rows?: number; +}) { + const cells = cellsFor(cols, rows, value); + // one dot per cell, at the pitch the engine would use with no gap and a dot that + // fills its cell — so the card shows the shape and not an accident of spacing + const pitch = size / (cols + 1); + const dot = glyphPath({ sides: 4, radius: 0 }).d; + const scale = (pitch * 0.82) / 2; + return ( + + ); +} diff --git a/apps/site/src/components/Matrix.tsx b/apps/site/src/components/Matrix.tsx index 81f3f76..f2a7cf5 100644 --- a/apps/site/src/components/Matrix.tsx +++ b/apps/site/src/components/Matrix.tsx @@ -1,6 +1,8 @@ -import { useEffect, useRef } from "react"; +import { useEffect, useMemo, useRef, useState } from "react"; import { createDotMatrix, + field, + resolveOptions, type DotMatrixHandle, type DotMatrixOptions, } from "@botharness/botui-core"; @@ -54,3 +56,90 @@ export function Matrix({ playing = true, className, ...options }: MatrixProps) { return