forked from pixijs/particle-emitter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.d.ts
204 lines (181 loc) · 6.41 KB
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
// Typings for pixi-particles 2.1.9, requires Pixi.js typings
declare namespace particles {
type TexSrc = string|PIXI.Texture;
export interface ParticleConstructor {
new (emitter:Emitter):Particle;
}
export interface AnimatedParticleArt {
textures:(TexSrc|{count:number, texture:TexSrc})[];
framerate:number|"matchLife";
loop?:boolean;
}
export interface ParsedAnimatedParticleArt {
textures:PIXI.Texture[];
framerate:number;
elapsed:number;
loop:boolean;
}
export class AnimatedParticle extends Particle {
protected textures:PIXI.Texture[];
protected duration:number;
protected framerate:number;
protected elapsed:number;
protected loop:boolean;
public static parseArt(art:AnimatedParticleArt[]):ParsedAnimatedParticleArt[];
public applyArt(art:ParsedAnimatedParticleArt):void;
}
export class Emitter {
protected _particleConstructor:new (emitter:Emitter)=>Particle;
protected _frequency:number;
protected _spawnFunc:(p:Particle, emitPosX:number, emitPosY:number, i:number)=>void;
protected _prevEmitterPos:PIXI.Point;
protected _prevPosIsValid:boolean;
protected _posChanged:boolean;
protected _parentIsPC:boolean;
protected _parent:PIXI.Container;
protected _emit:boolean;
protected _spawnTimer:number;
protected _emitterLife:number;
protected _activeParticlesFirst:Particle;
protected _activeParticlesLast:Particle;
protected _poolFirst:Particle;
protected _origConfig:any;
protected _origArt:any;
protected _autoUpdate:boolean;
protected _destroyWhenComplete:boolean;
protected _completeCallback:()=>void;
protected _spawnPos:PIXI.Point;
protected _ownerPos:PIXI.Point;
protected _spawnType:string;
protected _rotation:number;
public particleImages:any[];
public startAlpha:number;
public endAlpha:number;
public startSpeed:number;
public endSpeed:number;
public minimumSpeedMultiplier:number;
public acceleration:PIXI.Point;
public maxSpeed:number;
public startScale:number;
public endScale:number;
public minimumScaleMultiplier:number;
public startColor:[number, number, number];
public endColor:[number, number, number];
public minLifetime:number;
public maxLifetime:number;
public minStartRotation:number;
public maxStartRotation:number;
public noRotation:boolean;
public minRotationSpeed:number;
public maxRotationSpeed:number;
public particleBlendMode:number;
public customEase:(time:number)=>number;
public extraData:any;
public maxParticles:number;
public emitterLifetime:number;
public readonly spawnPos:PIXI.Point;
public readonly spawnType:"point"|"rectangle"|"circle"|"burst"|"ring";
public spawnRect:PIXI.Rectangle;
public spawnCircle:PIXI.Circle;
public particlesPerWave:number;
public particleSpacing:number;
public angleStart:number;
public readonly rotation:number;
public readonly ownerPos:PIXI.Point;
public addAtBack:boolean;
public readonly particleCount:number;
public frequency:number;
public particleConstructor:ParticleConstructor;
public parent:PIXI.Container;
public emit:boolean;
public autoUpdate:boolean;
constructor(particleParent:PIXI.Container, particleImages:any, config:any);
protected recycle(p:Particle):void;
protected _spawnPoint(p:Particle, emitPosX:number, emitPosY:number, i:number):void;
protected _spawnRect(p:Particle, emitPosX:number, emitPosY:number, i:number):void;
protected _spawnCircle(p:Particle, emitPosX:number, emitPosY:number, i:number):void;
protected _spawnRing(p:Particle, emitPosX:number, emitPosY:number, i:number):void;
protected _spawnBurst(p:Particle, emitPosX:number, emitPosY:number, i:number):void;
protected _initSpawnType(config:any):void;
public init(art:any, config:any):void;
public rotate(newRot:number):void;
public updateSpawnPos(x:number, y:number):void;
public updateOwnerPos(x:number, y:number):void;
public resetPositionTracking():void;
public update(delta:number):void;
public playOnceAndDestroy(callback?:()=>void):void;
public playOnce(callback?:()=>void):void;
public cleanup():void;
public destroy():void;
}
export class Particle extends PIXI.Sprite {
protected _sR:number;
protected _sG:number;
protected _sB:number;
protected _eR:number;
protected _eG:number;
protected _eB:number;
protected _doAlpha:boolean;
protected _doScale:boolean;
protected _doSpeed:boolean;
protected _doAcceleration:boolean;
protected _doColor:boolean;
protected _doNormalMovement:boolean;
protected _oneOverLife:number;
protected next:Particle;
protected prev:Particle;
public emitter:Emitter;
public velocity:PIXI.Point;
public maxLife:number;
public age:number;
public ease:(time:number)=>number;
public extraData:any;
public startAlpha:number;
public endAlpha:number;
public startSpeed:number;
public endSpeed:number;
public acceleration:PIXI.Point;
public maxSpeed:number;
public startScale:number;
public endScale:number;
public startColor:number[];
public endColor:number[];
/** Note that for Particle, the parameter is an array of strings or PIXI.Textures, and an array of Textures is returned. */
public static parseArt(art:any):any;
public static parseData(data:any):any;
constructor(emitter:Emitter);
protected Particle_init():void;
protected Particle_update(delta:number):number;
public init():void;
/** Note that for Particle, the parameter is of type PIXI.Texture */
public applyArt(art:any):void;
public update(delta:number):number;
public kill():void;
public destroy():void;
}
export interface EaseSegment {
cp:number;
s:number;
e:number;
}
export class ParticleUtils {
public static verbose:boolean;
public static rotatePoint(angle:number, p:PIXI.Point):void;
public static combineRGBComponents(r:number, g:number, b:number):number;
public static normalize(p:PIXI.Point):void;
public static scaleBy(p:PIXI.Point, value:number):void;
public static length(p:PIXI.Point):number;
public static hexToRGB(color:string, output?:[number, number, number]):[number, number, number];
public static generateEase(segments:EaseSegment[]):(time:number)=>number;
public static getBlendMode(name:string):number;
}
export class PathParticle extends Particle {
public path:(x:number)=>number;
public initialRotation:number;
public initialPosition:PIXI.Point;
public movement:number;
public static parseArt(art:TexSrc[]):PIXI.Texture[];
public static parseData(data:{path:string}):any;
}
}
export = particles;