Skip to content
Core API/Face API

ALLPERSONAS / DEVELOPERS

Face API

Create a face, update its state, and clean up when your view unmounts.

Preview

Live SDK@allpersonas/core
Ruby

MAKE IT YOURS

Ready when you are
Use this face in your app
Your selected face — assistant.ts
import { createFace } from '@allpersonas/core';

export function mountAssistant(host: HTMLElement) {
  Object.assign(host.style, { width: '280px', height: '340px' });
  const face = createFace(host, {
    avatar: "ruby",
    expression: "attentive",
  });
  // Update when your agent's state changes.
  // face.update({ thinking: true });
  return () => face.destroy();
}

Create, update, destroy

Example.tsx
import { createFace } from '@allpersonas/core';

export function mountAssistant(host: HTMLElement) {
  host.style.width = '280px';
  host.style.height = '340px';
  const face = createFace(host, {
    avatar: 'ruby',
    expression: 'attentive',
  });

  face.update({ thinking: true });
  // When your agent responds:
  face.update({ thinking: false, expression: 'joyful' });

  // Call the returned function when your view unmounts.
  return () => face.destroy();
}
APIResultPurpose
createFace(host, options?)FaceControllerMount in an HTMLElement or ShadowRoot; owns its contents.
face.update(options)voidMerge a FaceOptions patch; undefined restores an optional value’s default.
face.elementHTMLDivElementThe rendered face element. Set surrounding layout on the host.
face.destroy()voidRemove the face and release animation frames and event listeners.

Character IDs: leo, ruby, finn, iris, theo, noah.

FaceOptions

OptionType / defaultWhat it does
avatarAvatarId | Avatar · rubyChoose one of the six characters.
expressionExpression · attentiveSet the current emotional cue.
thinkingboolean · falseUse the reflective pose while your agent is working.
speakingboolean · falseWhether speech is actually playing.
animatedboolean · trueEnable movement, subject to reduced-motion preferences.
boundary{ readonly current: WordBoundary | null }Real word timing, normally from AvatarSpeech.boundary.
getLevel() => number | nullRead the RMS level of your own playing audio.
mouthOpennumber · optionalManual 0–1 mouth openness. Overrides measured motion.
labelstring · character + expressionA meaningful accessible name for the image.
decorativeboolean · falseHide the image from assistive technology when text already labels it.
artworkSrcstring · bundled artworkOverride the character sheet while retaining its geometry.
Setting speaking alone does not create a talking loop. Supply real word boundaries, measured audio levels, or a mouthOpen value to drive the mouth. Put size, classes, and layout styles on the host.