@doki-land/live2d 0.0.4 → 0.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/l2d.umd.js +1 -1
- package/dist/l2d.umd.js.map +1 -1
- package/lib/cubism2.d.ts +178 -178
- package/lib/cubism2.min.js +1 -1
- package/package.json +6 -5
- package/readme.md +18 -18
- package/src/fs/index.ts +88 -88
- package/src/icons/icons.ts +38 -38
- package/src/icons/style.css +37 -37
- package/src/index.ts +5 -7
- package/src/types/Live2dOptions.ts +55 -55
- package/src/types/ModelOptions.ts +39 -39
- package/src/types/index.ts +2 -2
- package/dist/l2d.esm.js +0 -39429
- package/dist/l2d.esm.js.map +0 -1
package/lib/cubism2.d.ts
CHANGED
|
@@ -1,179 +1,179 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Unofficial declaration file of Cubism 2.1 core library.
|
|
3
|
-
*
|
|
4
|
-
* @see {@link http://doc.live2d.com/api/core/cpp2.0j/}
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
declare class Live2D {
|
|
8
|
-
static setGL(gl: WebGLRenderingContext, index?: number): void;
|
|
9
|
-
|
|
10
|
-
static getError(): unknown | undefined;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
declare class Live2DModelWebGL {
|
|
14
|
-
static loadModel(buffer: ArrayBuffer): Live2DModelWebGL;
|
|
15
|
-
|
|
16
|
-
private constructor();
|
|
17
|
-
|
|
18
|
-
drawParamWebGL: Live2DObfuscated.DrawParamWebGL;
|
|
19
|
-
|
|
20
|
-
getModelContext(): Live2DObfuscated.ModelContext;
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* @return The width of model's Live2D drawing canvas but NOT the html canvas element.
|
|
24
|
-
*/
|
|
25
|
-
getCanvasWidth(): number;
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
* @return The height of model's Live2D drawing canvas but NOT the html canvas element.
|
|
29
|
-
*/
|
|
30
|
-
getCanvasHeight(): number;
|
|
31
|
-
|
|
32
|
-
setTexture(index: number, texture: WebGLTexture): void;
|
|
33
|
-
|
|
34
|
-
setMatrix(matrix: ArrayLike<number>): void;
|
|
35
|
-
|
|
36
|
-
setParamFloat(id: string | number, value: number, weight?: number): unknown;
|
|
37
|
-
|
|
38
|
-
addToParamFloat(id: string | number, value: number, weight?: number): unknown;
|
|
39
|
-
|
|
40
|
-
multParamFloat(id: string | number, value: number, weight?: number): unknown;
|
|
41
|
-
|
|
42
|
-
setPartsOpacity(id: string | number, value: number): unknown;
|
|
43
|
-
|
|
44
|
-
getPartsOpacity(id: string | number): number;
|
|
45
|
-
|
|
46
|
-
getParamFloat(id: string | number): number;
|
|
47
|
-
|
|
48
|
-
getParamIndex(id: string): number;
|
|
49
|
-
|
|
50
|
-
getPartsDataIndex(id: string): number;
|
|
51
|
-
|
|
52
|
-
getDrawDataIndex(id: string): number;
|
|
53
|
-
|
|
54
|
-
getTransformedPoints(index: number): Float32Array;
|
|
55
|
-
|
|
56
|
-
loadParam(): void;
|
|
57
|
-
|
|
58
|
-
saveParam(): void;
|
|
59
|
-
|
|
60
|
-
update(): void;
|
|
61
|
-
|
|
62
|
-
draw(): void;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
declare class AMotion {
|
|
66
|
-
setFadeIn(time: number): unknown;
|
|
67
|
-
|
|
68
|
-
setFadeOut(time: number): unknown;
|
|
69
|
-
|
|
70
|
-
updateParam(model: Live2DModelWebGL, entry: Live2DObfuscated.MotionQueueEnt): void
|
|
71
|
-
|
|
72
|
-
updateParamExe(model: Live2DModelWebGL, time: number, weight: number, MotionQueueEnt: unknown): unknown;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
declare class Live2DMotion extends AMotion {
|
|
76
|
-
private constructor();
|
|
77
|
-
|
|
78
|
-
static loadMotion(buffer: ArrayBuffer): Live2DMotion;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
declare class MotionQueueManager {
|
|
82
|
-
motions: unknown[];
|
|
83
|
-
|
|
84
|
-
/**
|
|
85
|
-
* @return The size of internal motion arrays.
|
|
86
|
-
*/
|
|
87
|
-
startMotion(motion: AMotion, neverUsedArg?: boolean): number;
|
|
88
|
-
|
|
89
|
-
stopAllMotions(): void;
|
|
90
|
-
|
|
91
|
-
isFinished(): boolean;
|
|
92
|
-
|
|
93
|
-
/**
|
|
94
|
-
* @return True if parameters are updated by any motion.
|
|
95
|
-
*/
|
|
96
|
-
updateParam(model: Live2DModelWebGL): boolean;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
declare class PhysicsHair {
|
|
100
|
-
static Src: {
|
|
101
|
-
SRC_TO_X: string;
|
|
102
|
-
SRC_TO_Y: string;
|
|
103
|
-
SRC_TO_G_ANGLE: string;
|
|
104
|
-
};
|
|
105
|
-
static Target: {
|
|
106
|
-
TARGET_FROM_ANGLE: string;
|
|
107
|
-
TARGET_FROM_ANGLE_V: string;
|
|
108
|
-
};
|
|
109
|
-
|
|
110
|
-
setup(length: number, regist: number, mass: number): unknown;
|
|
111
|
-
|
|
112
|
-
addSrcParam(type: string, id: string, scale: number, weight: number): unknown;
|
|
113
|
-
|
|
114
|
-
addTargetParam(type: string, id: string, scale: number, weight: number): unknown;
|
|
115
|
-
|
|
116
|
-
update(model: Live2DModelWebGL, time: number): unknown;
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
declare class PartsDataID {
|
|
120
|
-
static getID(id: string): string;
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
declare class DrawDataID {
|
|
124
|
-
id: string;
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
/**
|
|
128
|
-
* Members that have been obfuscated.
|
|
129
|
-
*/
|
|
130
|
-
declare namespace Live2DObfuscated {
|
|
131
|
-
class MotionQueueEnt {
|
|
132
|
-
isFinished(): boolean;
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
class DrawParamWebGL {
|
|
136
|
-
gl: WebGLRenderingContext;
|
|
137
|
-
glno: number;
|
|
138
|
-
|
|
139
|
-
firstDraw: boolean;
|
|
140
|
-
|
|
141
|
-
culling: boolean;
|
|
142
|
-
|
|
143
|
-
setGL(gl: WebGLRenderingContext): void;
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
class ModelContext {
|
|
147
|
-
clipManager: ClipManager;
|
|
148
|
-
|
|
149
|
-
/**
|
|
150
|
-
* This is basically `DrawData[]`, but not reliable since it's an obfuscated property.
|
|
151
|
-
* Always check the type before using it!
|
|
152
|
-
*/
|
|
153
|
-
_$aS?: unknown; // DrawData[]
|
|
154
|
-
|
|
155
|
-
getDrawData(index: number): DrawData | null;
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
class IDrawData {
|
|
159
|
-
getDrawDataID(): DrawDataID;
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
class DrawData extends IDrawData {
|
|
163
|
-
getNumPoints?(): unknown;
|
|
164
|
-
|
|
165
|
-
draw(aN: unknown, aK: unknown, aI: Unknown_aB): void;
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
class Unknown_aB {
|
|
169
|
-
baseOpacity: number;
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
class ClipManager {
|
|
173
|
-
curFrameNo: number;
|
|
174
|
-
|
|
175
|
-
getMaskRenderTexture(): number;
|
|
176
|
-
|
|
177
|
-
setupClip(modelContext: ModelContext, drawParam: DrawParamWebGL): void;
|
|
178
|
-
}
|
|
1
|
+
/**
|
|
2
|
+
* Unofficial declaration file of Cubism 2.1 core library.
|
|
3
|
+
*
|
|
4
|
+
* @see {@link http://doc.live2d.com/api/core/cpp2.0j/}
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
declare class Live2D {
|
|
8
|
+
static setGL(gl: WebGLRenderingContext, index?: number): void;
|
|
9
|
+
|
|
10
|
+
static getError(): unknown | undefined;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
declare class Live2DModelWebGL {
|
|
14
|
+
static loadModel(buffer: ArrayBuffer): Live2DModelWebGL;
|
|
15
|
+
|
|
16
|
+
private constructor();
|
|
17
|
+
|
|
18
|
+
drawParamWebGL: Live2DObfuscated.DrawParamWebGL;
|
|
19
|
+
|
|
20
|
+
getModelContext(): Live2DObfuscated.ModelContext;
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* @return The width of model's Live2D drawing canvas but NOT the html canvas element.
|
|
24
|
+
*/
|
|
25
|
+
getCanvasWidth(): number;
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* @return The height of model's Live2D drawing canvas but NOT the html canvas element.
|
|
29
|
+
*/
|
|
30
|
+
getCanvasHeight(): number;
|
|
31
|
+
|
|
32
|
+
setTexture(index: number, texture: WebGLTexture): void;
|
|
33
|
+
|
|
34
|
+
setMatrix(matrix: ArrayLike<number>): void;
|
|
35
|
+
|
|
36
|
+
setParamFloat(id: string | number, value: number, weight?: number): unknown;
|
|
37
|
+
|
|
38
|
+
addToParamFloat(id: string | number, value: number, weight?: number): unknown;
|
|
39
|
+
|
|
40
|
+
multParamFloat(id: string | number, value: number, weight?: number): unknown;
|
|
41
|
+
|
|
42
|
+
setPartsOpacity(id: string | number, value: number): unknown;
|
|
43
|
+
|
|
44
|
+
getPartsOpacity(id: string | number): number;
|
|
45
|
+
|
|
46
|
+
getParamFloat(id: string | number): number;
|
|
47
|
+
|
|
48
|
+
getParamIndex(id: string): number;
|
|
49
|
+
|
|
50
|
+
getPartsDataIndex(id: string): number;
|
|
51
|
+
|
|
52
|
+
getDrawDataIndex(id: string): number;
|
|
53
|
+
|
|
54
|
+
getTransformedPoints(index: number): Float32Array;
|
|
55
|
+
|
|
56
|
+
loadParam(): void;
|
|
57
|
+
|
|
58
|
+
saveParam(): void;
|
|
59
|
+
|
|
60
|
+
update(): void;
|
|
61
|
+
|
|
62
|
+
draw(): void;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
declare class AMotion {
|
|
66
|
+
setFadeIn(time: number): unknown;
|
|
67
|
+
|
|
68
|
+
setFadeOut(time: number): unknown;
|
|
69
|
+
|
|
70
|
+
updateParam(model: Live2DModelWebGL, entry: Live2DObfuscated.MotionQueueEnt): void
|
|
71
|
+
|
|
72
|
+
updateParamExe(model: Live2DModelWebGL, time: number, weight: number, MotionQueueEnt: unknown): unknown;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
declare class Live2DMotion extends AMotion {
|
|
76
|
+
private constructor();
|
|
77
|
+
|
|
78
|
+
static loadMotion(buffer: ArrayBuffer): Live2DMotion;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
declare class MotionQueueManager {
|
|
82
|
+
motions: unknown[];
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* @return The size of internal motion arrays.
|
|
86
|
+
*/
|
|
87
|
+
startMotion(motion: AMotion, neverUsedArg?: boolean): number;
|
|
88
|
+
|
|
89
|
+
stopAllMotions(): void;
|
|
90
|
+
|
|
91
|
+
isFinished(): boolean;
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* @return True if parameters are updated by any motion.
|
|
95
|
+
*/
|
|
96
|
+
updateParam(model: Live2DModelWebGL): boolean;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
declare class PhysicsHair {
|
|
100
|
+
static Src: {
|
|
101
|
+
SRC_TO_X: string;
|
|
102
|
+
SRC_TO_Y: string;
|
|
103
|
+
SRC_TO_G_ANGLE: string;
|
|
104
|
+
};
|
|
105
|
+
static Target: {
|
|
106
|
+
TARGET_FROM_ANGLE: string;
|
|
107
|
+
TARGET_FROM_ANGLE_V: string;
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
setup(length: number, regist: number, mass: number): unknown;
|
|
111
|
+
|
|
112
|
+
addSrcParam(type: string, id: string, scale: number, weight: number): unknown;
|
|
113
|
+
|
|
114
|
+
addTargetParam(type: string, id: string, scale: number, weight: number): unknown;
|
|
115
|
+
|
|
116
|
+
update(model: Live2DModelWebGL, time: number): unknown;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
declare class PartsDataID {
|
|
120
|
+
static getID(id: string): string;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
declare class DrawDataID {
|
|
124
|
+
id: string;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* Members that have been obfuscated.
|
|
129
|
+
*/
|
|
130
|
+
declare namespace Live2DObfuscated {
|
|
131
|
+
class MotionQueueEnt {
|
|
132
|
+
isFinished(): boolean;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
class DrawParamWebGL {
|
|
136
|
+
gl: WebGLRenderingContext;
|
|
137
|
+
glno: number;
|
|
138
|
+
|
|
139
|
+
firstDraw: boolean;
|
|
140
|
+
|
|
141
|
+
culling: boolean;
|
|
142
|
+
|
|
143
|
+
setGL(gl: WebGLRenderingContext): void;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
class ModelContext {
|
|
147
|
+
clipManager: ClipManager;
|
|
148
|
+
|
|
149
|
+
/**
|
|
150
|
+
* This is basically `DrawData[]`, but not reliable since it's an obfuscated property.
|
|
151
|
+
* Always check the type before using it!
|
|
152
|
+
*/
|
|
153
|
+
_$aS?: unknown; // DrawData[]
|
|
154
|
+
|
|
155
|
+
getDrawData(index: number): DrawData | null;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
class IDrawData {
|
|
159
|
+
getDrawDataID(): DrawDataID;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
class DrawData extends IDrawData {
|
|
163
|
+
getNumPoints?(): unknown;
|
|
164
|
+
|
|
165
|
+
draw(aN: unknown, aK: unknown, aI: Unknown_aB): void;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
class Unknown_aB {
|
|
169
|
+
baseOpacity: number;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
class ClipManager {
|
|
173
|
+
curFrameNo: number;
|
|
174
|
+
|
|
175
|
+
getMaskRenderTexture(): number;
|
|
176
|
+
|
|
177
|
+
setupClip(modelContext: ModelContext, drawParam: DrawParamWebGL): void;
|
|
178
|
+
}
|
|
179
179
|
}
|