Blink Manager
BlinkManager is a class responsible for managing blinking animations for VRM models in a Three.js scene.
Constructor
BlinkManager(closeTime = 0.5, openTime = 0.5, continuity = 1, randomness = 5)
closeTime: The time taken for the eyes to close in seconds (default is 0.5 seconds).openTime: The time taken for the eyes to open in seconds (default is 0.5 seconds).continuity: The time duration between blinks in seconds (default is 1 second).randomness: The randomness factor affecting blink occurrences (default is 5).
Properties
Properties for BlinkManager are not meant to be edited directly they are modified with methods.
-
.vrmBlinkers: ArrayAn array containing VRM instances to be managed for blinking.
-
mode: StringThe current mode of the blinker (
'ready','closing', or'open'). -
clock: ClockA Three.js clock used for timing in the blink manager.
-
closeTime: Number**The time taken for the eyes to close in seconds.
-
openTime: NumberThe time taken for the eyes to open in seconds.
-
continuity: NumberThe time duration between blinks in seconds.
-
randomness: NumberThe randomness factor affecting blink occurrences.
-
_eyeOpen: NumberA value indicating the openness of the eyes, ranging from 0 (closed) to 1 (open).
-
_blinkCounter: NumberA counter tracking the time since the last blink.
-
isTakingScreenShot: BooleanA flag indicating whether the blinker is currently taking a screenshot.
Methods
addVRM(vrm)
Adds a VRM (Virtual Reality Model) instance to the blink manager.
vrm: The VRM instance to be added.
removeVRM(vrm)
Removes a VRM instance from the blink manager.
vrm: The VRM instance to be removed.
enableScreenshot()
Enables the screenshot mode, setting the eye openness to a threshold value and updating blinkers.
disableScreenshot()
Disables the screenshot mode.
update()
Periodically updates the blink manager based on the specified timings and modes. Manages the opening and closing of eyes, as well as the readiness for the next blink.