evotars 0.0.11 → 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-323z5Bgc.js +46 -0
- package/dist/SharedSystems-CpNLwPlr.js +2134 -0
- package/dist/WebGLRenderer-8_UYFwzF.js +2564 -0
- package/dist/WebGPURenderer-D3yK12c3.js +1561 -0
- package/dist/browserAll--tlJ0wmH.js +1968 -0
- package/dist/colorToUniform-ZnVvWd8z.js +1308 -0
- package/dist/evotars.js +9 -26282
- package/dist/evotars.umd.cjs +902 -1069
- package/dist/getBatchSamplersUniformGroup-DIigPB-W.js +16 -0
- package/dist/index-RgERw5ms.js +14288 -0
- package/dist/index.d.ts +236 -5
- package/dist/webworkerAll-DxpydbmF.js +2661 -0
- package/package.json +3 -3
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
1
|
+
import { AnimatedSprite } from 'pixi.js';
|
|
2
|
+
import * as PIXI from 'pixi.js';
|
|
3
|
+
import { SpritesheetData as SpritesheetData_2 } from 'pixi.js';
|
|
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;
|
|
@@ -43,6 +53,94 @@ export declare type DashUserActionEntity = {
|
|
|
43
53
|
};
|
|
44
54
|
} & UserActionEntity;
|
|
45
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
|
+
|
|
46
144
|
export declare class Evotars {
|
|
47
145
|
private readonly root;
|
|
48
146
|
private readonly options;
|
|
@@ -52,10 +150,72 @@ export declare class Evotars {
|
|
|
52
150
|
processAction: (data: UserActionEntity) => Promise<void>;
|
|
53
151
|
processChatters: (data: TwitchChatterEntity[]) => Promise<void>;
|
|
54
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
|
+
};
|
|
55
190
|
updateSettings(data: SettingsEntity): void;
|
|
56
191
|
run(): Promise<void>;
|
|
57
192
|
}
|
|
58
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
|
+
|
|
59
219
|
declare type EvotarSpriteData = {
|
|
60
220
|
name: string;
|
|
61
221
|
collider: Collider;
|
|
@@ -65,6 +225,32 @@ declare type EvotarSpriteData = {
|
|
|
65
225
|
colored: string[];
|
|
66
226
|
};
|
|
67
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
|
+
|
|
68
254
|
export declare type GrowUserActionEntity = {
|
|
69
255
|
name: 'grow';
|
|
70
256
|
data: {
|
|
@@ -73,6 +259,8 @@ export declare type GrowUserActionEntity = {
|
|
|
73
259
|
};
|
|
74
260
|
} & UserActionEntity;
|
|
75
261
|
|
|
262
|
+
export declare const isAddJumpHitsUserActionEntity: (entity: ActionEntity) => entity is AddJumpHitsUserActionEntity;
|
|
263
|
+
|
|
76
264
|
export declare const isColorUserActionEntity: (entity: ActionEntity) => entity is ColorUserActionEntity;
|
|
77
265
|
|
|
78
266
|
export declare const isDashUserActionEntity: (entity: ActionEntity) => entity is DashUserActionEntity;
|
|
@@ -81,6 +269,8 @@ export declare const isGrowUserActionEntity: (entity: ActionEntity) => entity is
|
|
|
81
269
|
|
|
82
270
|
export declare const isJumpUserActionEntity: (entity: ActionEntity) => entity is JumpUserActionEntity;
|
|
83
271
|
|
|
272
|
+
export declare const isResurrectUserActionEntity: (entity: ActionEntity) => entity is ResurrectUserActionEntity;
|
|
273
|
+
|
|
84
274
|
export declare const isSpriteUserActionEntity: (entity: ActionEntity) => entity is SpriteUserActionEntity;
|
|
85
275
|
|
|
86
276
|
export declare type JumpUserActionEntity = {
|
|
@@ -98,6 +288,11 @@ export declare type MessageEntity = {
|
|
|
98
288
|
info: UserInfo;
|
|
99
289
|
};
|
|
100
290
|
|
|
291
|
+
declare type Point = {
|
|
292
|
+
x?: number;
|
|
293
|
+
y?: number;
|
|
294
|
+
};
|
|
295
|
+
|
|
101
296
|
export declare type RaidEntity = {
|
|
102
297
|
broadcaster: {
|
|
103
298
|
id: string;
|
|
@@ -109,6 +304,11 @@ export declare type RaidEntity = {
|
|
|
109
304
|
};
|
|
110
305
|
};
|
|
111
306
|
|
|
307
|
+
export declare type ResurrectUserActionEntity = {
|
|
308
|
+
name: 'resurrect';
|
|
309
|
+
data: {};
|
|
310
|
+
} & UserActionEntity;
|
|
311
|
+
|
|
112
312
|
export declare type SettingsEntity = {
|
|
113
313
|
showAnonymousEvotars?: boolean;
|
|
114
314
|
fallingEvotars?: boolean;
|
|
@@ -127,11 +327,11 @@ declare type SpriteLoaderFn = (name: string) => Promise<{
|
|
|
127
327
|
image: string;
|
|
128
328
|
} | undefined>;
|
|
129
329
|
|
|
130
|
-
declare interface SpritesheetData extends
|
|
330
|
+
declare interface SpritesheetData extends SpritesheetData_2 {
|
|
131
331
|
frames: Record<string, SpritesheetFrameData>;
|
|
132
332
|
}
|
|
133
333
|
|
|
134
|
-
declare interface SpritesheetFrameData extends
|
|
334
|
+
declare interface SpritesheetFrameData extends SpritesheetFrameData_2 {
|
|
135
335
|
duration: number;
|
|
136
336
|
}
|
|
137
337
|
|
|
@@ -147,6 +347,34 @@ export declare type SpriteUserActionEntity = {
|
|
|
147
347
|
};
|
|
148
348
|
} & UserActionEntity;
|
|
149
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
|
+
|
|
150
378
|
export declare type TwitchChatterEntity = {
|
|
151
379
|
userId: string;
|
|
152
380
|
name: string;
|
|
@@ -154,7 +382,6 @@ export declare type TwitchChatterEntity = {
|
|
|
154
382
|
|
|
155
383
|
export declare type UserActionEntity = {
|
|
156
384
|
userId: string;
|
|
157
|
-
cooldown: number;
|
|
158
385
|
info: UserInfo;
|
|
159
386
|
} & ActionEntity;
|
|
160
387
|
|
|
@@ -172,4 +399,8 @@ export declare type UserInfo = {
|
|
|
172
399
|
color?: string;
|
|
173
400
|
};
|
|
174
401
|
|
|
402
|
+
declare type UserProps = {
|
|
403
|
+
color?: PIXI.Color;
|
|
404
|
+
};
|
|
405
|
+
|
|
175
406
|
export { }
|