Skip to content

About

React port of bloub: the morphing SVG bot avatar, one pure function of time

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

5 Commits

Folders and files

Repository files navigation

bloub-react

React port of bloub by Jérémy Perret: the x.ai bot avatar as one filled shape morphing through 14 states, eyes as mask holes, no animation library. The engine is a pure function of time (engine.sample(t)), so a frame can be frozen, tested or exported without a DOM.

src/bot/ is bloub's framework-free engine, copied verbatim (MIT, see LICENSE.bloub). This package only adds the React component.

Install

pnpm add bloub-react

Use

import { BloubBot, stateForActivity } from 'bloub-react'

// Direct state control: changing `state` morphs the bot.
<BloubBot state="orbit" size={48} />

// Map an agent's run status onto a state.
<BloubBot state={stateForActivity(run.isThinking ? 'thinking' : 'working')} size={40} follow />

// One exact frame, no animation loop (thumbnails, tests).
<BloubBot state="notify" frozenAt={1.2} size={80} />

// Montage: play the cycle measured off the reference video.
<BloubBot cycle={defaultCycle().blocks} />

Props: size, state, shape, color, expression, paper, frozenAt, cycle, playing, onStateChange, follow, gaze, className, style, label.

States: idle thinking wink wide alert notify exclaim sleep egg hexagon play orbit burst comet swirl.

stateForActivity maps idle | thinking | working | needs-input | done | error | sleeping onto those states so a chat UI can drive the avatar from its own run status.

Develop

pnpm install
pnpm dev      # demo on http://localhost:5191
pnpm test     # vitest, DOM-less
pnpm build    # tsc + vite lib build to dist/

Credits

All the measurements, shapes and states are bloub's. This package changes none of them; if a constant looks arbitrary, read bloub's docs before "fixing" it. Not affiliated with x.ai.

About

React port of bloub: the morphing SVG bot avatar, one pure function of time

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages