aora-bot README

The project's README from github.com/sam70361/aora-bot. As one markdown file: README.md.

Emotion Ball 表情馆

为 AI 助手打造的表情引擎 —— 32 种状态表情 · 3 种身体形态 · 纯 SVG + 原生 JavaScript · 零依赖

在线预览 许可 零依赖 技术栈

中文 | English

在线预览 · 特性 · 快速开始 · 集成指南 · 自定义与扩展 · 许可


授权声明:仓库内 emotion-ball/ 目录的球形角色视觉形象(blob / wedge / gem 身体造型、配色与特效视觉)仅供个人技术学习与研究,禁止任何商业用途且永不提供商业授权;表情引擎源代码与表情配置数据(眼形 / 嘴形参数、动画原语、关键帧序列)为独立编写,双许可——非商业免费,商业用途可获取授权。详见 LICENSE、LICENSE-COMMERCIAL.md 与 NOTICE.md。

mood-mates/ 目录为同源引擎的原创角色子项目(云宝 Nimbo / 亮亮 Twinkle),独立原创设计,采用双许可(个人学习免费 + 可获取商业授权),不受上述限制约束。

本仓库由「一座总馆 + 两个子项目」组成:

Emotion Ball 是一套面向 AI 助手的表情引擎:32 种状态表情全部由纯 SVG 与原生 JavaScript 实时驱动,零框架、零图片资源。AI 侧只需输出一个 emotionId,即可切换到对应表情,可直接用作聊天机器人、桌面宠物、悬浮助手的情绪表达层。

它也不只是"一颗球":内置圆胖(blob)、三角(wedge)、菱形(gem)三种身体形态,支持主题色多实例与线稿模式;整套表情体系围绕纯数据配置设计——眼环池、动画原语、关键帧序列自由组合,基于现有设计即可自主扩展新表情与新玩法。

仓库同时内置完整的「表情展示馆」站点:开屏线稿 Hero、陈列墙与画册双浏览模式、中英双语界面、明暗双主题。

预览

总馆开屏

球球 · 暗黑 球球 · 明亮
球球暗黑 球球明亮
云宝 · 暗黑 云宝 · 明亮
云宝暗黑 云宝明亮
亮亮 · 暗黑 亮亮 · 明亮
亮亮暗黑 亮亮明亮

特性

快速开始

# 任意静态服务器均可,例如:
python -m http.server 8765
# 总馆(三角色同台):  http://localhost:8765/
# Mood Mates 子站:    http://localhost:8765/mood-mates/
# Emotion Ball 子站:  http://localhost:8765/emotion-ball/

或直接双击 index.html(建议通过本地服务器访问,以正常加载 Google Fonts)。

集成指南

最小接入

按顺序引入四个脚本(无构建、无依赖)即可创建实例;i18n.js 与 app.js 属于展示站,宿主接入不需要:

<script src="emotion-ball/js/rings.js"></script>
<script src="emotion-ball/js/emotions.js"></script>
<script src="emotion-ball/js/ball.js"></script>
<script src="emotion-ball/js/engine.js"></script>

<div id="bot" style="width:200px;height:200px"></div>
<script>
  var ball = EmotionBall.create(document.getElementById('bot'), {
    emotion: '02', idle: true
  });
</script>

AI 对接协议

AI 只需输出一段 JSON,交给 handleAIMessage(接受对象或字符串):

ball.handleAIMessage('{"emotionId":"30","tips":"正在思考用户问题"}');

创建选项

选项 默认 说明
emotion '02' 初始表情 ID
shape 'blob' 身体形态:blob 圆胖 / wedge 三角 / gem 菱形
color / eyeColor — 主题实例体色 / 眼色,优先于表情配置的体色
eyeScale 1 眼睛放大倍率;小于 80px 的实例建议 1.5~1.8 保证可读
idle false 待机策略,超时自动切换待机 / 睡眠,可传对象自定义时长与目标表情
autostart true 设为 false 时只渲染静态帧,不进入动画循环(缩略图用)
lite 跟随 autostart 精简模式:关闭彩带 / 撒花特效
fallbackId '02' 未知 ID 的回退表情

