evotars 0.0.12 → 0.0.13
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/{CanvasPool-5ekdWScU.js → CanvasPool-323z5Bgc.js} +1 -1
- package/dist/{SharedSystems-n7sA1Ui-.js → SharedSystems-CpNLwPlr.js} +2 -2
- package/dist/{WebGLRenderer-BUvcWTmB.js → WebGLRenderer-8_UYFwzF.js} +4 -4
- package/dist/{WebGPURenderer-BPb_585F.js → WebGPURenderer-D3yK12c3.js} +4 -4
- package/dist/{browserAll-DR-9ZkSp.js → browserAll--tlJ0wmH.js} +2 -2
- package/dist/{colorToUniform-Cp4M-zOy.js → colorToUniform-ZnVvWd8z.js} +1 -1
- package/dist/evotars.js +9 -6
- package/dist/evotars.umd.cjs +89 -89
- package/dist/{getBatchSamplersUniformGroup-CIYh8OT7.js → getBatchSamplersUniformGroup-DIigPB-W.js} +1 -1
- package/dist/{index-B5GUB2He.js → index-RgERw5ms.js} +3541 -3289
- package/dist/index.d.ts +249 -6
- package/dist/{webworkerAll-Bg_9Ksbn.js → webworkerAll-DxpydbmF.js} +4 -4
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
|
+
import { AnimatedSprite } from 'pixi.js';
|
|
2
|
+
import * as PIXI from 'pixi.js';
|
|
1
3
|
import { SpritesheetData as SpritesheetData_2 } from 'pixi.js';
|
|
2
4
|
import { SpritesheetFrameData as SpritesheetFrameData_2 } from 'pixi.js';
|
|
5
|
+
import * as TWEEN from '@tweenjs/tween.js';
|
|
3
6
|
|
|
4
7
|
export declare type ActionableData = {
|
|
5
8
|
arguments: string[];
|
|
@@ -16,6 +19,13 @@ export declare type ActionEntity = {
|
|
|
16
19
|
data: ActionData;
|
|
17
20
|
};
|
|
18
21
|
|
|
22
|
+
export declare type AddJumpHitsUserActionEntity = {
|
|
23
|
+
name: 'add_jump_hits';
|
|
24
|
+
data: {
|
|
25
|
+
count: number;
|
|
26
|
+
};
|
|
27
|
+
} & UserActionEntity;
|
|
28
|
+
|
|
19
29
|
declare type AppOptions = {
|
|
20
30
|
font?: string;
|
|
21
31
|
sounds?: SoundOptions;
|
|
@@ -29,6 +39,13 @@ declare type Collider = {
|
|
|
29
39
|
h: number;
|
|
30
40
|
};
|
|
31
41
|
|
|
42
|
+
export declare type ColorUserActionEntity = {
|
|
43
|
+
name: 'color';
|
|
44
|
+
data: {
|
|
45
|
+
color: string;
|
|
46
|
+
};
|
|
47
|
+
} & UserActionEntity;
|
|
48
|
+
|
|
32
49
|
export declare type DashUserActionEntity = {
|
|
33
50
|
name: 'dash';
|
|
34
51
|
data: {
|
|
@@ -36,6 +53,94 @@ export declare type DashUserActionEntity = {
|
|
|
36
53
|
};
|
|
37
54
|
} & UserActionEntity;
|
|
38
55
|
|
|
56
|
+
declare class Evotar {
|
|
57
|
+
container: PIXI.Container;
|
|
58
|
+
private userState;
|
|
59
|
+
state: EvotarState;
|
|
60
|
+
private animationState;
|
|
61
|
+
private sprite?;
|
|
62
|
+
trail: EvotarTrailEffect;
|
|
63
|
+
private name;
|
|
64
|
+
private info;
|
|
65
|
+
private message;
|
|
66
|
+
private emoteSpitter;
|
|
67
|
+
private velocity;
|
|
68
|
+
private runSpeed;
|
|
69
|
+
private gravity;
|
|
70
|
+
private dashAcc;
|
|
71
|
+
private isJumping;
|
|
72
|
+
private isHitJumping;
|
|
73
|
+
private isDashing;
|
|
74
|
+
private isDespawned;
|
|
75
|
+
isDead: boolean;
|
|
76
|
+
deathTimer?: Timer;
|
|
77
|
+
landTimer?: Timer;
|
|
78
|
+
stateTimer?: Timer;
|
|
79
|
+
scaleTimer?: Timer;
|
|
80
|
+
spawnTween?: TWEEN.Tween<PIXI.Container>;
|
|
81
|
+
fadeTween?: TWEEN.Tween<PIXI.Container>;
|
|
82
|
+
scaleTween?: TWEEN.Tween<Evotar>;
|
|
83
|
+
private offset;
|
|
84
|
+
private screenBounds;
|
|
85
|
+
getCenterOffsetY(): number;
|
|
86
|
+
getCenterPosition(): PIXI.PointData;
|
|
87
|
+
setPosition(position: PIXI.PointData): void;
|
|
88
|
+
getScale(): number;
|
|
89
|
+
getCollider(): Collider;
|
|
90
|
+
constructor();
|
|
91
|
+
resurrect(): Promise<void>;
|
|
92
|
+
die(): Promise<void>;
|
|
93
|
+
spawn(props?: EvotarSpawnProps): void;
|
|
94
|
+
despawn(props?: EvotarDepawnProps): void;
|
|
95
|
+
scale(options: {
|
|
96
|
+
value: number;
|
|
97
|
+
duration: number;
|
|
98
|
+
}): void;
|
|
99
|
+
addJumpHit(count: number): void;
|
|
100
|
+
jump(options?: EvotarJumpProps): Promise<void>;
|
|
101
|
+
dash(options: {
|
|
102
|
+
force: number;
|
|
103
|
+
}): void;
|
|
104
|
+
setSprite(sprite: string): Promise<void>;
|
|
105
|
+
setProps(props: EvotarProps): Promise<void>;
|
|
106
|
+
setUserProps(props: UserProps): void;
|
|
107
|
+
private move;
|
|
108
|
+
jumpHit(): void;
|
|
109
|
+
update(): void;
|
|
110
|
+
isOnGround(y: number): boolean;
|
|
111
|
+
addMessage(message: string): void;
|
|
112
|
+
spitEmotes(emotes: string[]): Promise<void>;
|
|
113
|
+
setAnimationState(state: EvotarSpriteTags, force?: boolean): Promise<void>;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
declare type EvotarAnimatedSprites = {
|
|
117
|
+
[tag in string]: EvotarLayerSprites;
|
|
118
|
+
};
|
|
119
|
+
|
|
120
|
+
declare type EvotarDepawnProps = {
|
|
121
|
+
onComplete?: () => void;
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
declare type EvotarJumpProps = {
|
|
125
|
+
velocityX?: number;
|
|
126
|
+
velocityY?: number;
|
|
127
|
+
};
|
|
128
|
+
|
|
129
|
+
declare type EvotarLayerSprites = {
|
|
130
|
+
[layer in string]: AnimatedSprite;
|
|
131
|
+
};
|
|
132
|
+
|
|
133
|
+
declare type EvotarProps = {
|
|
134
|
+
name?: string;
|
|
135
|
+
sprite?: string;
|
|
136
|
+
color?: PIXI.Color;
|
|
137
|
+
direction?: number;
|
|
138
|
+
scale?: number;
|
|
139
|
+
isAnonymous?: boolean;
|
|
140
|
+
isImmortal?: boolean;
|
|
141
|
+
zIndex?: number;
|
|
142
|
+
};
|
|
143
|
+
|
|
39
144
|
export declare class Evotars {
|
|
40
145
|
private readonly root;
|
|
41
146
|
private readonly options;
|
|
@@ -45,10 +150,72 @@ export declare class Evotars {
|
|
|
45
150
|
processAction: (data: UserActionEntity) => Promise<void>;
|
|
46
151
|
processChatters: (data: TwitchChatterEntity[]) => Promise<void>;
|
|
47
152
|
processRaid: (data: RaidEntity) => void;
|
|
153
|
+
get manager(): {
|
|
154
|
+
viewers: Record<string, Evotar | undefined>;
|
|
155
|
+
tombstones: TombStone[];
|
|
156
|
+
raiders: Evotar[];
|
|
157
|
+
recentEvotarActivity: Record<string, number | undefined>;
|
|
158
|
+
subscriptions: {
|
|
159
|
+
onAdd: (evotar: Evotar) => void;
|
|
160
|
+
onDelete: (evotar: Evotar) => void;
|
|
161
|
+
}[];
|
|
162
|
+
subscribe(subscription: {
|
|
163
|
+
onAdd: (evotar: Evotar) => void;
|
|
164
|
+
onDelete: (evotar: Evotar) => void;
|
|
165
|
+
}): void;
|
|
166
|
+
update(): void;
|
|
167
|
+
getViewerEvotars(): Record<string, Evotar | undefined>;
|
|
168
|
+
getViewerEvotar(id: number): Evotar | undefined;
|
|
169
|
+
spawnViewerEvotar(userId: string, props: EvotarProps, spawnProps: EvotarSpawnProps): Promise<Evotar>;
|
|
170
|
+
processRaid(data: RaidEntity): void;
|
|
171
|
+
despawnEvotar(id: string, evotar: Evotar): void;
|
|
172
|
+
processChatters(data: TwitchChatterEntity[]): Promise<void>;
|
|
173
|
+
hasActivity: (userId: string) => boolean;
|
|
174
|
+
doAction(action: UserActionEntity, evotar: Evotar): void;
|
|
175
|
+
prepareEvotarProps(name: string, color?: string | undefined, sprite?: string | undefined): EvotarProps;
|
|
176
|
+
processAction(action: UserActionEntity): Promise<void>;
|
|
177
|
+
processMessage(data: MessageEntity): Promise<void>;
|
|
178
|
+
getViewerId(evotar: Evotar): string | undefined;
|
|
179
|
+
resurrect(evotar: Evotar): void;
|
|
180
|
+
kill(evotar: Evotar): void;
|
|
181
|
+
addTombStone(object: TombStone): void;
|
|
182
|
+
deleteTombStone(object: TombStone): void;
|
|
183
|
+
addViewer(id: string, evotar: Evotar): void;
|
|
184
|
+
deleteViewer(id: string, evotar: Evotar): void;
|
|
185
|
+
addRaider(evotar: Evotar): void;
|
|
186
|
+
deleteRaider(evotar: Evotar): void;
|
|
187
|
+
zIndexEvotarMax(from: number): number;
|
|
188
|
+
zIndexEvotarMin(from: number): number;
|
|
189
|
+
};
|
|
48
190
|
updateSettings(data: SettingsEntity): void;
|
|
49
191
|
run(): Promise<void>;
|
|
50
192
|
}
|
|
51
193
|
|
|
194
|
+
declare type EvotarSpawnProps = {
|
|
195
|
+
isFalling?: boolean;
|
|
196
|
+
positionX?: number;
|
|
197
|
+
onComplete?: () => void;
|
|
198
|
+
};
|
|
199
|
+
|
|
200
|
+
declare class EvotarSpriteContainer {
|
|
201
|
+
private sprites;
|
|
202
|
+
data: EvotarSpriteData;
|
|
203
|
+
container: PIXI.Container;
|
|
204
|
+
private currentTag;
|
|
205
|
+
constructor(sprites: EvotarAnimatedSprites, data: EvotarSpriteData);
|
|
206
|
+
getLayersByTag(tag: EvotarSpriteTags): EvotarLayerSprites;
|
|
207
|
+
setTag(tag?: EvotarSpriteTags): void;
|
|
208
|
+
update(props: EvotarSpriteContainerProps): void;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
declare type EvotarSpriteContainerProps = {
|
|
212
|
+
color: {
|
|
213
|
+
[key in string]?: PIXI.Color;
|
|
214
|
+
};
|
|
215
|
+
scale: Point;
|
|
216
|
+
play: boolean;
|
|
217
|
+
};
|
|
218
|
+
|
|
52
219
|
declare type EvotarSpriteData = {
|
|
53
220
|
name: string;
|
|
54
221
|
collider: Collider;
|
|
@@ -58,6 +225,32 @@ declare type EvotarSpriteData = {
|
|
|
58
225
|
colored: string[];
|
|
59
226
|
};
|
|
60
227
|
|
|
228
|
+
declare enum EvotarSpriteTags {
|
|
229
|
+
Idle = "Idle",
|
|
230
|
+
Jump = "Jump",
|
|
231
|
+
Fall = "Fall",
|
|
232
|
+
Land = "Land",
|
|
233
|
+
Run = "Run",
|
|
234
|
+
Die = "Die"
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
declare type EvotarState = Required<EvotarProps>;
|
|
238
|
+
|
|
239
|
+
declare class EvotarTrailEffect {
|
|
240
|
+
container: PIXI.Container;
|
|
241
|
+
private timer?;
|
|
242
|
+
private sprite?;
|
|
243
|
+
private opacityStep;
|
|
244
|
+
private shadowStep;
|
|
245
|
+
constructor();
|
|
246
|
+
setSprite(sprite: EvotarSpriteContainer): void;
|
|
247
|
+
update(props: EvotarTrailEffectProps): void;
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
declare type EvotarTrailEffectProps = {
|
|
251
|
+
play: boolean;
|
|
252
|
+
};
|
|
253
|
+
|
|
61
254
|
export declare type GrowUserActionEntity = {
|
|
62
255
|
name: 'grow';
|
|
63
256
|
data: {
|
|
@@ -66,18 +259,20 @@ export declare type GrowUserActionEntity = {
|
|
|
66
259
|
};
|
|
67
260
|
} & UserActionEntity;
|
|
68
261
|
|
|
69
|
-
export declare
|
|
70
|
-
|
|
71
|
-
|
|
262
|
+
export declare const isAddJumpHitsUserActionEntity: (entity: ActionEntity) => entity is AddJumpHitsUserActionEntity;
|
|
263
|
+
|
|
264
|
+
export declare const isColorUserActionEntity: (entity: ActionEntity) => entity is ColorUserActionEntity;
|
|
72
265
|
|
|
73
266
|
export declare const isDashUserActionEntity: (entity: ActionEntity) => entity is DashUserActionEntity;
|
|
74
267
|
|
|
75
268
|
export declare const isGrowUserActionEntity: (entity: ActionEntity) => entity is GrowUserActionEntity;
|
|
76
269
|
|
|
77
|
-
export declare const isInfoUserActionEntity: (entity: ActionEntity) => entity is InfoUserActionEntity;
|
|
78
|
-
|
|
79
270
|
export declare const isJumpUserActionEntity: (entity: ActionEntity) => entity is JumpUserActionEntity;
|
|
80
271
|
|
|
272
|
+
export declare const isResurrectUserActionEntity: (entity: ActionEntity) => entity is ResurrectUserActionEntity;
|
|
273
|
+
|
|
274
|
+
export declare const isSpriteUserActionEntity: (entity: ActionEntity) => entity is SpriteUserActionEntity;
|
|
275
|
+
|
|
81
276
|
export declare type JumpUserActionEntity = {
|
|
82
277
|
name: 'jump';
|
|
83
278
|
data: {
|
|
@@ -93,6 +288,11 @@ export declare type MessageEntity = {
|
|
|
93
288
|
info: UserInfo;
|
|
94
289
|
};
|
|
95
290
|
|
|
291
|
+
declare type Point = {
|
|
292
|
+
x?: number;
|
|
293
|
+
y?: number;
|
|
294
|
+
};
|
|
295
|
+
|
|
96
296
|
export declare type RaidEntity = {
|
|
97
297
|
broadcaster: {
|
|
98
298
|
id: string;
|
|
@@ -104,6 +304,11 @@ export declare type RaidEntity = {
|
|
|
104
304
|
};
|
|
105
305
|
};
|
|
106
306
|
|
|
307
|
+
export declare type ResurrectUserActionEntity = {
|
|
308
|
+
name: 'resurrect';
|
|
309
|
+
data: {};
|
|
310
|
+
} & UserActionEntity;
|
|
311
|
+
|
|
107
312
|
export declare type SettingsEntity = {
|
|
108
313
|
showAnonymousEvotars?: boolean;
|
|
109
314
|
fallingEvotars?: boolean;
|
|
@@ -135,6 +340,41 @@ declare type SpriteSize = {
|
|
|
135
340
|
h: number;
|
|
136
341
|
};
|
|
137
342
|
|
|
343
|
+
export declare type SpriteUserActionEntity = {
|
|
344
|
+
name: 'sprite';
|
|
345
|
+
data: {
|
|
346
|
+
sprite: string;
|
|
347
|
+
};
|
|
348
|
+
} & UserActionEntity;
|
|
349
|
+
|
|
350
|
+
declare class Timer {
|
|
351
|
+
current: number;
|
|
352
|
+
private onComplete?;
|
|
353
|
+
isCompleted: boolean;
|
|
354
|
+
constructor(current?: number, onComplete?: (() => void) | undefined);
|
|
355
|
+
tick(delta?: number): void;
|
|
356
|
+
complete(): void;
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
declare class TombStone {
|
|
360
|
+
readonly id: string;
|
|
361
|
+
container: PIXI.Container;
|
|
362
|
+
private sprite;
|
|
363
|
+
private gravity;
|
|
364
|
+
private velocity;
|
|
365
|
+
fadeTween?: TWEEN.Tween<PIXI.Container>;
|
|
366
|
+
constructor(id: string);
|
|
367
|
+
isOnGround(y: number): boolean;
|
|
368
|
+
update(): void;
|
|
369
|
+
despawn(smooth?: boolean, onComplete?: () => void): void;
|
|
370
|
+
spawn(props: TombStoneProps): void;
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
declare type TombStoneProps = {
|
|
374
|
+
position: Point;
|
|
375
|
+
scale: number;
|
|
376
|
+
};
|
|
377
|
+
|
|
138
378
|
export declare type TwitchChatterEntity = {
|
|
139
379
|
userId: string;
|
|
140
380
|
name: string;
|
|
@@ -142,7 +382,6 @@ export declare type TwitchChatterEntity = {
|
|
|
142
382
|
|
|
143
383
|
export declare type UserActionEntity = {
|
|
144
384
|
userId: string;
|
|
145
|
-
cooldown: number;
|
|
146
385
|
info: UserInfo;
|
|
147
386
|
} & ActionEntity;
|
|
148
387
|
|
|
@@ -160,4 +399,8 @@ export declare type UserInfo = {
|
|
|
160
399
|
color?: string;
|
|
161
400
|
};
|
|
162
401
|
|
|
402
|
+
declare type UserProps = {
|
|
403
|
+
color?: PIXI.Color;
|
|
404
|
+
};
|
|
405
|
+
|
|
163
406
|
export { }
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { E as b, U as pt, T as pe, O as q, M as U, N as Fe, c as Me, w as L, j as R, P as gt, t as Re, K as k, L as H, b as Q, B as D, I, Q as mt, V as xt, a as _t, W as re, X as z, R as V, Y as bt, Z as M, _ as E, $ as yt, q as B, a0 as Tt, D as $, a1 as wt, a2 as Z, a3 as vt, m as St, a4 as Ct, a5 as se, n as ge, e as P, a6 as Bt } from "./index-
|
|
2
|
-
import { U as Y, T as A, R as ne, S as Ae, i as ae, b as ke, c as Ue, j as Ge, e as Pt, r as ze, o as Ft, n as He, a as Mt, g as Rt, k as At, m as kt, B as Ie } from "./colorToUniform-
|
|
3
|
-
import { C as W } from "./CanvasPool-
|
|
4
|
-
import { g as Ut } from "./getBatchSamplersUniformGroup-
|
|
1
|
+
import { E as b, U as pt, T as pe, O as q, M as U, N as Fe, c as Me, w as L, j as R, P as gt, t as Re, K as k, L as H, b as Q, B as D, I, Q as mt, V as xt, a as _t, W as re, X as z, R as V, Y as bt, Z as M, _ as E, $ as yt, q as B, a0 as Tt, D as $, a1 as wt, a2 as Z, a3 as vt, m as St, a4 as Ct, a5 as se, n as ge, e as P, a6 as Bt } from "./index-RgERw5ms.js";
|
|
2
|
+
import { U as Y, T as A, R as ne, S as Ae, i as ae, b as ke, c as Ue, j as Ge, e as Pt, r as ze, o as Ft, n as He, a as Mt, g as Rt, k as At, m as kt, B as Ie } from "./colorToUniform-ZnVvWd8z.js";
|
|
3
|
+
import { C as W } from "./CanvasPool-323z5Bgc.js";
|
|
4
|
+
import { g as Ut } from "./getBatchSamplersUniformGroup-DIigPB-W.js";
|
|
5
5
|
class We {
|
|
6
6
|
/**
|
|
7
7
|
* Initialize the plugin with scope of application instance
|
package/package.json
CHANGED