@relu-interactives/spatial-ecs
@relu-interactives/spatial-ecs / index / Face
Interface: Face ​
Defined in: face/face.ts:44
The face, as a script reads it: this.face in a face-tracking project. Everything FaceTracker has, and gestures.
Left and right are the picture's, as on the head. On a selfie the picture is a mirror, so "left" is your own left eye. On a camera pointed at someone else it's their right.
Gestures run before scripts update, so anything read in onUpdate is this frame's.
Extends ​
Methods ​
isMouthOpen() ​
isMouthOpen(): boolean;Defined in: face/face.ts:46
The mouth is open. False when there's no face.
Returns ​
boolean
isMouthClosed() ​
isMouthClosed(): boolean;Defined in: face/face.ts:48
A face is in view with its mouth closed.
Returns ​
boolean
isSmiling() ​
isSmiling(): boolean;Defined in: face/face.ts:49
Returns ​
boolean
isBlinking() ​
isBlinking(): boolean;Defined in: face/face.ts:51
Both eyes are shut right now. A blink is over quickly: use didGesture("blink") or the event to catch one.
Returns ​
boolean
isEyeClosed() ​
isEyeClosed(side): boolean;Defined in: face/face.ts:53
That eye is shut, whether winking or blinking.
Parameters ​
| Parameter | Type |
|---|---|
side | PictureSide |
Returns ​
boolean
isWinking() ​
isWinking(side?): boolean;Defined in: face/face.ts:55
A wink is being held. With no side, either eye.
Parameters ​
| Parameter | Type |
|---|---|
side? | PictureSide |
Returns ​
boolean
areBrowsRaised() ​
areBrowsRaised(): boolean;Defined in: face/face.ts:56
Returns ​
boolean
getHeadTilt() ​
getHeadTilt(): PictureSide | null;Defined in: face/face.ts:58
Which side of the picture the top of the head leans to, or null.
Returns ​
PictureSide | null
getHeadAngles() ​
getHeadAngles(): HeadAngles | null;Defined in: face/face.ts:60
The head's angles in degrees, or null.
Returns ​
HeadAngles | null
getGestureValues() ​
getGestureValues(): Readonly<FaceGestureValues>;Defined in: face/face.ts:62
How far each expression is from this person's resting face, 0 to 1.
Returns ​
Readonly<FaceGestureValues>
didGesture() ​
didGesture(name): boolean;Defined in: face/face.ts:64
That gesture fired on this frame. For a script that would rather poll than listen.
Parameters ​
| Parameter | Type |
|---|---|
name | FaceGestureName |
Returns ​
boolean
on() ​
on(name, listener): Unsubscribe;Defined in: face/face.ts:66
Calls listener each time a gesture fires, or any gesture with "*". Returns what takes it off.
Parameters ​
| Parameter | Type |
|---|---|
name | "*" | FaceGestureName |
listener | (event) => void |
Returns ​
getGestureThresholds() ​
getGestureThresholds(): Readonly<FaceGestureThresholds>;Defined in: face/face.ts:68
The thresholds in use.
Returns ​
Readonly<FaceGestureThresholds>
setGestureThresholds() ​
setGestureThresholds(thresholds): void;Defined in: face/face.ts:70
Changes some thresholds. What isn't named stays.
Parameters ​
| Parameter | Type |
|---|---|
thresholds | Partial<FaceGestureThresholds> |
Returns ​
void
resetNeutral() ​
resetNeutral(): void;Defined in: face/face.ts:72
Measures this person's resting face again, from the next frame. Call it when you've just asked them to relax.
Returns ​
void
getWorldPosition() ​
getWorldPosition(point, target?): Vector3 | null;Defined in: face/face.ts:77
Where a place on the face is in the world, on this frame, or null with no face. Mouth, lips, chin and jaw follow expression.
Parameters ​
| Parameter | Type |
|---|---|
point | FaceAttachPointId |
target? | Vector3 |
Returns ​
Vector3 | null
getScreenPosition() ​
getScreenPosition(point): ScreenPosition | null;Defined in: face/face.ts:79
Where a place on the face is on screen, or null with no face.
Parameters ​
| Parameter | Type |
|---|---|
point | FaceAttachPointId |
Returns ​
ScreenPosition | null
getScreenFaceWidth() ​
getScreenFaceWidth(): number | null;Defined in: face/face.ts:84
The face's width on screen, in CSS pixels, or null with no face. What a distance on screen is best measured against, since it's the same near or far.
Returns ​
number | null
isTouching() ​
isTouching(
point,
position,
radius?): boolean;Defined in: face/face.ts:90
Whether a world position lands on a place on the face, as the viewer sees it. The depth doesn't count: something falling down the screen reaches a mouth when it looks like it does. radius is in face widths.
Parameters ​
| Parameter | Type |
|---|---|
point | FaceAttachPointId |
position | Vector3Like |
radius? | number |
Returns ​
boolean
isTracking() ​
isTracking(): boolean;Defined in: face/tracker.ts:32
A face is in view right now.
Returns ​
boolean
Inherited from ​
getBlendshape() ​
getBlendshape(name): number;Defined in: face/tracker.ts:38
How strongly an expression is showing, 0 to 1. name is an ARKit-style blendshape: jawOpen, mouthSmileLeft, eyeBlinkRight, browInnerUp and so on. 0 when no face is in view.
Parameters ​
| Parameter | Type |
|---|---|
name | string |
Returns ​
number
Inherited from ​
getBlendshapes() ​
getBlendshapes(): Record<string, number>;Defined in: face/tracker.ts:40
Every expression showing now, by name.
Returns ​
Record<string, number>
Inherited from ​
getHeadFit() ​
getHeadFit(): FaceHeadFit;Defined in: face/tracker.ts:42
How the current person's head compares with the average one.
Returns ​
Inherited from ​
resolvePoint() ​
resolvePoint(point, options): [number, number, number] | null;Defined in: face/tracker.ts:47
Where a place on the head is on this person, in head units. live follows this frame's expression; otherwise it's where that place rests.
Parameters ​
| Parameter | Type |
|---|---|
point | FaceAttachPoint |
options | { live: boolean; } |
options.live | boolean |
Returns ​
[number, number, number] | null
Inherited from ​
getPose()? ​
optional getPose(): FacePose | null;Defined in: face/tracker.ts:53
Where the head is, once per frame of tracking. Optional: a runtime from before gestures doesn't give one, and then there are no positions or head gestures, and expressions are read on every world update.
Returns ​
FacePose | null

