Web SDK: Packages¶
Three packages put the same avatars in other libraries. Each is a thin layer over SonaRenderer.connect()
or a scene (guide).
@360sona/three¶
For three.js. Its declarations:
declare const VERSION: string;
declare class SonaAvatar extends Group {
static load(
connection: SonaConnection,
manifest: string,
opts?: { clips?: string[] | null; textures?: boolean },
): Promise<SonaAvatar>;
readonly manifest: string;
readonly model: Object3D;
readonly mixer: AnimationMixer;
animations: AnimationClip[];
readonly clips: string[];
current: string | null;
play(
key: string,
opts?: { loop?: boolean; fade?: number; speed?: number },
): Promise<void>;
stop(opts?: { fade?: number }): void;
update(dt: number): void;
dispose(): void;
}
declare function credit(
connection: SonaConnection,
renderer: WebGLRenderer | HTMLCanvasElement,
corner?: string,
): { dispose(): void };
@360sona/babylon¶
For Babylon.js. Its declarations:
declare const VERSION: string;
declare class SonaAvatar {
static load(
BABYLON: any,
scene: any,
connection: SonaConnection,
manifest: string,
opts?: { clips?: string[] | null; textures?: boolean },
): Promise<SonaAvatar>;
readonly root: any;
readonly meshes: any[];
readonly animationGroups: any[];
readonly manifest: string;
readonly clips: string[];
current: string | null;
play(
key: string,
opts?: { loop?: boolean; speed?: number },
): Promise<void>;
stop(): void;
dispose(): void;
}
declare function credit(
connection: SonaConnection,
engine: any,
corner?: string,
): { dispose(): void };
SonaAvatar: BABYLON is the Babylon namespace (import * as BABYLON from '@babylonjs/core', or the global).
@360sona/react¶
For React. Its declarations:
declare const VERSION: string;
declare function useSonaScene(): any | null;
declare function SonaCanvas(
props: {
sdk: any;
appId?: string;
host?: string;
options?: Record<string, unknown> | null;
onReady?: (scene: any) => void;
onError?: (e: Error) => void;
style?: CSSProperties;
className?: string;
children?: ReactNode;
},
): ReactElement;
declare function SonaAvatar(
props: {
manifest: string;
clip?: string;
position?: [number, number, number] | null;
turn?: number;
scale?: number;
camera?: 'full' | 'upper' | 'bust' | 'face' | null;
onReady?: (avatar: any) => void;
},
): null;
declare function SonaAvatarEditor(
props: {
sdk: any;
open?: boolean;
mode?: 'full' | 'quick' | 'wardrobe';
manifest?: string | null;
appId?: string;
host?: string;
sceneOptions?: Record<string, unknown> | null;
onDone?: (manifest: string) => void;
onCancel?: () => void;
onChange?: (detail: unknown) => void;
style?: CSSProperties;
className?: string;
},
): ReactElement;
This page as Markdown · All the docs as one file (llms-full.txt)