@soonspacejs/plugin-effect 2.13.17 → 2.14.0

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.
@@ -0,0 +1,378 @@
1
+ export default SPE;
2
+ export type distribution = number;
3
+ /**
4
+ * An SPE.Group instance.
5
+ */
6
+ export type Group = Object;
7
+ /**
8
+ * A map of options to configure an SPE.Group instance.
9
+ */
10
+ export type GroupOptions = {
11
+ /**
12
+ * An object describing the texture used by the group.
13
+ */
14
+ texture: {
15
+ value: Object;
16
+ frames?: Object | undefined;
17
+ frameCount?: number | undefined;
18
+ loop: number;
19
+ };
20
+ /**
21
+ * If no `dt` (or `deltaTime`) value is passed to this group's
22
+ * `tick()` function, this number will be used to move the particle
23
+ * simulation forward. Value in SECONDS.
24
+ */
25
+ fixedTimeStep: number;
26
+ /**
27
+ * Whether the distance a particle is from the camera should affect
28
+ * the particle's size.
29
+ */
30
+ hasPerspective: boolean;
31
+ /**
32
+ * Whether the particles in this group should be rendered with color, or
33
+ * whether the only color of particles will come from the provided texture.
34
+ */
35
+ colorize: boolean;
36
+ /**
37
+ * One of Three.js's blending modes to apply to this group's `ShaderMaterial`.
38
+ */
39
+ blending: number;
40
+ /**
41
+ * Whether these particle's should be rendered with transparency.
42
+ */
43
+ transparent: boolean;
44
+ /**
45
+ * Sets the alpha value to be used when running an alpha test on the `texture.value` property. Value between 0 and 1.
46
+ */
47
+ alphaTest: number;
48
+ /**
49
+ * Whether rendering the group has any effect on the depth buffer.
50
+ */
51
+ depthWrite: boolean;
52
+ /**
53
+ * Whether to have depth test enabled when rendering this group.
54
+ */
55
+ depthTest: boolean;
56
+ /**
57
+ * Whether this group's particles should be affected by their scene's fog.
58
+ */
59
+ fog: boolean;
60
+ /**
61
+ * The scale factor to apply to this group's particle sizes. Useful for
62
+ * setting particle sizes to be relative to renderer size.
63
+ */
64
+ scale: number;
65
+ };
66
+ /**
67
+ * An SPE.Emitter instance.
68
+ */
69
+ export type Emitter = Object;
70
+ /**
71
+ * A map of options to configure an SPE.Emitter instance.
72
+ */
73
+ export type EmitterOptions = {
74
+ /**
75
+ * The default distribution this emitter should use to control
76
+ * its particle's spawn position and force behaviour.
77
+ * Must be an SPE.distributions.* value.
78
+ */
79
+ type?: number | undefined;
80
+ /**
81
+ * The total number of particles this emitter will hold. NOTE: this is not the number
82
+ * of particles emitted in a second, or anything like that. The number of particles
83
+ * emitted per-second is calculated by particleCount / maxAge (approximately!)
84
+ */
85
+ particleCount?: number | undefined;
86
+ /**
87
+ * The duration in seconds that this emitter should live for. If not specified, the emitter
88
+ * will emit particles indefinitely.
89
+ * NOTE: When an emitter is older than a specified duration, the emitter is NOT removed from
90
+ * it's group, but rather is just marked as dead, allowing it to be reanimated at a later time
91
+ * using `SPE.Emitter.prototype.enable()`.
92
+ */
93
+ duration?: number | null | undefined;
94
+ /**
95
+ * Whether this emitter should be not be simulated (true).
96
+ */
97
+ isStatic?: boolean | undefined;
98
+ /**
99
+ * A value between 0 and 1 describing what percentage of this emitter's particlesPerSecond should be
100
+ * emitted, where 0 is 0%, and 1 is 100%.
101
+ * For example, having an emitter with 100 particles, a maxAge of 2, yields a particlesPerSecond
102
+ * value of 50. Setting `activeMultiplier` to 0.5, then, will only emit 25 particles per second (0.5 = 50%).
103
+ * Values greater than 1 will emulate a burst of particles, causing the emitter to run out of particles
104
+ * before it's next activation cycle.
105
+ */
106
+ activeMultiplier?: boolean | undefined;
107
+ /**
108
+ * The direction of the emitter. If value is `1`, emitter will start at beginning of particle's lifecycle.
109
+ * If value is `-1`, emitter will start at end of particle's lifecycle and work it's way backwards.
110
+ */
111
+ direction?: boolean | undefined;
112
+ /**
113
+ * An object describing the particle's maximum age in seconds.
114
+ */
115
+ maxAge?: {
116
+ /**
117
+ * A number between 0 and 1 describing the amount of maxAge to apply to all particles.
118
+ */
119
+ value?: number | undefined;
120
+ /**
121
+ * A number describing the maxAge variance on a per-particle basis.
122
+ */
123
+ spread?: number | undefined;
124
+ } | undefined;
125
+ /**
126
+ * An object describing this emitter's position.
127
+ */
128
+ position?: {
129
+ /**
130
+ * A THREE.Vector3 instance describing this emitter's base position.
131
+ */
132
+ value?: Object | undefined;
133
+ /**
134
+ * A THREE.Vector3 instance describing this emitter's position variance on a per-particle basis.
135
+ * Note that when using a SPHERE or DISC distribution, only the x-component
136
+ * of this vector is used.
137
+ * When using a LINE distribution, this value is the endpoint of the LINE.
138
+ */
139
+ spread?: Object | undefined;
140
+ /**
141
+ * A THREE.Vector3 instance describing the numeric multiples the particle's should
142
+ * be spread out over.
143
+ * Note that when using a SPHERE or DISC distribution, only the x-component
144
+ * of this vector is used.
145
+ * When using a LINE distribution, this property is ignored.
146
+ */
147
+ spreadClamp?: Object | undefined;
148
+ /**
149
+ * This emitter's base radius.
150
+ */
151
+ radius?: number | undefined;
152
+ /**
153
+ * A THREE.Vector3 instance describing the radius's scale in all three axes. Allows a SPHERE or DISC to be squashed or stretched.
154
+ */
155
+ radiusScale?: Object | undefined;
156
+ /**
157
+ * of the `type` option.] A specific distribution to use when radiusing particles. Overrides the `type` option.
158
+ */
159
+ distribution?: number | undefined;
160
+ /**
161
+ * When a particle is re-spawned, whether it's position should be re-randomised or not. Can incur a performance hit.
162
+ */
163
+ randomise?: boolean | undefined;
164
+ } | undefined;
165
+ /**
166
+ * An object describing this particle velocity.
167
+ */
168
+ velocity?: {
169
+ /**
170
+ * A THREE.Vector3 instance describing this emitter's base velocity.
171
+ */
172
+ value?: Object | undefined;
173
+ /**
174
+ * A THREE.Vector3 instance describing this emitter's velocity variance on a per-particle basis.
175
+ * Note that when using a SPHERE or DISC distribution, only the x-component
176
+ * of this vector is used.
177
+ */
178
+ spread?: Object | undefined;
179
+ /**
180
+ * of the `type` option.] A specific distribution to use when calculating a particle's velocity. Overrides the `type` option.
181
+ */
182
+ distribution?: number | undefined;
183
+ /**
184
+ * When a particle is re-spawned, whether it's velocity should be re-randomised or not. Can incur a performance hit.
185
+ */
186
+ randomise?: boolean | undefined;
187
+ } | undefined;
188
+ /**
189
+ * An object describing this particle's acceleration.
190
+ */
191
+ acceleration?: {
192
+ /**
193
+ * A THREE.Vector3 instance describing this emitter's base acceleration.
194
+ */
195
+ value?: Object | undefined;
196
+ /**
197
+ * A THREE.Vector3 instance describing this emitter's acceleration variance on a per-particle basis.
198
+ * Note that when using a SPHERE or DISC distribution, only the x-component
199
+ * of this vector is used.
200
+ */
201
+ spread?: Object | undefined;
202
+ /**
203
+ * of the `type` option.] A specific distribution to use when calculating a particle's acceleration. Overrides the `type` option.
204
+ */
205
+ distribution?: number | undefined;
206
+ /**
207
+ * When a particle is re-spawned, whether it's acceleration should be re-randomised or not. Can incur a performance hit.
208
+ */
209
+ randomise?: boolean | undefined;
210
+ } | undefined;
211
+ /**
212
+ * An object describing this particle drag. Drag is applied to both velocity and acceleration values.
213
+ */
214
+ drag?: {
215
+ /**
216
+ * A number between 0 and 1 describing the amount of drag to apply to all particles.
217
+ */
218
+ value?: number | undefined;
219
+ /**
220
+ * A number describing the drag variance on a per-particle basis.
221
+ */
222
+ spread?: number | undefined;
223
+ /**
224
+ * When a particle is re-spawned, whether it's drag should be re-randomised or not. Can incur a performance hit.
225
+ */
226
+ randomise?: boolean | undefined;
227
+ } | undefined;
228
+ /**
229
+ * This is quite a fun one! The values of this object will determine whether a particle will wiggle, or jiggle, or wave,
230
+ * or shimmy, or waggle, or... Well you get the idea. The wiggle is calculated over-time, meaning that a particle will
231
+ * start off with no wiggle, and end up wiggling about with the distance of the `value` specified by the time it dies.
232
+ * It's quite handy to simulate fire embers, or similar effects where the particle's position should slightly change over
233
+ * time, and such change isn't easily controlled by rotation, velocity, or acceleration. The wiggle is a combination of sin and cos calculations, so is circular in nature.
234
+ */
235
+ wiggle?: {
236
+ /**
237
+ * A number describing the amount of wiggle to apply to all particles. It's measured in distance.
238
+ */
239
+ value?: number | undefined;
240
+ /**
241
+ * A number describing the wiggle variance on a per-particle basis.
242
+ */
243
+ spread?: number | undefined;
244
+ } | undefined;
245
+ /**
246
+ * An object describing this emitter's rotation. It can either be static, or set to rotate from 0radians to the value of `rotation.value`
247
+ * over a particle's lifetime. Rotation values affect both a particle's position and the forces applied to it.
248
+ */
249
+ rotation?: {
250
+ /**
251
+ * A THREE.Vector3 instance describing this emitter's axis of rotation.
252
+ */
253
+ axis?: Object | undefined;
254
+ /**
255
+ * A THREE.Vector3 instance describing the amount of variance to apply to the axis of rotation on
256
+ * a per-particle basis.
257
+ */
258
+ axisSpread?: Object | undefined;
259
+ /**
260
+ * The angle of rotation, given in radians. If `rotation.static` is true, the emitter will start off rotated at this angle, and stay as such.
261
+ * Otherwise, the particles will rotate from 0radians to this value over their lifetimes.
262
+ */
263
+ angle?: number | undefined;
264
+ /**
265
+ * The amount of variance in each particle's rotation angle.
266
+ */
267
+ angleSpread?: number | undefined;
268
+ /**
269
+ * Whether the rotation should be static or not.
270
+ */
271
+ static?: boolean | undefined;
272
+ /**
273
+ * value of `position.value`] A THREE.Vector3 instance describing the center point of rotation.
274
+ */
275
+ center?: Object | undefined;
276
+ /**
277
+ * When a particle is re-spawned, whether it's rotation should be re-randomised or not. Can incur a performance hit.
278
+ */
279
+ randomise?: boolean | undefined;
280
+ } | undefined;
281
+ /**
282
+ * An object describing a particle's color. This property is a "value-over-lifetime" property, meaning an array of values and spreads can be
283
+ * given to describe specific value changes over a particle's lifetime.
284
+ * Depending on the value of SPE.valueOverLifetimeLength, if arrays of THREE.Color instances are given, then the array will be interpolated to
285
+ * have a length matching the value of SPE.valueOverLifetimeLength.
286
+ */
287
+ color?: {
288
+ /**
289
+ * Either a single THREE.Color instance, or an array of THREE.Color instances to describe the color of a particle over it's lifetime.
290
+ */
291
+ value?: Object | undefined;
292
+ /**
293
+ * Either a single THREE.Vector3 instance, or an array of THREE.Vector3 instances to describe the color variance of a particle over it's lifetime.
294
+ */
295
+ spread?: Object | undefined;
296
+ /**
297
+ * When a particle is re-spawned, whether it's color should be re-randomised or not. Can incur a performance hit.
298
+ */
299
+ randomise?: boolean | undefined;
300
+ } | undefined;
301
+ /**
302
+ * An object describing a particle's opacity. This property is a "value-over-lifetime" property, meaning an array of values and spreads can be
303
+ * given to describe specific value changes over a particle's lifetime.
304
+ * Depending on the value of SPE.valueOverLifetimeLength, if arrays of numbers are given, then the array will be interpolated to
305
+ * have a length matching the value of SPE.valueOverLifetimeLength.
306
+ */
307
+ opacity?: {
308
+ /**
309
+ * Either a single number, or an array of numbers to describe the opacity of a particle over it's lifetime.
310
+ */
311
+ value?: number | undefined;
312
+ /**
313
+ * Either a single number, or an array of numbers to describe the opacity variance of a particle over it's lifetime.
314
+ */
315
+ spread?: number | undefined;
316
+ /**
317
+ * When a particle is re-spawned, whether it's opacity should be re-randomised or not. Can incur a performance hit.
318
+ */
319
+ randomise?: boolean | undefined;
320
+ } | undefined;
321
+ /**
322
+ * An object describing a particle's size. This property is a "value-over-lifetime" property, meaning an array of values and spreads can be
323
+ * given to describe specific value changes over a particle's lifetime.
324
+ * Depending on the value of SPE.valueOverLifetimeLength, if arrays of numbers are given, then the array will be interpolated to
325
+ * have a length matching the value of SPE.valueOverLifetimeLength.
326
+ */
327
+ size?: {
328
+ /**
329
+ * Either a single number, or an array of numbers to describe the size of a particle over it's lifetime.
330
+ */
331
+ value?: number | undefined;
332
+ /**
333
+ * Either a single number, or an array of numbers to describe the size variance of a particle over it's lifetime.
334
+ */
335
+ spread?: number | undefined;
336
+ /**
337
+ * When a particle is re-spawned, whether it's size should be re-randomised or not. Can incur a performance hit.
338
+ */
339
+ randomise?: boolean | undefined;
340
+ } | undefined;
341
+ /**
342
+ * An object describing a particle's angle. The angle is a 2d-rotation, measured in radians, applied to the particle's texture.
343
+ * NOTE: if a particle's texture is a sprite-sheet, this value IS IGNORED.
344
+ * This property is a "value-over-lifetime" property, meaning an array of values and spreads can be
345
+ * given to describe specific value changes over a particle's lifetime.
346
+ * Depending on the value of SPE.valueOverLifetimeLength, if arrays of numbers are given, then the array will be interpolated to
347
+ * have a length matching the value of SPE.valueOverLifetimeLength.
348
+ */
349
+ angle?: {
350
+ /**
351
+ * Either a single number, or an array of numbers to describe the angle of a particle over it's lifetime.
352
+ */
353
+ value?: number | undefined;
354
+ /**
355
+ * Either a single number, or an array of numbers to describe the angle variance of a particle over it's lifetime.
356
+ */
357
+ spread?: number | undefined;
358
+ /**
359
+ * When a particle is re-spawned, whether it's angle should be re-randomised or not. Can incur a performance hit.
360
+ */
361
+ randomise?: boolean | undefined;
362
+ } | undefined;
363
+ };
364
+ /**
365
+ * @typedef {Number} distribution
366
+ * @property {Number} SPE.distributions.BOX Values will be distributed within a box.
367
+ * @property {Number} SPE.distributions.SPHERE Values will be distributed within a sphere.
368
+ * @property {Number} SPE.distributions.DISC Values will be distributed within a 2D disc.
369
+ */
370
+ /**
371
+ * Namespace for Shader Particle Engine.
372
+ *
373
+ * All SPE-related code sits under this namespace.
374
+ *
375
+ * @type {any}
376
+ * @namespace
377
+ */
378
+ declare var SPE: any;
@@ -0,0 +1,5 @@
1
+ export function getParticleSystem(params: any): {
2
+ points: THREE.Points<THREE.BufferGeometry<THREE.NormalBufferAttributes, THREE.BufferGeometryEventMap>, THREE.ShaderMaterial, THREE.Object3DEventMap>;
3
+ update: (timeElapsed: any) => void;
4
+ };
5
+ import * as THREE from 'three';
@@ -1,5 +1,4 @@
1
- import type { Texture, ColorRepresentation, ShaderMaterialParameters, Mesh } from 'three';
2
- import { Vector3 } from 'three';
1
+ import { Texture, ColorRepresentation, ShaderMaterialParameters, Mesh, Vector3 } from 'three';
3
2
  import { IVector3 } from 'soonspacejs';
4
3
  export interface WaterOptions extends ShaderMaterialParameters {
5
4
  /**
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@soonspacejs/plugin-effect",
3
3
  "pluginName": "EffectPlugin",
4
- "version": "2.13.17",
4
+ "version": "2.14.0",
5
5
  "description": "Effect plugin for SoonSpace.js",
6
6
  "main": "dist/index.esm.js",
7
7
  "module": "dist/index.esm.js",
@@ -17,8 +17,8 @@
17
17
  "@three3d/particle": "^1.0.4",
18
18
  "heatmap-ts": "^0.0.4"
19
19
  },
20
- "gitHead": "8afa5fda9a0ef2c080060e7d8e71a8bf168fd4d2",
20
+ "gitHead": "4c85e8b7b8ad24ccb9b42f3a1826bca377c42a6d",
21
21
  "peerDependencies": {
22
- "soonspacejs": "2.13.17"
22
+ "soonspacejs": "2.14.0"
23
23
  }
24
24
  }