rapid-render 0.1.13 → 0.1.14
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/index.d.ts +13 -13
- package/dist/interface.d.ts +315 -312
- package/dist/light.d.ts +7 -7
- package/dist/line.d.ts +2 -2
- package/dist/math.d.ts +520 -520
- package/dist/particle.d.ts +73 -73
- package/dist/rapid.global.js +1 -1
- package/dist/rapid.js +1 -1
- package/dist/rapid.umd.cjs +1 -1
- package/dist/render.d.ts +248 -248
- package/dist/utils.d.ts +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import Rapid from "./render";
|
|
2
|
-
import GLShader from "./webgl/glshader";
|
|
3
|
-
import { Text } from "./texture";
|
|
4
|
-
import { TileMapRender, TileSet } from "./tilemap";
|
|
5
|
-
import { Uniform } from "./webgl/uniform";
|
|
6
|
-
import { spriteAttributes, graphicAttributes } from "./regions/attributes";
|
|
7
|
-
import { ParticleEmitter } from "./particle";
|
|
8
|
-
export { Text, Rapid, GLShader, TileMapRender, TileSet, Uniform, ParticleEmitter, graphicAttributes, spriteAttributes, };
|
|
9
|
-
export * from "./math";
|
|
10
|
-
export * from "./interface";
|
|
11
|
-
export * from "./texture";
|
|
12
|
-
export * from "./render";
|
|
13
|
-
export * from "./particle";
|
|
1
|
+
import Rapid from "./render";
|
|
2
|
+
import GLShader from "./webgl/glshader";
|
|
3
|
+
import { Text } from "./texture";
|
|
4
|
+
import { TileMapRender, TileSet } from "./tilemap";
|
|
5
|
+
import { Uniform } from "./webgl/uniform";
|
|
6
|
+
import { spriteAttributes, graphicAttributes } from "./regions/attributes";
|
|
7
|
+
import { ParticleEmitter } from "./particle";
|
|
8
|
+
export { Text, Rapid, GLShader, TileMapRender, TileSet, Uniform, ParticleEmitter, graphicAttributes, spriteAttributes, };
|
|
9
|
+
export * from "./math";
|
|
10
|
+
export * from "./interface";
|
|
11
|
+
export * from "./texture";
|
|
12
|
+
export * from "./render";
|
|
13
|
+
export * from "./particle";
|
package/dist/interface.d.ts
CHANGED
|
@@ -1,312 +1,315 @@
|
|
|
1
|
-
import { Color, Vec2 } from "./math";
|
|
2
|
-
import { Texture } from "./texture";
|
|
3
|
-
import { TileSet } from "./tilemap";
|
|
4
|
-
import GLShader from "./webgl/glshader";
|
|
5
|
-
import { Uniform } from "./webgl/uniform";
|
|
6
|
-
/**
|
|
7
|
-
* @ignore
|
|
8
|
-
*/
|
|
9
|
-
export type WebGLContext = WebGL2RenderingContext | WebGLRenderingContext;
|
|
10
|
-
/**
|
|
11
|
-
* @ignore
|
|
12
|
-
*/
|
|
13
|
-
export interface IMathStruct<T> {
|
|
14
|
-
clone(obj: T): T;
|
|
15
|
-
copy(obj: T): void;
|
|
16
|
-
equal(obj: T): boolean;
|
|
17
|
-
}
|
|
18
|
-
export interface IRapidOptions {
|
|
19
|
-
canvas: HTMLCanvasElement;
|
|
20
|
-
width?: number;
|
|
21
|
-
height?: number;
|
|
22
|
-
backgroundColor?: Color;
|
|
23
|
-
antialias?: boolean;
|
|
24
|
-
}
|
|
25
|
-
export interface IAttribute {
|
|
26
|
-
name: string;
|
|
27
|
-
size: number;
|
|
28
|
-
type: number;
|
|
29
|
-
normalized?: boolean;
|
|
30
|
-
stride: number;
|
|
31
|
-
offset?: number;
|
|
32
|
-
}
|
|
33
|
-
export interface ITransformOptions {
|
|
34
|
-
position?: Vec2;
|
|
35
|
-
scale?: Vec2 | number;
|
|
36
|
-
rotation?: number;
|
|
37
|
-
offset?: Vec2;
|
|
38
|
-
x?: number;
|
|
39
|
-
y?: number;
|
|
40
|
-
offsetX?: number;
|
|
41
|
-
offsetY?: number;
|
|
42
|
-
origin?: Vec2 | number;
|
|
43
|
-
restoreTransform?: boolean;
|
|
44
|
-
saveTransform?: boolean;
|
|
45
|
-
afterSave?(): unknown;
|
|
46
|
-
beforRestore?(): unknown;
|
|
47
|
-
}
|
|
48
|
-
export interface ISpriteRenderOptions extends ITransformOptions, IShaderRenderOptions {
|
|
49
|
-
color?: Color;
|
|
50
|
-
texture?: Texture;
|
|
51
|
-
offset?: Vec2;
|
|
52
|
-
flipX?: boolean;
|
|
53
|
-
flipY?: boolean;
|
|
54
|
-
}
|
|
55
|
-
export interface ITextTextureOptions {
|
|
56
|
-
/**
|
|
57
|
-
* The text string to be rendered.
|
|
58
|
-
*/
|
|
59
|
-
text?: string;
|
|
60
|
-
/**
|
|
61
|
-
* The font size for the text.
|
|
62
|
-
* Default is 16.
|
|
63
|
-
*/
|
|
64
|
-
fontSize?: number;
|
|
65
|
-
/**
|
|
66
|
-
* The font family for the text.
|
|
67
|
-
* Default is 'Arial'.
|
|
68
|
-
*/
|
|
69
|
-
fontFamily?: string;
|
|
70
|
-
/**
|
|
71
|
-
* The color of the text.
|
|
72
|
-
* Default is '#000000' (black).
|
|
73
|
-
*/
|
|
74
|
-
color?: string;
|
|
75
|
-
/**
|
|
76
|
-
* The alignment of the text.
|
|
77
|
-
* Possible values: 'left', 'right', 'center', 'start', 'end'.
|
|
78
|
-
* Default is 'left'.
|
|
79
|
-
*/
|
|
80
|
-
textAlign?: CanvasTextAlign;
|
|
81
|
-
/**
|
|
82
|
-
* The baseline of the text.
|
|
83
|
-
* Possible values: 'top', 'hanging', 'middle', 'alphabetic', 'ideographic', 'bottom'.
|
|
84
|
-
* Default is 'top'.
|
|
85
|
-
*/
|
|
86
|
-
textBaseline?: CanvasTextBaseline;
|
|
87
|
-
}
|
|
88
|
-
export interface
|
|
89
|
-
width?: number;
|
|
90
|
-
closed?: boolean;
|
|
91
|
-
roundCap?: boolean;
|
|
92
|
-
textureMode?: LineTextureMode;
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
color?: Color | Color[];
|
|
108
|
-
drawType?: number;
|
|
109
|
-
uv?: Vec2[];
|
|
110
|
-
texture?: Texture;
|
|
111
|
-
}
|
|
112
|
-
export interface
|
|
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
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
1
|
+
import { Color, Vec2 } from "./math";
|
|
2
|
+
import { Texture } from "./texture";
|
|
3
|
+
import { TileSet } from "./tilemap";
|
|
4
|
+
import GLShader from "./webgl/glshader";
|
|
5
|
+
import { Uniform } from "./webgl/uniform";
|
|
6
|
+
/**
|
|
7
|
+
* @ignore
|
|
8
|
+
*/
|
|
9
|
+
export type WebGLContext = WebGL2RenderingContext | WebGLRenderingContext;
|
|
10
|
+
/**
|
|
11
|
+
* @ignore
|
|
12
|
+
*/
|
|
13
|
+
export interface IMathStruct<T> {
|
|
14
|
+
clone(obj: T): T;
|
|
15
|
+
copy(obj: T): void;
|
|
16
|
+
equal(obj: T): boolean;
|
|
17
|
+
}
|
|
18
|
+
export interface IRapidOptions {
|
|
19
|
+
canvas: HTMLCanvasElement;
|
|
20
|
+
width?: number;
|
|
21
|
+
height?: number;
|
|
22
|
+
backgroundColor?: Color;
|
|
23
|
+
antialias?: boolean;
|
|
24
|
+
}
|
|
25
|
+
export interface IAttribute {
|
|
26
|
+
name: string;
|
|
27
|
+
size: number;
|
|
28
|
+
type: number;
|
|
29
|
+
normalized?: boolean;
|
|
30
|
+
stride: number;
|
|
31
|
+
offset?: number;
|
|
32
|
+
}
|
|
33
|
+
export interface ITransformOptions {
|
|
34
|
+
position?: Vec2;
|
|
35
|
+
scale?: Vec2 | number;
|
|
36
|
+
rotation?: number;
|
|
37
|
+
offset?: Vec2;
|
|
38
|
+
x?: number;
|
|
39
|
+
y?: number;
|
|
40
|
+
offsetX?: number;
|
|
41
|
+
offsetY?: number;
|
|
42
|
+
origin?: Vec2 | number;
|
|
43
|
+
restoreTransform?: boolean;
|
|
44
|
+
saveTransform?: boolean;
|
|
45
|
+
afterSave?(): unknown;
|
|
46
|
+
beforRestore?(): unknown;
|
|
47
|
+
}
|
|
48
|
+
export interface ISpriteRenderOptions extends ITransformOptions, IShaderRenderOptions {
|
|
49
|
+
color?: Color;
|
|
50
|
+
texture?: Texture;
|
|
51
|
+
offset?: Vec2;
|
|
52
|
+
flipX?: boolean;
|
|
53
|
+
flipY?: boolean;
|
|
54
|
+
}
|
|
55
|
+
export interface ITextTextureOptions {
|
|
56
|
+
/**
|
|
57
|
+
* The text string to be rendered.
|
|
58
|
+
*/
|
|
59
|
+
text?: string;
|
|
60
|
+
/**
|
|
61
|
+
* The font size for the text.
|
|
62
|
+
* Default is 16.
|
|
63
|
+
*/
|
|
64
|
+
fontSize?: number;
|
|
65
|
+
/**
|
|
66
|
+
* The font family for the text.
|
|
67
|
+
* Default is 'Arial'.
|
|
68
|
+
*/
|
|
69
|
+
fontFamily?: string;
|
|
70
|
+
/**
|
|
71
|
+
* The color of the text.
|
|
72
|
+
* Default is '#000000' (black).
|
|
73
|
+
*/
|
|
74
|
+
color?: string;
|
|
75
|
+
/**
|
|
76
|
+
* The alignment of the text.
|
|
77
|
+
* Possible values: 'left', 'right', 'center', 'start', 'end'.
|
|
78
|
+
* Default is 'left'.
|
|
79
|
+
*/
|
|
80
|
+
textAlign?: CanvasTextAlign;
|
|
81
|
+
/**
|
|
82
|
+
* The baseline of the text.
|
|
83
|
+
* Possible values: 'top', 'hanging', 'middle', 'alphabetic', 'ideographic', 'bottom'.
|
|
84
|
+
* Default is 'top'.
|
|
85
|
+
*/
|
|
86
|
+
textBaseline?: CanvasTextBaseline;
|
|
87
|
+
}
|
|
88
|
+
export interface ILineStyleOptions extends IGraphicRenderOptions {
|
|
89
|
+
width?: number;
|
|
90
|
+
closed?: boolean;
|
|
91
|
+
roundCap?: boolean;
|
|
92
|
+
textureMode?: LineTextureMode;
|
|
93
|
+
points: Vec2[];
|
|
94
|
+
}
|
|
95
|
+
export declare enum LineTextureMode {
|
|
96
|
+
STRETCH = "stretch",
|
|
97
|
+
REPEAT = "repeat"
|
|
98
|
+
}
|
|
99
|
+
export declare enum TextureWrapMode {
|
|
100
|
+
REPEAT = "repeat",
|
|
101
|
+
CLAMP = "clamp",
|
|
102
|
+
MIRROR = "mirror"
|
|
103
|
+
}
|
|
104
|
+
export interface IRenderLineOptions extends ILineStyleOptions, ITransformOptions {
|
|
105
|
+
}
|
|
106
|
+
export interface IGraphicRenderOptions extends ITransformOptions, IShaderRenderOptions {
|
|
107
|
+
color?: Color | Color[];
|
|
108
|
+
drawType?: number;
|
|
109
|
+
uv?: Vec2[];
|
|
110
|
+
texture?: Texture;
|
|
111
|
+
}
|
|
112
|
+
export interface IPolygonGraphicRenderOptions extends IGraphicRenderOptions {
|
|
113
|
+
points: Vec2[];
|
|
114
|
+
}
|
|
115
|
+
export interface ICircleRenderOptions extends IGraphicRenderOptions {
|
|
116
|
+
radius: number;
|
|
117
|
+
segments?: number;
|
|
118
|
+
}
|
|
119
|
+
export interface IRectRenderOptions extends IGraphicRenderOptions {
|
|
120
|
+
width: number;
|
|
121
|
+
height: number;
|
|
122
|
+
}
|
|
123
|
+
export declare enum MaskType {
|
|
124
|
+
Include = "normal",
|
|
125
|
+
Exclude = "inverse"
|
|
126
|
+
}
|
|
127
|
+
export type UniformType = Record<string, number | Array<any> | boolean | Texture>;
|
|
128
|
+
export type Images = ImageBitmap | ImageData | HTMLImageElement | HTMLCanvasElement | HTMLVideoElement | OffscreenCanvas;
|
|
129
|
+
export interface IRegisterTileOptions extends ISpriteRenderOptions {
|
|
130
|
+
texture: Texture;
|
|
131
|
+
offsetX?: number;
|
|
132
|
+
offsetY?: number;
|
|
133
|
+
ySortOffset?: number;
|
|
134
|
+
}
|
|
135
|
+
export interface YSortCallback {
|
|
136
|
+
ySort: number;
|
|
137
|
+
render?: () => void;
|
|
138
|
+
renderSprite?: ISpriteRenderOptions;
|
|
139
|
+
}
|
|
140
|
+
export interface ILayerRenderOptions extends ITransformOptions {
|
|
141
|
+
error?: number | Vec2;
|
|
142
|
+
errorX?: number;
|
|
143
|
+
errorY?: number;
|
|
144
|
+
ySortCallback?: Array<YSortCallback>;
|
|
145
|
+
shape?: TilemapShape;
|
|
146
|
+
tileSet: TileSet;
|
|
147
|
+
eachTile?: (tileId: string | number, mapX: number, mapY: number) => ISpriteRenderOptions | undefined | void;
|
|
148
|
+
}
|
|
149
|
+
export interface IShaderRenderOptions {
|
|
150
|
+
shader?: GLShader;
|
|
151
|
+
uniforms?: Uniform;
|
|
152
|
+
}
|
|
153
|
+
export declare enum TilemapShape {
|
|
154
|
+
SQUARE = "square",
|
|
155
|
+
ISOMETRIC = "isometric"
|
|
156
|
+
}
|
|
157
|
+
export declare enum ShaderType {
|
|
158
|
+
SPRITE = "sprite",
|
|
159
|
+
GRAPHIC = "graphic"
|
|
160
|
+
}
|
|
161
|
+
export declare enum BlendMode {
|
|
162
|
+
Additive = "additive",
|
|
163
|
+
Subtractive = "subtractive",
|
|
164
|
+
Mix = "mix"
|
|
165
|
+
}
|
|
166
|
+
/**
|
|
167
|
+
* Interface for light rendering options
|
|
168
|
+
*/
|
|
169
|
+
export interface ILightRenderOptions {
|
|
170
|
+
/** Position of the light source */
|
|
171
|
+
lightSource: Vec2;
|
|
172
|
+
/** Array of vertex arrays for occlusion objects, each occlusion object is defined by a set of vertices */
|
|
173
|
+
occlusion: Vec2[][];
|
|
174
|
+
/** Base projection length that controls shadow length */
|
|
175
|
+
baseProjectionLength?: number;
|
|
176
|
+
/** Type of mask to apply */
|
|
177
|
+
type?: MaskType;
|
|
178
|
+
}
|
|
179
|
+
export interface ICameraOptions extends ITransformOptions {
|
|
180
|
+
}
|
|
181
|
+
/**
|
|
182
|
+
* Defines particle emitter shape types
|
|
183
|
+
*/
|
|
184
|
+
export declare enum ParticleShape {
|
|
185
|
+
/**
|
|
186
|
+
* Point emitter, emits particles from a single point
|
|
187
|
+
*/
|
|
188
|
+
POINT = "point",
|
|
189
|
+
/**
|
|
190
|
+
* Circle emitter, emits particles randomly from a circular area
|
|
191
|
+
*/
|
|
192
|
+
CIRCLE = "circle",
|
|
193
|
+
/**
|
|
194
|
+
* Rectangle emitter, emits particles randomly from a rectangular area
|
|
195
|
+
*/
|
|
196
|
+
RECT = "rect"
|
|
197
|
+
}
|
|
198
|
+
/**
|
|
199
|
+
* Defines particle attribute animation
|
|
200
|
+
* @template T Attribute type, can be number, vector or color
|
|
201
|
+
*/
|
|
202
|
+
export interface ParticleAttribute<T extends number | Vec2 | Color> {
|
|
203
|
+
/**
|
|
204
|
+
* Damping coefficient, controls attribute decay rate over time
|
|
205
|
+
*/
|
|
206
|
+
damping?: number;
|
|
207
|
+
/**
|
|
208
|
+
* Initial attribute value
|
|
209
|
+
*/
|
|
210
|
+
start: T;
|
|
211
|
+
/**
|
|
212
|
+
* Final attribute value, uses initial value if not specified
|
|
213
|
+
*/
|
|
214
|
+
end?: T;
|
|
215
|
+
/**
|
|
216
|
+
* Attribute change rate, automatically calculated from start and end if not specified
|
|
217
|
+
*/
|
|
218
|
+
delta?: T;
|
|
219
|
+
}
|
|
220
|
+
/**
|
|
221
|
+
* Particle system configuration options
|
|
222
|
+
*/
|
|
223
|
+
export interface IParticleOptions extends ITransformOptions, IShaderRenderOptions {
|
|
224
|
+
/**
|
|
225
|
+
* Particle texture, can be a single texture, array of textures, or weighted texture array
|
|
226
|
+
*/
|
|
227
|
+
texture: Texture | Texture[] | [Texture, number][];
|
|
228
|
+
/**
|
|
229
|
+
* Particle emission rate (particles per second)
|
|
230
|
+
*/
|
|
231
|
+
emitRate?: number;
|
|
232
|
+
/**
|
|
233
|
+
* Emission time interval in seconds
|
|
234
|
+
*/
|
|
235
|
+
emitTime?: number;
|
|
236
|
+
/**
|
|
237
|
+
* Maximum number of particles limit
|
|
238
|
+
*/
|
|
239
|
+
maxParticles?: number;
|
|
240
|
+
/**
|
|
241
|
+
* Particle lifetime in seconds, can be fixed value or range
|
|
242
|
+
*/
|
|
243
|
+
life?: number | [number, number];
|
|
244
|
+
/**
|
|
245
|
+
* Particle animation properties collection
|
|
246
|
+
*/
|
|
247
|
+
animation: {
|
|
248
|
+
/**
|
|
249
|
+
* Velocity vector, controls particle movement direction and speed
|
|
250
|
+
*/
|
|
251
|
+
velocity?: ParticleAttribute<Vec2>;
|
|
252
|
+
/**
|
|
253
|
+
* Acceleration vector, controls particle velocity changes
|
|
254
|
+
*/
|
|
255
|
+
acceleration?: ParticleAttribute<Vec2>;
|
|
256
|
+
/**
|
|
257
|
+
* Speed scalar, used in combination with rotation direction
|
|
258
|
+
*/
|
|
259
|
+
speed?: ParticleAttribute<number>;
|
|
260
|
+
/**
|
|
261
|
+
* Scale factor, controls particle size
|
|
262
|
+
*/
|
|
263
|
+
scale?: ParticleAttribute<number>;
|
|
264
|
+
/**
|
|
265
|
+
* Rotation angle (in radians)
|
|
266
|
+
*/
|
|
267
|
+
rotation?: ParticleAttribute<number>;
|
|
268
|
+
/**
|
|
269
|
+
* Color and transparency
|
|
270
|
+
*/
|
|
271
|
+
color?: ParticleAttribute<Color>;
|
|
272
|
+
};
|
|
273
|
+
/**
|
|
274
|
+
* Emitter shape
|
|
275
|
+
*/
|
|
276
|
+
emitShape?: ParticleShape;
|
|
277
|
+
/**
|
|
278
|
+
* Circular emitter radius
|
|
279
|
+
*/
|
|
280
|
+
emitRadius?: number;
|
|
281
|
+
/**
|
|
282
|
+
* Rectangular emitter dimensions
|
|
283
|
+
*/
|
|
284
|
+
emitRect?: {
|
|
285
|
+
width: number;
|
|
286
|
+
height: number;
|
|
287
|
+
};
|
|
288
|
+
/**
|
|
289
|
+
* Whether to use local coordinate system, true means particles are relative to emitter position,
|
|
290
|
+
* false means using global coordinates
|
|
291
|
+
*/
|
|
292
|
+
localSpace?: boolean;
|
|
293
|
+
}
|
|
294
|
+
/**
|
|
295
|
+
* Particle attribute data types
|
|
296
|
+
*/
|
|
297
|
+
export type ParticleAttributeTypes = number | Vec2 | Color;
|
|
298
|
+
/**
|
|
299
|
+
* Particle attribute runtime data
|
|
300
|
+
* @template T Attribute type
|
|
301
|
+
*/
|
|
302
|
+
export type ParticleAttributeData<T extends ParticleAttributeTypes> = {
|
|
303
|
+
/**
|
|
304
|
+
* Attribute change rate per second
|
|
305
|
+
*/
|
|
306
|
+
delta?: T;
|
|
307
|
+
/**
|
|
308
|
+
* Current attribute value
|
|
309
|
+
*/
|
|
310
|
+
value: T;
|
|
311
|
+
/**
|
|
312
|
+
* Damping coefficient
|
|
313
|
+
*/
|
|
314
|
+
damping?: number;
|
|
315
|
+
};
|