forked from pixijs/pixi-typescript
-
Notifications
You must be signed in to change notification settings - Fork 0
/
pixi-particles.d.ts
219 lines (184 loc) · 7.13 KB
/
pixi-particles.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
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
// Type definitions for pixi-particles
// Project: https://github.com/pixijs/pixi-particles
// Definitions by: clark-stevenson <https://github.com/pixijs/pixi-typescript>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
///<reference path="pixi.js.d.ts"/>
declare module PIXI {
export module particles {
export interface EmitterConfig {
alpha?: {
start?: number;
end?: number;
};
speed?: {
start?: number;
end?: number;
};
acceleration?: PIXI.Point;
scale?: {
start?: number;
end?: number;
minimumScaleMultiplier?: number;
};
color?: {
start?: number;
end?: number;
};
startRotation?: {
min?: number;
max?: number;
};
rotationSpeed?: {
min?: number;
max?: number;
};
lifetime?: {
min?: number;
max?: number;
};
blendMode?: number;
ease?: (time: number) => void;
extraData?: any;
spawnType?: string;
frequency?: number;
emitterLifetime?: number;
maxParticles?: number;
addAtBack?: boolean;
pos?: PIXI.Point;
}
export class Emitter {
constructor(particleParent: PIXI.DisplayObject, particleImages?: PIXI.Texture | PIXI.Texture[] | string | string[], config?: EmitterConfig);
protected _particleConstructor: Particle;
particleImages: PIXI.Texture | PIXI.Texture[] | string | string[];
startAlpha: number;
endAlpha: number;
startSpeed: number;
endSpeed: number;
acceleration: PIXI.Point;
startScale: number;
endScale: number;
minimumScaleMultiplier: number;
startColor: number;
endColor: number;
minLifetime: number;
maxLifetime: number;
minStartRotation: number;
maxStartRotation: number;
minRotationSpeed: number;
maxRotationSpeed: number;
particleBlendMode: number;
customEase: number;
extraData: any;
protected _frequency: number;
maxParticles: number;
emitterLifetime: number;
spawnPos: PIXI.Point;
protected _spawnFunc: Function;
spawnRect: PIXI.Rectangle;
spawnCircle: PIXI.Circle;
particlesPerWave: number;
particleSpacing: number;
angleStart: number;
rotation: number;
ownerPos: PIXI.Point;
protected _prevEmitterPos: PIXI.Point;
protected _prevPosIsValid: boolean;
protected _posChanged: boolean;
protected _parentIsPC: boolean;
protected _parent: PIXI.DisplayObject | PIXI.ParticleContainer;
addAtBack: boolean;
particleCount: number;
protected _emit: boolean;
protected _spawnTimer: boolean;
protected _emitterLife: number;
protected _activeParticlesFirst: Particle;
protected _activeParticlesLast: Particle;
protected _poolFirst: Particle;
protected _origConfig: EmitterConfig;
protected _origArt: PIXI.Texture | PIXI.Texture[] | string | string[];
frequency: number;
particleConstructor: Function;
parent: PIXI.DisplayObject;
init(art: PIXI.Texture | PIXI.Texture[], config: EmitterConfig): void;
recycle(particle: Particle): void;
rotate(newRot: number): void;
updateSpawnPos(x: number, y: number): void;
updateOwnerPos(x: number, y: number): void;
resetPositionTracking(): void;
emit: boolean;
update(delta: number): void;
protected _spawnPoint(p: Particle, emitPosX: number, emitPosY: number): void;
protected _spawnRect(p: Particle, emitPosX: number, emitPosY: number): void;
protected _spawnCircle(p: Particle, emitPosX: number, emitPosY: number): void;
protected _spawnRing(p: Particle, emitPosX: number, emitPosY: number): void;
protected _spawnBurst(p: Particle, emitPosX: number, emitPosY: number, i: number): void;
cleanup(): void;
destroy(): void;
}
export class Particle extends PIXI.Sprite {
constructor(emitter: Emitter);
emitter: Emitter;
velocity: PIXI.Point;
maxLife: number;
age: number;
ease: (time: number) => void;
extraData: any;
startAlpha: number;
endAlpha: number;
startSpeed: number;
endSpeed: number;
acceleration: PIXI.Point;
startScale: number;
endScale: number;
startColor: number;
protected _sR: number;
protected _sG: number;
protected _sB: number;
endColor: 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;
protected init(): void;
applyArt(art: PIXI.Texture): void;
update(delta: number): number;
kill(): void;
destroy(): void;
static parseArt(art: PIXI.Texture[]): PIXI.Texture[];
static parseData(extraData: any): any;
}
export class ParticleUtils {
static DEG_TO_RAGS: number;
static useAPI3: boolean;
static rotatePoint(angle: number, p: PIXI.Point): void;
static combineRGBComponents(r: number, g: number, b: number): number;
static normalize(point: PIXI.Point): PIXI.Point;
static scaleBy(point: PIXI.Point, value: number): void;
static length(point: PIXI.Point): number;
static hexToRGB(color: string, output: number[]): number[];
static generateEase(segments: any[]): (time: number) => void;
static getBlendMode(name: string): number;
}
export class PathParticle {
constructor(emitter: Emitter);
path: Function;
initialRotation: number;
initialPosition: PIXI.Point;
movement: number;
static helperPoint: PIXI.Point;
init(): void;
update(delata: number): void;
destroy(): void;
static parseArt(art: PIXI.Texture[]): PIXI.Texture[];
static parseData(extraData: any): any;
}
}
}