跳到正文

正在自动登录…

← 返回项目列表

DominikScholz/open-bot-avatar

头像生成头像渲染

这是一个用于创建和渲染交互式代理头像的JSON规范和渲染器,提供无依赖的npm包和在线编辑器,适合开发者集成到应用中。

AI 中文解读 · 根据仓库描述与 README 生成 · 2026/11/3 13:06:46 · 查看原文

值得看TypeScript应用与服务兼有 库与框架
累计 Stars
60
当前热度
1 天内 · 小火
仓库创建时间
打开 GitHub ↗项目网站 ↗

选用指南

AI 根据 README 整理 · 2026/11/3 13:06:46

使用方式

通过npm包以编程方式使用,支持DOM挂载和SVG渲染;也可通过在线编辑器生成和导入头像。

查看 README 依据
"body": { "path": "M20 20 H80 V80 H20 Z" }, "eyes": { "x": 50, "y": 46, "spacing": 15, "scale": 1 } } ``` `x`, `y`: the eyes' center; `spacing`: the distance between them; `scale`: their size. Check definitions you didn't write with `validateAvatar`, which returns `{ ok: true, value }` or `{ ok: false, errors }`. The rules are in the [contract](docs/avatar-contract.md). ## How it renders The volume is inferred from the outline as stacked cross-sections, drawn as SVG paths in a CSS 3D scene (or projected into one SVG for stills). ## Install ```sh pnpm add open-bot-avatar ```
## Mount an avatar `mountAvatar` fills a square element. ```ts import { getExample } from "open-bot-avatar"; import { mountAvatar } from "open-bot-avatar/dom"; const avatar = mountAvatar(document.querySelector("#bot")!, { definition: getExample("mug")!, color: "#ff6a1a", followPointer: true, }); avatar.update({ mood: "happy" }); // any subset of the options avatar.destroy(); ``` | Option | | | --- | --- | | `definition` | The avatar. Required. | | `color`, `eyeColor` | `#rgb` or `#rrggbb`. Default: `#ff6a1a`, `#151515`. | | `mood` | `"idle"` (default), `"thinking"` or `"happy"`. |
`renderAvatarSvg` returns an SVG string; `avatarFrame` returns the same frame as data, for drawing it yourself. Neither needs a DOM. ```ts import { avatarFrame, renderAvatarSvg, validateAvatar } from "open-bot-avatar"; const result = validateAvatar(JSON.parse(json)); if (result.ok) { const svg = renderAvatarSvg(result.value, { color: "#1fbf68", size: 256 }); const frame = avatarFrame(result.value, { color: "#1fbf68" }); } ``` Both also take `time` (seconds), `motion` (the mood) and `gaze`. ## React There's no React package; copy this component. Other frameworks work the same way.
部署要求

需要Node 22.18+和pnpm进行开发或脚本运行。

查看 README 依据
node packages/core/scripts/avatar-validate.ts --strict my-avatar.json --svg my-avatar.svg ``` Needs Node 22.18+ and pnpm. ## License [MIT](LICENSE)
已知限制

没有专门的React包,需要自行复制组件代码。

查看 README 依据
`renderAvatarSvg` returns an SVG string; `avatarFrame` returns the same frame as data, for drawing it yourself. Neither needs a DOM. ```ts import { avatarFrame, renderAvatarSvg, validateAvatar } from "open-bot-avatar"; const result = validateAvatar(JSON.parse(json)); if (result.ok) { const svg = renderAvatarSvg(result.value, { color: "#1fbf68", size: 256 }); const frame = avatarFrame(result.value, { color: "#1fbf68" }); } ``` Both also take `time` (seconds), `motion` (the mood) and `gaze`. ## React There's no React package; copy this component. Other frameworks work the same way.

README

正在加载 README…

收录信息

仓库创建时间
2026/11/3 01:03:14
首次达标收录
2026/11/3 13:01:40
统计更新时间
2026/11/3 14:01:36

按创建时长与累计 Stars 判断等级。首次达标收录后,即使未达当前门槛仍保留;累计 Stars 和仓库状态会定期更新。确认只有 README 及辅助文件的仓库会停止公开。

模型评估

值得看加权总分 3.9 / 5

新颖度
3.4
实用价值
3.9
成熟度
4.8
实质含量
4.1

由 Jev 模型根据仓库描述与 README 评估,2026/11/3 13:01:40 生成。评分仅供参考,不是代码、安全或许可证审查;热度等级另按创建时长与累计 Stars 计算。

仓库信息

最近推送
2026/11/3 01:50:15
许可证标识
MIT
Fork 数
8
当前状态
未归档

收录记录

按创建时长与累计 Stars 首次收录:小火
首次发现项目