LogoPixi’VN
coreClasses

Class: Live2DFactory

Defined in: node_modules/untitled-pixi-live2d-engine/types/index.d.ts:4155

Handles all the network load tasks.

  • Model creation: requested by Live2DModel.from.
  • Motion loading: implements the load method of MotionManager.
  • Expression loading: implements the load method of ExpressionManager.

Constructors

Constructor

> new Live2DFactory(): Live2DFactory

Returns

Live2DFactory

Properties

createInternalModel

> static createInternalModel: Middleware<Live2DFactoryContext>

Defined in: node_modules/untitled-pixi-live2d-engine/types/index.d.ts:4165


expressionTasksMap

> static expressionTasksMap: WeakMap<ExpressionManager<unknown, unknown>, (Promise<any> | undefined)[]>

Defined in: node_modules/untitled-pixi-live2d-engine/types/index.d.ts:4178

Load tasks of each expression.


jsonToSettings

> static jsonToSettings: Middleware<Live2DFactoryContext>

Defined in: node_modules/untitled-pixi-live2d-engine/types/index.d.ts:4161


live2DModelMiddlewares

> static live2DModelMiddlewares: Middleware<Live2DFactoryContext>[]

Defined in: node_modules/untitled-pixi-live2d-engine/types/index.d.ts:4169

Middlewares to run through when setting up a Live2DModel.


motionTasksMap

> static motionTasksMap: WeakMap<MotionManager<unknown, unknown>, Record<string, (Promise<any> | undefined)[]>>

Defined in: node_modules/untitled-pixi-live2d-engine/types/index.d.ts:4174

load tasks of each motion. The structure of each value in this map is the same as respective MotionManager.definitions.


runtimes

> static runtimes: Live2DRuntime[]

Defined in: node_modules/untitled-pixi-live2d-engine/types/index.d.ts:4159

All registered runtimes, sorted by versions in descending order.


setupEssentials

> static setupEssentials: Middleware<Live2DFactoryContext>

Defined in: node_modules/untitled-pixi-live2d-engine/types/index.d.ts:4164


setupOptionals

> static setupOptionals: Middleware<Live2DFactoryContext>

Defined in: node_modules/untitled-pixi-live2d-engine/types/index.d.ts:4163


urlToJSON

> static urlToJSON: Middleware<Live2DFactoryContext>

Defined in: node_modules/untitled-pixi-live2d-engine/types/index.d.ts:4160


waitUntilReady

> static waitUntilReady: Middleware<Live2DFactoryContext>

Defined in: node_modules/untitled-pixi-live2d-engine/types/index.d.ts:4162

Methods

findRuntime()

> static findRuntime(source): Live2DRuntime | undefined

Defined in: node_modules/untitled-pixi-live2d-engine/types/index.d.ts:4188

Finds a runtime that matches given source.

Parameters

source

any

Either a settings JSON object or a ModelSettings instance.

Returns

Live2DRuntime | undefined

The Live2DRuntime, or undefined if not found.


loadExpression()

> static loadExpression<Expression, ExpressionSpec>(expressionManager, index): Promise<Expression | undefined>

Defined in: node_modules/untitled-pixi-live2d-engine/types/index.d.ts:4213

Loads an Expression and registers the task to expressionTasksMap. The task will be automatically canceled when its owner - the ExpressionManager instance - has been destroyed.

Type Parameters

Expression

Expression

ExpressionSpec

ExpressionSpec

Parameters

expressionManager

ExpressionManager<Expression, ExpressionSpec>

ExpressionManager that owns this Expression.

index

number

Index of the Expression.

Returns

Promise<Expression | undefined>

Promise that resolves with the Expression, or with undefined if it can't be loaded.


loadMotion()

> static loadMotion<Motion, MotionSpec>(motionManager, group, index): Promise<Motion | undefined>

Defined in: node_modules/untitled-pixi-live2d-engine/types/index.d.ts:4205

Loads a Motion and registers the task to motionTasksMap. The task will be automatically canceled when its owner - the MotionManager instance - has been destroyed.

Type Parameters

Motion

Motion

MotionSpec

MotionSpec

Parameters

motionManager

MotionManager<Motion, MotionSpec>

MotionManager that owns this Motion.

group

string

The motion group.

index

number

Index in the motion group.

Returns

Promise<Motion | undefined>

Promise that resolves with the Motion, or with undefined if it can't be loaded.


registerRuntime()

> static registerRuntime(runtime): void

Defined in: node_modules/untitled-pixi-live2d-engine/types/index.d.ts:4182

Registers a Live2DRuntime.

Parameters

runtime

Live2DRuntime

Returns

void


releaseExpressionTasks()

> static releaseExpressionTasks(expressionManager): void

Defined in: node_modules/untitled-pixi-live2d-engine/types/index.d.ts:4215

Parameters

expressionManager

ExpressionManager

Returns

void


releaseMotionTasks()

> static releaseMotionTasks(motionManager): void

Defined in: node_modules/untitled-pixi-live2d-engine/types/index.d.ts:4214

Parameters

motionManager

MotionManager

Returns

void


setupLive2DModel()

> static setupLive2DModel<IM>(live2dModel, source, options?): Promise<void>

Defined in: node_modules/untitled-pixi-live2d-engine/types/index.d.ts:4196

Sets up a Live2DModel, populating it with all defined resources.

Type Parameters

IM

IM extends InternalModel

Parameters

live2dModel

Live2DModel<IM>

The Live2DModel instance.

source

string | object | IM["settings"]

Can be one of: settings file URL, settings JSON object, ModelSettings instance.

options?

Live2DFactoryOptions

Options for the process.

Returns

Promise<void>

Promise that resolves when all resources have been loaded, rejects when error occurs.

On this page