Class InternalModelAbstract

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

Emits

InternalModelEvents

Hierarchy

Constructors

Properties

coreModel: object

The managed Live2D core model.

destroyed: boolean = false

Flags this instance has been destroyed.

drawingMatrix: Matrix = ...

The final matrix to draw the model.

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: MotionManager<any, any>
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?: any
pose?: any
settings: ModelSettings
textureFlipY: boolean = false

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

  • Parameters

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

    Returns InternalModel

  • Binds a texture to the model. The index must be the same as that of this texture in the textures array.

    Parameters

    • index: number
    • texture: WebGLTexture

    Returns void

  • 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)[]

  • Gets a drawable's vertices.

    Throws

    Error when the drawable cannot be found.

    Parameters

    • index: string | number

      Either the index or the ID of the drawable.

    Returns Float32Array

  • 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 InternalModel

  • Add a listener for a given event.

    Parameters

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

    Returns InternalModel

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

    Parameters

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

    Returns InternalModel

  • Remove all listeners, or those of the specified event.

    Parameters

    • Optional event: string | symbol

    Returns InternalModel

  • Remove the listeners of a given event.

    Parameters

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

    Returns InternalModel

  • Updates the model's parameters.

    Parameters

    • dt: number

      Elapsed time in milliseconds from last frame.

    • now: number

      Current time in milliseconds.

    Returns void

  • Updates WebGL context bound to this model.

    Parameters

    • gl: WebGLRenderingContext

      WebGL context.

    • glContextID: number

      Unique ID for given WebGL context.

    Returns void

Generated using TypeDoc