@charivo/render-core
v0.1.5
Published
Core utilities and helpers for rendering functionality in Charivo
Readme
@charivo/render-core
Stateful render manager and rendering utilities for Charivo.
Use this package when you already have a renderer implementation, such as
@charivo/render-live2d, and want the manager that bridges TTS, realtime
emotion events, mouse tracking, and message rendering.
Install
pnpm add @charivo/render-coreUsage
import { createRenderManager } from "@charivo/render-core";
import { createLive2DRenderer } from "@charivo/render-live2d";
const renderer = createLive2DRenderer({ canvas });
const renderManager = createRenderManager(renderer, {
canvas,
mouseTracking: "document",
});
await renderManager.initialize();
await renderManager.loadModel?.("/live2d/hiyori/hiyori.model3.json");What It Does
- wraps a
Rendererimplementation - consumes the typed
CharivoEventBus - reacts to
tts:audio:start,tts:audio:end, andtts:lipsync:update - reacts to
realtime:emotion - applies character emotion mappings to expressions and motions
- optionally wires mouse tracking to a canvas or the full document
Exports
RenderManagercreateRenderManager(renderer, options?)RealTimeLipSyncsetupMouseTracking(...)
Renderer Expectations
At minimum, a renderer must implement the Renderer contract from @charivo/core.
If it also exposes optional methods such as loadModel, setRealtimeLipSync,
updateRealtimeLipSyncRms, playExpression, or playMotionByGroup, the render
manager will use them automatically.
Event Wiring
RenderManager uses setEventBus(...) because it subscribes to upstream
Charivo events. In the default flow it listens for:
tts:audio:starttts:audio:endtts:lipsync:updaterealtime:emotion
This manager consumes the full bus because it needs subscription access, not just event emission.
