@davi-ai/react-bodyengine-three 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +15 -0
- package/dist/components/Character.d.ts +3 -0
- package/dist/components/Controllers/AnimationController.d.ts +6 -0
- package/dist/components/Controllers/BmlController.d.ts +1 -0
- package/dist/components/Controllers/CharacterController.d.ts +7 -0
- package/dist/components/Controllers/EmotionController.d.ts +5 -0
- package/dist/components/Scene.d.ts +7 -0
- package/dist/components/SpeechManager.d.ts +2 -0
- package/dist/contexts/animationStore.d.ts +16 -0
- package/dist/contexts/cameraStore.d.ts +28 -0
- package/dist/contexts/characterStore.d.ts +46 -0
- package/dist/contexts/emotionStore.d.ts +16 -0
- package/dist/contexts/headStore.d.ts +16 -0
- package/dist/contexts/postProcessStore.d.ts +8 -0
- package/dist/contexts/speechStore.d.ts +33 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.js +85334 -0
- package/dist/models/constants.d.ts +13 -0
- package/dist/models/enums.d.ts +65 -0
- package/dist/models/types.d.ts +72 -0
- package/dist/utils/getCameraPositionVector.d.ts +3 -0
- package/package.json +52 -0
package/README.md
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# React-bodyengine-three
|
|
2
|
+
|
|
3
|
+

|
|
4
|
+

