Skip to content

@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() ​

ts
isMouthOpen(): boolean;

Defined in: face/face.ts:46

The mouth is open. False when there's no face.

Returns ​

boolean


isMouthClosed() ​

ts
isMouthClosed(): boolean;

Defined in: face/face.ts:48

A face is in view with its mouth closed.

Returns ​

boolean


isSmiling() ​

ts
isSmiling(): boolean;

Defined in: face/face.ts:49

Returns ​

boolean


isBlinking() ​

ts
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() ​

ts
isEyeClosed(side): boolean;

Defined in: face/face.ts:53

That eye is shut, whether winking or blinking.

Parameters ​

ParameterType
sidePictureSide

Returns ​

boolean


isWinking() ​

ts
isWinking(side?): boolean;

Defined in: face/face.ts:55

A wink is being held. With no side, either eye.

Parameters ​

ParameterType
side?PictureSide

Returns ​

boolean


areBrowsRaised() ​

ts
areBrowsRaised(): boolean;

Defined in: face/face.ts:56

Returns ​

boolean


getHeadTilt() ​

ts
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() ​

ts
getHeadAngles(): HeadAngles | null;

Defined in: face/face.ts:60

The head's angles in degrees, or null.

Returns ​

HeadAngles | null


getGestureValues() ​

ts
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() ​

ts
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 ​

ParameterType
nameFaceGestureName

Returns ​

boolean


on() ​

ts
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 ​

ParameterType
name"*" | FaceGestureName
listener(event) => void

Returns ​

Unsubscribe


getGestureThresholds() ​

ts
getGestureThresholds(): Readonly<FaceGestureThresholds>;

Defined in: face/face.ts:68

The thresholds in use.

Returns ​

Readonly<FaceGestureThresholds>


setGestureThresholds() ​

ts
setGestureThresholds(thresholds): void;

Defined in: face/face.ts:70

Changes some thresholds. What isn't named stays.

Parameters ​

ParameterType
thresholdsPartial<FaceGestureThresholds>

Returns ​

void


resetNeutral() ​

ts
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() ​

ts
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 ​

ParameterType
pointFaceAttachPointId
target?Vector3

Returns ​

Vector3 | null


getScreenPosition() ​

ts
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 ​

ParameterType
pointFaceAttachPointId

Returns ​

ScreenPosition | null


getScreenFaceWidth() ​

ts
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() ​

ts
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 ​

ParameterType
pointFaceAttachPointId
positionVector3Like
radius?number

Returns ​

boolean


isTracking() ​

ts
isTracking(): boolean;

Defined in: face/tracker.ts:32

A face is in view right now.

Returns ​

boolean

Inherited from ​

FaceTracker.isTracking


getBlendshape() ​

ts
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 ​

ParameterType
namestring

Returns ​

number

Inherited from ​

FaceTracker.getBlendshape


getBlendshapes() ​

ts
getBlendshapes(): Record<string, number>;

Defined in: face/tracker.ts:40

Every expression showing now, by name.

Returns ​

Record<string, number>

Inherited from ​

FaceTracker.getBlendshapes


getHeadFit() ​

ts
getHeadFit(): FaceHeadFit;

Defined in: face/tracker.ts:42

How the current person's head compares with the average one.

Returns ​

FaceHeadFit

Inherited from ​

FaceTracker.getHeadFit


resolvePoint() ​

ts
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 ​

ParameterType
pointFaceAttachPoint
options{ live: boolean; }
options.liveboolean

Returns ​

[number, number, number] | null

Inherited from ​

FaceTracker.resolvePoint


getPose()? ​

ts
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

Inherited from ​

FaceTracker.getPose