事件与方法

ball.on('change', e => {});         // 表情已切换 { id, def, auto }
ball.on('tips',   e => {});         // AI 附带文案 { text }
ball.on('error',  e => {});         // 协议错误 { message, ... }

ball.setEmotion('21');              // 直接切换表情
ball.setGaze(nx, ny);               // 归一化目光 [-1, 1],宿主自行监听 pointermove
ball.setStyle({ sketch: 1 });       // 线稿模式
ball.spin(3);                       // 自旋甩彩带
ball.burst(24);                     // 撒花
ball.bounce();                      // 弹跳
ball.startTour(ids, 2500);          // 自动巡演 / ball.stopTour()
ball.setActive(false);              // 视口外停帧省电,true 恢复
ball.renderStatic();                // 停帧状态下渲染一张静态帧
ball.registerEmotion(raw);          // 运行时注册自定义表情
ball.destroy();                     // 销毁实例

多实例与性能

桌面宠物 / Electron 接入

自定义与扩展

表情引擎与渲染层是稳定基座,基于现有设计即可自主扩展新表情与新玩法——新增表情只需编写纯数据配置,不需要触碰引擎代码。

表情配置格式

{
  id: '50', name: '自定义', group: 'custom',
  desc: '中文描述', en: { name: 'Custom', desc: '...' },
  transition: 380,            // 切入过渡时长(ms)
  gaze: true,                 // false = 不注视鼠标(睡眠/停止类)
  pool: [2, 11, 17, 19],      // 眼环索引池,poolMs 间隔内随机轮换
  poolMs: [2500, 4500],       // 轮换间隔;poolSpeed 控制形变速度
  blinkMs: [2500, 5000],      // 眨眼间隔(null 不眨)
  openness: 1,                // 常驻眼睛开合度(疲惫 0.55、睡眠 0.08)
  antics: true,               // 待机随机小动作(自旋/弹跳)
  body: { breathe: 0.014, color: '#F6EFE4', zzz: 0, orbit: 0 },
  anims: [ { target: 'eyes', prop: 'lookY', type: 'glance', amp: 6, period: 3000 } ],
  sequence: { ... }           // 可选:进入表情时的关键帧序列
}

动画原语

每个表情最多叠加 3 条动画,由 6 种原语组合而成:

类型 效果 关键参数
sine 正弦漂移 / 呼吸 / 扫视 amp, period, phase
glance 平滑方波,两端停留(左看看、右看看) amp, period
pulse 0 → amp 节奏缩放 amp, period
jitter 伪噪声抖动,可随时间衰减 amp, speed, decay
scan 三角波快速扫动(检索 / 扫读) amp, period
blink 周期闭合(多实例自动错峰) interval, dur, phaseMs

target 可选 eyes / body / left / right;prop 可选 lookX / lookY / x / y / scale / open / rotate。

关键帧序列

sequence 定义进入表情时的一次性演出,播完后按 settle 语义收尾:'base' 回落基础姿态(惊讶),'hold' 定格末帧(害羞变粉、生气变红),{ next: '02' } 自动切换到下一个表情(唤醒 → 待机)。

注册与导入导出

// 运行时注册新表情(50+ 为自定义编号段,带完整校验)
EmotionBall.config.register({ id: '50', name: '自定义', group: 'custom', ... });

// 全量导出 / 导入配置 JSON(Emotion Ball 子站的设置抽屉内也提供同款按钮)
EmotionBall.config.exportConfig();
EmotionBall.config.importConfig(json);

AI 协作 Skills

.cursor/skills/ 内置两份工程化规范文档,在 Cursor 等 AI 编辑器中打开本仓库时,AI 会自动遵循:

项目结构

