A wrapper that manages the states of a Live2D core model, and delegates all operations to it.

Emits

InternalModelEvents

Hierarchy

Constructors

Properties

angleXParamIndex: number
angleYParamIndex: number
angleZParamIndex: number
bodyAngleXParamIndex: number
breathParamIndex: number
coreModel: Live2DModelWebGL

The managed Live2D core model.

destroyed: boolean = false

Flags this instance has been destroyed.

disableCulling: boolean = false

If true, the face culling will always be disabled when drawing the model, regardless of the model's internal flags.

drawDataCount: number = 0

Number of the drawables in this model.

drawingMatrix: Matrix = ...

The final matrix to draw the model.

eyeBlink?: Live2DEyeBlink
eyeballXParamIndex: number
eyeballYParamIndex: number
focusController: FocusController = ...
height: number = 0

Canvas height of the model, scaled by the height of the model's layout.

hitAreas: Record<string, CommonHitArea> = {}

The hit area definitions, keyed by their names.

localTransform: Matrix = ...

Local transformation, calculated from the model's layout.

motionManager: Cubism2MotionManager
originalHeight: number = 0

Original canvas height of the model. Note this doesn't represent the model's real size, as the model can overflow from its canvas.

originalWidth: number = 0

Original canvas width of the model. Note this doesn't represent the model's real size, as the model can overflow from its canvas.

physics?: Live2DPhysics
pose?: Live2DPose
textureFlipY: boolean = true

Flags whether gl.UNPACK_FLIP_Y_WEBGL should be enabled when binding the textures.

viewport: [number, number, number, number] = ...

WebGL viewport when drawing the model. The format is [x, y, width, height].

width: number = 0

Canvas width of the model, scaled by the width of the model's layout.

prefixed: string | boolean

Methods

  • Calls each of the listeners registered for a given event.

    Parameters

    • event: string | symbol
    • Rest ...args: any[]

    Returns boolean

  • Return an array listing the events for which the emitter has registered listeners.

    Returns (string | symbol)[]

  • Hit-test on the model.

    Returns

    The names of the hit hit areas. Can be empty if none is hit.

    Parameters

    • x: number

      Position in model canvas.

    • y: number

      Position in model canvas.

    Returns string[]

  • Hit-test for a single hit area.

    Returns

    True if hit.

    Parameters

    • hitAreaName: string

      The hit area's name.

    • x: number

      Position in model canvas.

    • y: number

      Position in model canvas.

    Returns boolean

  • Return the number of listeners listening to a given event.

    Parameters

    • event: string | symbol

    Returns number

  • Return the listeners registered for a given event.

    Parameters

    • event: string | symbol

    Returns ListenerFn[]

  • Parameters

    • event: string | symbol
    • Optional fn: ListenerFn
    • Optional context: any
    • Optional once: boolean

    Returns Cubism2InternalModel

  • Add a listener for a given event.

    Parameters

    • event: string | symbol
    • fn: ListenerFn
    • Optional context: any

    Returns Cubism2InternalModel

  • Add a one-time listener for a given event.

    Parameters

    • event: string | symbol
    • fn: ListenerFn
    • Optional context: any

    Returns Cubism2InternalModel

  • Remove the listeners of a given event.

    Parameters

    • event: string | symbol
    • Optional fn: ListenerFn
    • Optional context: any
    • Optional once: boolean

    Returns Cubism2InternalModel

Generated using TypeDoc