# Class: Live2DFactory (/jsdoc/pixi-vn-live2d/core/classes/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](/jsdoc/pixi-vn-live2d/core/classes/Live2DModel#from).
* Motion loading: implements the load method of MotionManager.
* Expression loading: implements the load method of ExpressionManager.

## Constructors [#constructors]

### Constructor [#constructor]

\> **new Live2DFactory**(): `Live2DFactory`

#### Returns [#returns]

`Live2DFactory`

## Properties [#properties]

### createInternalModel [#createinternalmodel]

\> `static` **createInternalModel**: [`Middleware`](/jsdoc/pixi-vn-live2d/core/type-aliases/Middleware)\<[`Live2DFactoryContext`](/jsdoc/pixi-vn-live2d/core/interfaces/Live2DFactoryContext)>

Defined in: node\_modules/untitled-pixi-live2d-engine/types/index.d.ts:4165

***

### expressionTasksMap [#expressiontasksmap]

\> `static` **expressionTasksMap**: `WeakMap`\<[`ExpressionManager`](/jsdoc/pixi-vn-live2d/core/classes/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 [#jsontosettings]

\> `static` **jsonToSettings**: [`Middleware`](/jsdoc/pixi-vn-live2d/core/type-aliases/Middleware)\<[`Live2DFactoryContext`](/jsdoc/pixi-vn-live2d/core/interfaces/Live2DFactoryContext)>

Defined in: node\_modules/untitled-pixi-live2d-engine/types/index.d.ts:4161

***

### live2DModelMiddlewares [#live2dmodelmiddlewares]

\> `static` **live2DModelMiddlewares**: [`Middleware`](/jsdoc/pixi-vn-live2d/core/type-aliases/Middleware)\<[`Live2DFactoryContext`](/jsdoc/pixi-vn-live2d/core/interfaces/Live2DFactoryContext)>\[]

Defined in: node\_modules/untitled-pixi-live2d-engine/types/index.d.ts:4169

Middlewares to run through when setting up a Live2DModel.

***

### motionTasksMap [#motiontasksmap]

\> `static` **motionTasksMap**: `WeakMap`\<[`MotionManager`](/jsdoc/pixi-vn-live2d/core/classes/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](/jsdoc/pixi-vn-live2d/core/classes/MotionManager#definitions).

***

### runtimes [#runtimes]

\> `static` **runtimes**: [`Live2DRuntime`](/jsdoc/pixi-vn-live2d/core/interfaces/Live2DRuntime)\[]

Defined in: node\_modules/untitled-pixi-live2d-engine/types/index.d.ts:4159

All registered runtimes, sorted by versions in descending order.

***

### setupEssentials [#setupessentials]

\> `static` **setupEssentials**: [`Middleware`](/jsdoc/pixi-vn-live2d/core/type-aliases/Middleware)\<[`Live2DFactoryContext`](/jsdoc/pixi-vn-live2d/core/interfaces/Live2DFactoryContext)>

Defined in: node\_modules/untitled-pixi-live2d-engine/types/index.d.ts:4164

***

### setupOptionals [#setupoptionals]

\> `static` **setupOptionals**: [`Middleware`](/jsdoc/pixi-vn-live2d/core/type-aliases/Middleware)\<[`Live2DFactoryContext`](/jsdoc/pixi-vn-live2d/core/interfaces/Live2DFactoryContext)>

Defined in: node\_modules/untitled-pixi-live2d-engine/types/index.d.ts:4163

***

### urlToJSON [#urltojson]

\> `static` **urlToJSON**: [`Middleware`](/jsdoc/pixi-vn-live2d/core/type-aliases/Middleware)\<[`Live2DFactoryContext`](/jsdoc/pixi-vn-live2d/core/interfaces/Live2DFactoryContext)>

Defined in: node\_modules/untitled-pixi-live2d-engine/types/index.d.ts:4160

***

### waitUntilReady [#waituntilready]

\> `static` **waitUntilReady**: [`Middleware`](/jsdoc/pixi-vn-live2d/core/type-aliases/Middleware)\<[`Live2DFactoryContext`](/jsdoc/pixi-vn-live2d/core/interfaces/Live2DFactoryContext)>

Defined in: node\_modules/untitled-pixi-live2d-engine/types/index.d.ts:4162

## Methods [#methods]

### findRuntime() [#findruntime]

\> `static` **findRuntime**(`source`): [`Live2DRuntime`](/jsdoc/pixi-vn-live2d/core/interfaces/Live2DRuntime) | `undefined`

Defined in: node\_modules/untitled-pixi-live2d-engine/types/index.d.ts:4188

Finds a runtime that matches given source.

#### Parameters [#parameters]

##### source [#source]

`any`

Either a settings JSON object or a ModelSettings instance.

#### Returns [#returns-1]

[`Live2DRuntime`](/jsdoc/pixi-vn-live2d/core/interfaces/Live2DRuntime) | `undefined`

The Live2DRuntime, or undefined if not found.

***

### loadExpression() [#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](#expressiontasksmap). The task will be automatically
canceled when its owner - the ExpressionManager instance - has been destroyed.

#### Type Parameters [#type-parameters]

##### Expression [#expression]

`Expression`

##### ExpressionSpec [#expressionspec]

`ExpressionSpec`

#### Parameters [#parameters-1]

##### expressionManager [#expressionmanager]

[`ExpressionManager`](/jsdoc/pixi-vn-live2d/core/classes/ExpressionManager)\<`Expression`, `ExpressionSpec`>

ExpressionManager that owns this Expression.

##### index [#index]

`number`

Index of the Expression.

#### Returns [#returns-2]

`Promise`\<`Expression` | `undefined`>

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

***

### loadMotion() [#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](#motiontasksmap). The task will be automatically
canceled when its owner - the MotionManager instance - has been destroyed.

#### Type Parameters [#type-parameters-1]

##### Motion [#motion]

`Motion`

##### MotionSpec [#motionspec]

`MotionSpec`

#### Parameters [#parameters-2]

##### motionManager [#motionmanager]

[`MotionManager`](/jsdoc/pixi-vn-live2d/core/classes/MotionManager)\<`Motion`, `MotionSpec`>

MotionManager that owns this Motion.

##### group [#group]

`string`

The motion group.

##### index [#index-1]

`number`

Index in the motion group.

#### Returns [#returns-3]

`Promise`\<`Motion` | `undefined`>

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

***

### registerRuntime() [#registerruntime]

\> `static` **registerRuntime**(`runtime`): `void`

Defined in: node\_modules/untitled-pixi-live2d-engine/types/index.d.ts:4182

Registers a Live2DRuntime.

#### Parameters [#parameters-3]

##### runtime [#runtime]

[`Live2DRuntime`](/jsdoc/pixi-vn-live2d/core/interfaces/Live2DRuntime)

#### Returns [#returns-4]

`void`

***

### releaseExpressionTasks() [#releaseexpressiontasks]

\> `static` **releaseExpressionTasks**(`expressionManager`): `void`

Defined in: node\_modules/untitled-pixi-live2d-engine/types/index.d.ts:4215

#### Parameters [#parameters-4]

##### expressionManager [#expressionmanager-1]

[`ExpressionManager`](/jsdoc/pixi-vn-live2d/core/classes/ExpressionManager)

#### Returns [#returns-5]

`void`

***

### releaseMotionTasks() [#releasemotiontasks]

\> `static` **releaseMotionTasks**(`motionManager`): `void`

Defined in: node\_modules/untitled-pixi-live2d-engine/types/index.d.ts:4214

#### Parameters [#parameters-5]

##### motionManager [#motionmanager-1]

[`MotionManager`](/jsdoc/pixi-vn-live2d/core/classes/MotionManager)

#### Returns [#returns-6]

`void`

***

### setupLive2DModel() [#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 [#type-parameters-2]

##### IM [#im]

`IM` *extends* [`InternalModel`](/jsdoc/pixi-vn-live2d/core/classes/InternalModel)

#### Parameters [#parameters-6]

##### live2dModel [#live2dmodel]

[`Live2DModel`](/jsdoc/pixi-vn-live2d/core/classes/Live2DModel)\<`IM`>

The Live2DModel instance.

##### source [#source-1]

`string` | `object` | `IM`\[`"settings"`]

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

##### options? [#options]

[`Live2DFactoryOptions`](/jsdoc/pixi-vn-live2d/core/interfaces/Live2DFactoryOptions)

Options for the process.

#### Returns [#returns-7]

`Promise`\<`void`>

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