|
|
5
|
+
|
|
6
|
+
## Description
|
|
7
|
+
|
|
8
|
+
This package is based on [React Js](https://react.dev/). It creates an overlay over the package `@davi-ai/bodyengine-three` to use this one in React environment with tools to use every feature of the basic package.
|
|
9
|
+
|
|
10
|
+
## Installation
|
|
11
|
+
|
|
12
|
+
From npm :
|
|
13
|
+
```bash
|
|
14
|
+
npm install @davi-ai/react-bodyengine-three
|
|
15
|
+
```
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { CharacterProps } from '../models/types';
|
|
2
|
+
declare const Character: ({ url, type, animationsUrl, gender, speechSynthesis, camera, onLoadingCompleted, autoLookAt, breathing, disableAnimations, debug, enableBml, animationWeights, license, detectGpuData }: CharacterProps) => JSX.Element;
|
|
3
|
+
export default Character;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
declare const testString = "<bml id=\"bml1\" characterId=\"Sara\">\n<speech id=\"speech1\" start=\"0\">\n <text>Hello, my name is Sara.</text>\n</speech>\n\n<gesture id=\"gesture1\" start=\"0\"/>\n\n<gaze id=\"gaze1\" target=\"Cube\" start=\"4.5\" end=\"6\"/>\n<gaze id=\"gaze2\" target=\"Sphere\" start=\"gaze1:end+1\" end=\"gaze1:end+2.3\"/>\t\t\n<gaze id=\"gaze3\" target=\"Capsule\" start=\"gaze2:end+1\" end=\"gaze2:end+4\"/>\t\t\n\n<speech id=\"speech2\" start=\"gaze1:start+1\">\n <text>I can look at at cube</text>\n</speech>\n\n<posture id=\"posture1\" start=\"speech1:end\" end=\"speech2:end\">\n <stance type=\"\" />\n <pose part=\"\" lexeme=\"\" />\n</posture>\n\n<speech id=\"speech3\" start=\"gaze2:start+1\">\n <text>sphere</text>\n</speech>\n\n<speech id=\"speech4\" start=\"gaze3:start+1\">\n <text>or a capsule</text>\n</speech>\n</bml>";
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Character } from '../../../node_modules/@davi-ai/bodyengine-three/dist';
|
|
2
|
+
interface CharacterControllerProps {
|
|
3
|
+
character: Character;
|
|
4
|
+
autoLookAt: boolean;
|
|
5
|
+
}
|
|
6
|
+
declare const CharacterController: ({ character, autoLookAt }: CharacterControllerProps) => null;
|
|
7
|
+
export default CharacterController;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import * as THREE from "three";
|
|
2
|
+
interface AnimationStore {
|
|
3
|
+
animationsNames: Array<string>;
|
|
4
|
+
animations: Map<string, THREE.AnimationClip>;
|
|
5
|
+
currentAnimation: string | null;
|
|
6
|
+
autoPlay: boolean;
|
|
7
|
+
}
|
|
8
|
+
export declare const useAnimationStore: import('zustand').UseBoundStore<import('zustand').StoreApi<AnimationStore>>;
|
|
9
|
+
export declare const setAnimationsNames: (value: Array<string>) => void;
|
|
10
|
+
export declare const setAnimations: (value: Map<string, THREE.AnimationClip>) => void;
|
|
11
|
+
export declare const getAnimationsMap: () => Map<string, THREE.AnimationClip>;
|
|
12
|
+
export declare const addAnimation: (value: THREE.AnimationClip) => void;
|
|
13
|
+
export declare const setCurrentAnimation: (value: string | null) => void;
|
|
14
|
+
export declare const setAutoPlay: (value: boolean) => void;
|
|
15
|
+
export declare const playAnimationByName: (value: string) => void;
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { DefaultDistances, DefaultPositions } from '../models/types';
|
|
2
|
+
import { Vector3 } from 'three';
|
|
3
|
+
import * as THREE from "three";
|
|
4
|
+
/**
|
|
5
|
+
* Default data for a medium-shot character :
|
|
6
|
+
* - camera position : head
|
|
7
|
+
* - camera distance : medium
|
|
8
|
+
* - camera lookAt : torso
|
|
9
|
+
* - camera rotation : face
|
|
10
|
+
*/
|
|
11
|
+
interface CameraStore {
|
|
12
|
+
cameraRef: THREE.Camera | null;
|
|
13
|
+
cameraPosition: Vector3;
|
|
14
|
+
bodyCenter: Vector3 | null;
|
|
15
|
+
defaultPositions: DefaultPositions | null;
|
|
16
|
+
defaultDistances: DefaultDistances | null;
|
|
17
|
+
lookAt: Vector3 | null;
|
|
18
|
+
movable: boolean;
|
|
19
|
+
}
|
|
20
|
+
export declare const useCameraStore: import('zustand').UseBoundStore<import('zustand').StoreApi<CameraStore>>;
|
|
21
|
+
export declare const setCameraRef: (value: THREE.Camera | null) => void;
|
|
22
|
+
export declare const setCameraPosition: (value: Vector3) => void;
|
|
23
|
+
export declare const setBodyCenter: (value: Vector3 | null) => void;
|
|
24
|
+
export declare const setDefaultPositions: (value: DefaultPositions | null) => void;
|
|
25
|
+
export declare const setDefaultDistances: (value: DefaultDistances | null) => void;
|
|
26
|
+
export declare const setLookAt: (value: Vector3 | null) => void;
|
|
27
|
+
export declare const setMovable: (value: boolean) => void;
|
|
28
|
+
export {};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { Character, GlobalManager, LipSyncManager, EyeBlinkManager, AnimationManager, FACSManager, HeadPoseManager, GazeManager, BmlManager, CharacterState } from '../../node_modules/@davi-ai/bodyengine-three/dist';
|
|
2
|
+
interface Managers {
|
|
3
|
+
lipSyncManager?: LipSyncManager | null;
|
|
4
|
+
eyeBlinkManager?: EyeBlinkManager | null;
|
|
5
|
+
animationManager?: AnimationManager | null;
|
|
6
|
+
FACSManager?: FACSManager | null;
|
|
7
|
+
headPoseManager?: HeadPoseManager | null;
|
|
8
|
+
gazeManager?: GazeManager | null;
|
|
9
|
+
bmlManager?: BmlManager | null;
|
|
10
|
+
}
|
|
11
|
+
interface CharacterStore {
|
|
12
|
+
character: Character | null;
|
|
13
|
+
globalManager: GlobalManager;
|
|
14
|
+
managers: Managers;
|
|
15
|
+
lipSyncManager: LipSyncManager | null;
|
|
16
|
+
eyeBlinkManager: EyeBlinkManager | null;
|
|
17
|
+
animationManager?: AnimationManager | null;
|
|
18
|
+
FACSManager?: FACSManager | null;
|
|
19
|
+
headPoseManager?: HeadPoseManager | null;
|
|
20
|
+
gazeManager?: GazeManager | null;
|
|
21
|
+
bmlManager?: BmlManager | null;
|
|
22
|
+
animationsLoaded: boolean;
|
|
23
|
+
characterWidth: number;
|
|
24
|
+
characterHeight: number;
|
|
25
|
+
characterDepth: number;
|
|
26
|
+
characterState: CharacterState;
|
|
27
|
+
}
|
|
28
|
+
export declare const useCharacterStore: import('zustand').UseBoundStore<import('zustand').StoreApi<CharacterStore>>;
|
|
29
|
+
export declare const setCharacter: (value: Character | null) => void;
|
|
30
|
+
export declare const setManagers: (value: Managers) => void;
|
|
31
|
+
export declare const setGlobalSyncManager: (value: GlobalManager | null) => void;
|
|
32
|
+
export declare const setLipSyncManager: (value: LipSyncManager | null) => void;
|
|
33
|
+
export declare const setEyeBlinkManager: (value: EyeBlinkManager | null) => void;
|
|
34
|
+
export declare const setAnimationManager: (value: AnimationManager | null) => void;
|
|
35
|
+
export declare const setFACSManager: (value: FACSManager | null) => void;
|
|
36
|
+
export declare const setHeadPoseManager: (value: HeadPoseManager | null) => void;
|
|
37
|
+
export declare const setGazeManager: (value: GazeManager | null) => void;
|
|
38
|
+
export declare const setBmlManager: (value: BmlManager | null) => void;
|
|
39
|
+
export declare const setAnimationsLoaded: (value: boolean) => void;
|
|
40
|
+
export declare const setCharacterDimensions: (value: {
|
|
41
|
+
x: number;
|
|
42
|
+
y: number;
|
|
43
|
+
z: number;
|
|
44
|
+
}) => void;
|
|
45
|
+
export declare const setCharacterState: (value: CharacterState) => void;
|
|
46
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Emotions } from '../models/enums';
|
|
2
|
+
import { EmotionData } from '../models/types';
|
|
3
|
+
import { FacialAnimationData } from '../../node_modules/@davi-ai/bodyengine-three/dist';
|
|
4
|
+
interface EmotionStore {
|
|
5
|
+
emotions: Array<EmotionData>;
|
|
6
|
+
currentTopEmotion: Emotions;
|
|
7
|
+
useTopEmotionOnly: boolean;
|
|
8
|
+
autoDecay: boolean;
|
|
9
|
+
}
|
|
10
|
+
export declare const useEmotionStore: import('zustand').UseBoundStore<import('zustand').StoreApi<EmotionStore>>;
|
|
11
|
+
export declare const setEmotions: (value: Array<EmotionData> | undefined | null) => void;
|
|
12
|
+
export declare const setUseTopEmotionOnly: (value: boolean) => void;
|
|
13
|
+
export declare const setAutoDecay: (value: boolean) => void;
|
|
14
|
+
export declare const playFacialAnimation: (value: FacialAnimationData) => void;
|
|
15
|
+
export declare const resetEmotionStore: () => void;
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { ActionUnitData, GazeData, HeadPoseData } from '../../node_modules/@davi-ai/bodyengine-three/dist';
|
|
2
|
+
import * as THREE from "three";
|
|
3
|
+
interface HeadStore {
|
|
4
|
+
currentAUs: Array<ActionUnitData> | null;
|
|
5
|
+
currentGaze: GazeData | null;
|
|
6
|
+
currentHeadPose: HeadPoseData | null;
|
|
7
|
+
lookAtCamera: boolean;
|
|
8
|
+
}
|
|
9
|
+
export declare const useHeadStore: import('zustand').UseBoundStore<import('zustand').StoreApi<HeadStore>>;
|
|
10
|
+
export declare const setCurrentAUs: (value: Array<ActionUnitData> | null) => void;
|
|
11
|
+
export declare const setCurrentGaze: (value: GazeData | null) => void;
|
|
12
|
+
export declare const setCurrentHeadPose: (value: HeadPoseData | null) => void;
|
|
13
|
+
export declare const setLookAtCamera: (value: boolean) => void;
|
|
14
|
+
export declare const lookAtAndKeep: (target?: THREE.Camera) => void;
|
|
15
|
+
export declare const releaseLookAt: () => void;
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import * as THREE from "three";
|
|
2
|
+
interface PostProcessStore {
|
|
3
|
+
lut: THREE.Texture | THREE.Data3DTexture | null | undefined;
|
|
4
|
+
}
|
|
5
|
+
export declare const usePostProcessStore: import('zustand').UseBoundStore<import('zustand').StoreApi<PostProcessStore>>;
|
|
6
|
+
export declare const setLut: (value: string | undefined | null) => void;
|
|
7
|
+
export declare const resetPostProcessStore: () => void;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { SpeechSynthesisCredentials } from '../models/types';
|
|
2
|
+
import { SpeechSynthesisUtterance, SpeechSynthesisEventProps } from '@davi-ai/web-speech-cognitive-services-davi';
|
|
3
|
+
interface speechStore {
|
|
4
|
+
credentials?: SpeechSynthesisCredentials;
|
|
5
|
+
currentUtterance: SpeechSynthesisUtterance | null;
|
|
6
|
+
boundaries: Array<SpeechSynthesisEventProps>;
|
|
7
|
+
visemes: Array<SpeechSynthesisEventProps>;
|
|
8
|
+
currentVisemeIndex: number;
|
|
9
|
+
voice: SpeechSynthesisVoice | null;
|
|
10
|
+
voices: Array<SpeechSynthesisVoice>;
|
|
11
|
+
textToSpeak: string | null;
|
|
12
|
+
visemeIntensity: number;
|
|
13
|
+
}
|
|
14
|
+
export declare const useSpeechStore: import('zustand').UseBoundStore<import('zustand').StoreApi<speechStore>>;
|
|
15
|
+
export declare const setCredentials: (value: SpeechSynthesisCredentials) => void;
|
|
16
|
+
export declare const setCurrentUtterance: (value: SpeechSynthesisUtterance | null) => void;
|
|
17
|
+
export declare const setBoundaries: (value: Array<SpeechSynthesisEventProps>) => void;
|
|
18
|
+
export declare const setVisemes: (value: Array<SpeechSynthesisEventProps>) => void;
|
|
19
|
+
export declare const addViseme: (value: SpeechSynthesisEventProps) => void;
|
|
20
|
+
/**
|
|
21
|
+
* Add viseme data extracted in SPPAS format that will be converted to ArKit viseme and played at the right moment.
|
|
22
|
+
* @param {SpeechSynthesisEventProps} value viseme data (id, elapsedTime = time at which the viseme shall begin, duration can be set to 0 because we override it later).
|
|
23
|
+
* @param {number} factorToSecond (facultative) we use tenth of microsecond as base unit of time for elapsedTime / duration. If another unit is used as entry, set this ratio to convert it to milliseconds (ratio * durationinotherunit = durationintenthofmicrosecond).
|
|
24
|
+
*/
|
|
25
|
+
export declare const addSPPASViseme: (value: SpeechSynthesisEventProps, factorToTenthOfMicroSecond?: number) => void;
|
|
26
|
+
export declare const setCurrentVisemeIndex: (value: number) => void;
|
|
27
|
+
export declare const flushLipSyncData: () => void;
|
|
28
|
+
export declare const setVoice: (value: SpeechSynthesisVoice | null) => void;
|
|
29
|
+
export declare const setVoices: (value: Array<SpeechSynthesisVoice>) => void;
|
|
30
|
+
export declare const setTextToSpeak: (value: string | null) => void;
|
|
31
|
+
export declare const getVoices: () => Array<SpeechSynthesisVoice>;
|
|
32
|
+
export declare const setVisemeIntensity: (value: number) => void;
|
|
33
|
+
export {};
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export { default as Character } from './components/Character';
|
|
2
|
+
export { useCharacterStore, setCharacterState } from './contexts/characterStore';
|
|
3
|
+
export { setTextToSpeak, setCurrentUtterance, setVisemes, addViseme, addSPPASViseme, flushLipSyncData, setVoice, getVoices, setVisemeIntensity } from './contexts/speechStore';
|
|
4
|
+
export { setCameraPosition, setMovable } from './contexts/cameraStore';
|
|
5
|
+
export { setCurrentAUs, setCurrentGaze, setCurrentHeadPose, setLookAtCamera, lookAtAndKeep, releaseLookAt, } from './contexts/headStore';
|
|
6
|
+
export { setEmotions, setUseTopEmotionOnly, setAutoDecay, playFacialAnimation } from './contexts/emotionStore';
|
|
7
|
+
export { setAutoPlay, getAnimationsMap, playAnimationByName } from './contexts/animationStore';
|
|
8
|
+
export { setLut } from './contexts/postProcessStore';
|
|
9
|
+
export { emotionList, CharacterState, CreationTool, bmlTags } from '../node_modules/@davi-ai/bodyengine-three/dist';
|
|
10
|
+
export type { FacialAnimationData } from '../node_modules/@davi-ai/bodyengine-three/dist';
|
|
11
|
+
export { Positions, Distances, Rotations } from './models/enums';
|
|
12
|
+
export { presets } from './models/constants';
|