(仓库根)
├── index.html          # 总馆入口:云宝 × 亮亮 × 球球 同台切换
├── site/               # 总馆外壳:样式 / 文案 / 双引擎适配交互层
├── mood-mates/         # 原创角色子项目:云宝 / 亮亮(双许可,自带展示站与文档)
│   ├── index.html      #   Mood Mates 独立展示站
│   ├── src/            #   引擎:几何 / 渲染 / 五官 / 特效 / 驱动 / 角色包
│   ├── LICENSE         #   社区许可(个人学习免费)
│   ├── LICENSE-COMMERCIAL.md  # 商业许可
│   └── docs/           #   角色设计规范 + 原创证据链
├── emotion-ball/       # 球形角色项目(形象仅供学习;引擎与表情数据可商业授权)
│   ├── index.html      #   Emotion Ball 独立展示站
│   ├── css/ js/        #   双主题样式 + 引擎(rings / emotions / ball / engine)
│   ├── assets/         #   站点图标与 README 截图
│   └── docs/           #   发布文案
└── .cursor/skills/     # AI 协作 Skills:表情设计规范 + 集成实践

许可

本仓库包含三类授权不同的内容,请注意区分:

相关项目

原创角色表情引擎 Mood Mates(云宝 / 亮亮,双许可、可商用)位于本仓库的 mood-mates/ 目录:自带独立展示站(mood-mates/index.html)、集成指南与角色设计规范,与球形角色项目互不影响。

aora-bot (sam70361/aora-bot)

Searching Database…

What is this?Emotion Ball is a facial-expression engine for AI assistants: 32 state-based expressions driven entirely by pure SVG and vanilla JavaScript, with zero frameworks and zero image assets. The AI side just outputs an emotionId and the ball switches to the matching expression.
Is this a standalone app or something I embed into my own project?It is a lightweight embeddable widget library — just HTML, SVG and vanilla JS with no build step — meant to be dropped into chatbots, desktop pets, or floating assistants, not run as a standalone app.
How do I get it running?Include the engine's core script files in order to create a ball instance, or just open index.html directly (ideally through a local server so Google Fonts load correctly).
Do I need a build tool or framework to use it?No — it has zero dependencies and no build step; it's plain HTML, SVG and vanilla JavaScript that can be dropped straight into an Electron floating window.
What happens if the AI sends a bad or unknown emotionId?The engine automatically falls back to the idle expression and fires an 'error' event — unknown IDs, JSON parse failures, or missing fields never leave the ball blank.
Can I run this as a desktop pet in Electron?Yes — the README gives explicit Electron integration settings: a transparent, frameless, always-on-top window with mouse-event passthrough so clicks go through while the ball still reacts to gaze.
What are the license terms?The engine source code and expression data are dual-licensed: free for personal/non-commercial use, with a paid commercial license available. The ball-shaped character visuals (blob/wedge/gem body designs) are for personal study only and will never get a commercial license.
What body shapes does the ball support?Three built-in body shapes — blob (round), wedge (triangle), and gem (diamond) — all share the same eye and animation system, which automatically adapts to each outline.
How are the 32 expressions organized?The emotionId uses a tens-digit prefix grouping: 00-09 are lifecycle states, 10-29 are emotional reactions, 30-49 are agent/task states, and 50+ is reserved for custom expressions, so integrators can hardcode IDs safely since numbers are never reused.
Can I create my own custom expressions?Yes — every expression is a pure data configuration (eye-ring pool + animation primitives + keyframe sequence), and the engine supports runtime registration plus import/export of configs without touching engine code.
Does it stay efficient with many instances on screen?Yes — all instances share a single requestAnimationFrame heartbeat, so adding more balls doesn't increase loop overhead, and thumbnail walls can set autostart:false and toggle rendering with setActive only when visible.
What are similar projects?live2d-widget, bloub, anime, lottie-web, svg.js, hairline, drawably, vivus
Creator
sam70361
Size
13.2 MB
Stars
483
Updated
CommitAug 24
Age
2mo
Commits · 90 Days