melonjs 10.6.0 → 10.7.1
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/melonjs.js +37468 -36530
- package/dist/melonjs.min.js +21 -21
- package/dist/melonjs.module.d.ts +369 -164
- package/dist/melonjs.module.js +1750 -793
- package/package.json +10 -8
- package/src/game.js +5 -5
- package/src/geometries/rectangle.js +15 -0
- package/src/index.js +4 -4
- package/src/input/gamepad.js +12 -10
- package/src/input/keyboard.js +5 -3
- package/src/input/pointer.js +1 -1
- package/src/input/pointerevent.js +2 -3
- package/src/level/tiled/TMXUtils.js +1 -1
- package/src/loader/loader.js +1 -1
- package/src/math/matrix3.js +66 -65
- package/src/particles/emitter.js +119 -428
- package/src/particles/particle.js +51 -52
- package/src/particles/settings.js +310 -0
- package/src/polyfill/console.js +7 -7
- package/src/polyfill/index.js +7 -0
- package/src/polyfill/performance.js +20 -0
- package/src/polyfill/requestAnimationFrame.js +10 -10
- package/src/renderable/imagelayer.js +2 -2
- package/src/state/state.js +7 -7
- package/src/system/device.js +141 -128
- package/src/system/event.js +10 -10
- package/src/system/timer.js +1 -1
- package/src/text/bitmaptext.js +5 -5
- package/src/utils/agent.js +4 -4
- package/src/utils/function.js +2 -2
- package/src/utils/utils.js +10 -5
- package/src/video/canvas/canvas_renderer.js +15 -2
- package/src/video/renderer.js +2 -2
- package/src/video/video.js +11 -11
- package/src/video/webgl/glshader.js +1 -1
- package/src/video/webgl/webgl_renderer.js +6 -5
- package/src/particles/particlecontainer.js +0 -95
package/dist/melonjs.module.d.ts
CHANGED
|
@@ -1085,7 +1085,7 @@ export class CanvasRenderer extends Renderer {
|
|
|
1085
1085
|
* <img src="images/normal-blendmode.png" width="510"/> <br>
|
|
1086
1086
|
* - "multiply" : the pixels of the top layer are multiplied with the corresponding pixel of the bottom layer. A darker picture is the result. <br>
|
|
1087
1087
|
* <img src="images/multiply-blendmode.png" width="510"/> <br>
|
|
1088
|
-
* - "lighter" : where both content overlap the color is determined by adding color values. <br>
|
|
1088
|
+
* - "additive or lighter" : where both content overlap the color is determined by adding color values. <br>
|
|
1089
1089
|
* <img src="images/lighter-blendmode.png" width="510"/> <br>
|
|
1090
1090
|
* - "screen" : The pixels are inverted, multiplied, and inverted again. A lighter picture is the result (opposite of multiply) <br>
|
|
1091
1091
|
* <img src="images/screen-blendmode.png" width="510"/> <br>
|
|
@@ -1093,7 +1093,7 @@ export class CanvasRenderer extends Renderer {
|
|
|
1093
1093
|
* @see https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/globalCompositeOperation
|
|
1094
1094
|
* @memberof CanvasRenderer.prototype
|
|
1095
1095
|
* @function
|
|
1096
|
-
* @param {string} [mode="normal"] blend mode : "normal", "multiply", "lighter, "screen"
|
|
1096
|
+
* @param {string} [mode="normal"] blend mode : "normal", "multiply", "lighter, "additive", "screen"
|
|
1097
1097
|
* @param {CanvasRenderingContext2D} [context]
|
|
1098
1098
|
*/
|
|
1099
1099
|
setBlendMode(mode?: string, context?: CanvasRenderingContext2D): void;
|
|
@@ -4053,17 +4053,18 @@ export class ObservableVector3d extends Vector3d {
|
|
|
4053
4053
|
/**
|
|
4054
4054
|
* @classdesc
|
|
4055
4055
|
* Single Particle Object.
|
|
4056
|
-
* @class Particle
|
|
4057
4056
|
* @augments Renderable
|
|
4058
|
-
* @param {ParticleEmitter} particle emitter
|
|
4059
4057
|
*/
|
|
4060
4058
|
export class Particle extends Renderable {
|
|
4059
|
+
/**
|
|
4060
|
+
* @param {ParticleEmitter} emitter the particle emitter
|
|
4061
|
+
*/
|
|
4062
|
+
constructor(emitter: ParticleEmitter);
|
|
4061
4063
|
/**
|
|
4062
4064
|
* @ignore
|
|
4063
4065
|
*/
|
|
4064
|
-
constructor(emitter: any);
|
|
4065
|
-
vel: Vector2d;
|
|
4066
4066
|
onResetEvent(emitter: any, newInstance?: boolean): void;
|
|
4067
|
+
vel: Vector2d;
|
|
4067
4068
|
image: any;
|
|
4068
4069
|
life: any;
|
|
4069
4070
|
startLife: any;
|
|
@@ -4075,50 +4076,319 @@ export class Particle extends Renderable {
|
|
|
4075
4076
|
onlyInViewport: any;
|
|
4076
4077
|
_deltaInv: number;
|
|
4077
4078
|
angle: number;
|
|
4078
|
-
/**
|
|
4079
|
-
* @ignore
|
|
4080
|
-
*/
|
|
4081
|
-
preDraw(renderer: any): void;
|
|
4082
4079
|
/**
|
|
4083
4080
|
* @ignore
|
|
4084
4081
|
*/
|
|
4085
4082
|
draw(renderer: any): void;
|
|
4086
4083
|
}
|
|
4087
4084
|
/**
|
|
4085
|
+
* @classdesc
|
|
4088
4086
|
* Particle Emitter Object.
|
|
4089
|
-
* @
|
|
4090
|
-
* @augments Rect
|
|
4091
|
-
* @param {number} x x-position of the particle emitter
|
|
4092
|
-
* @param {number} y y-position of the particle emitter
|
|
4093
|
-
* @param {object} settings An object containing the settings for the particle emitter. See {@link ParticleEmitterSettings}
|
|
4094
|
-
* @example
|
|
4095
|
-
* // Create a basic emitter at position 100, 100
|
|
4096
|
-
* var emitter = new me.ParticleEmitter(100, 100);
|
|
4097
|
-
*
|
|
4098
|
-
* // Adjust the emitter properties
|
|
4099
|
-
* emitter.totalParticles = 200;
|
|
4100
|
-
* emitter.minLife = 1000;
|
|
4101
|
-
* emitter.maxLife = 3000;
|
|
4102
|
-
* emitter.z = 10;
|
|
4103
|
-
*
|
|
4104
|
-
* // Add the emitter to the game world
|
|
4105
|
-
* me.game.world.addChild(emitter);
|
|
4106
|
-
*
|
|
4107
|
-
* // Launch all particles one time and stop, like a explosion
|
|
4108
|
-
* emitter.burstParticles();
|
|
4109
|
-
*
|
|
4110
|
-
* // Launch constantly the particles, like a fountain
|
|
4111
|
-
* emitter.streamParticles();
|
|
4112
|
-
*
|
|
4113
|
-
* // At the end, remove emitter from the game world
|
|
4114
|
-
* // call this in onDestroyEvent function
|
|
4115
|
-
* me.game.world.removeChild(emitter);
|
|
4087
|
+
* @augments Container
|
|
4116
4088
|
*/
|
|
4117
|
-
export class ParticleEmitter extends
|
|
4089
|
+
export class ParticleEmitter extends Container {
|
|
4118
4090
|
/**
|
|
4119
|
-
* @
|
|
4091
|
+
* @param {number} x x position of the particle emitter
|
|
4092
|
+
* @param {number} y y position of the particle emitter
|
|
4093
|
+
* @param {ParticleEmitterSettings} [settings=ParticleEmitterSettings] the settings for the particle emitter.
|
|
4094
|
+
* @example
|
|
4095
|
+
* // Create a basic emitter at position 100, 100
|
|
4096
|
+
* var emitter = new ParticleEmitter(100, 100);
|
|
4097
|
+
*
|
|
4098
|
+
* // Adjust the emitter properties
|
|
4099
|
+
* emitter.totalParticles = 200;
|
|
4100
|
+
* emitter.minLife = 1000;
|
|
4101
|
+
* emitter.maxLife = 3000;
|
|
4102
|
+
* emitter.z = 10;
|
|
4103
|
+
*
|
|
4104
|
+
* // Add the emitter to the game world
|
|
4105
|
+
* me.game.world.addChild(emitter);
|
|
4106
|
+
*
|
|
4107
|
+
* // Launch all particles one time and stop, like a explosion
|
|
4108
|
+
* emitter.burstParticles();
|
|
4109
|
+
*
|
|
4110
|
+
* // Launch constantly the particles, like a fountain
|
|
4111
|
+
* emitter.streamParticles();
|
|
4112
|
+
*
|
|
4113
|
+
* // At the end, remove emitter from the game world
|
|
4114
|
+
* // call this in onDestroyEvent function
|
|
4115
|
+
* me.game.world.removeChild(emitter);
|
|
4120
4116
|
*/
|
|
4121
|
-
constructor(x:
|
|
4117
|
+
constructor(x: number, y: number, settings?: {
|
|
4118
|
+
/**
|
|
4119
|
+
* Width of the particle spawn area.
|
|
4120
|
+
* @type {number}
|
|
4121
|
+
* @name width
|
|
4122
|
+
* @memberof ParticleEmitterSettings
|
|
4123
|
+
* @default 1
|
|
4124
|
+
*/
|
|
4125
|
+
width: number;
|
|
4126
|
+
/**
|
|
4127
|
+
* Height of the particle spawn area
|
|
4128
|
+
* @public
|
|
4129
|
+
* @type {number}
|
|
4130
|
+
* @name height
|
|
4131
|
+
* @memberof ParticleEmitterSettings
|
|
4132
|
+
* @default 1
|
|
4133
|
+
*/
|
|
4134
|
+
height: number;
|
|
4135
|
+
/**
|
|
4136
|
+
* image used for particles texture
|
|
4137
|
+
* (by default melonJS will create an white 8x8 texture image)
|
|
4138
|
+
* @public
|
|
4139
|
+
* @type {HTMLCanvasElement}
|
|
4140
|
+
* @name image
|
|
4141
|
+
* @memberof ParticleEmitterSettings
|
|
4142
|
+
* @default undefined
|
|
4143
|
+
* @see ParticleEmitterSettings.textureSize
|
|
4144
|
+
*/
|
|
4145
|
+
image: HTMLCanvasElement;
|
|
4146
|
+
/**
|
|
4147
|
+
* default texture size used for particles if no image is specified
|
|
4148
|
+
* (by default melonJS will create an white 8x8 texture image)
|
|
4149
|
+
* @public
|
|
4150
|
+
* @type {number}
|
|
4151
|
+
* @name textureSize
|
|
4152
|
+
* @memberof ParticleEmitterSettings
|
|
4153
|
+
* @default 8
|
|
4154
|
+
* @see ParticleEmitterSettings.image
|
|
4155
|
+
*/
|
|
4156
|
+
textureSize: number;
|
|
4157
|
+
/**
|
|
4158
|
+
* tint to be applied to particles
|
|
4159
|
+
* @public
|
|
4160
|
+
* @type {string}
|
|
4161
|
+
* @name tint
|
|
4162
|
+
* @memberof ParticleEmitterSettings
|
|
4163
|
+
* @default "#fff"
|
|
4164
|
+
*/
|
|
4165
|
+
tint: string;
|
|
4166
|
+
/**
|
|
4167
|
+
* Total number of particles in the emitter
|
|
4168
|
+
* @public
|
|
4169
|
+
* @type {number}
|
|
4170
|
+
* @name totalParticles
|
|
4171
|
+
* @default 50
|
|
4172
|
+
* @memberof ParticleEmitterSettings
|
|
4173
|
+
*/
|
|
4174
|
+
totalParticles: number;
|
|
4175
|
+
/**
|
|
4176
|
+
* Start angle for particle launch in Radians
|
|
4177
|
+
* @public
|
|
4178
|
+
* @type {number}
|
|
4179
|
+
* @name angle
|
|
4180
|
+
* @default Math.PI / 2
|
|
4181
|
+
* @memberof ParticleEmitterSettings
|
|
4182
|
+
*/
|
|
4183
|
+
angle: number;
|
|
4184
|
+
/**
|
|
4185
|
+
* Variation in the start angle for particle launch in Radians.
|
|
4186
|
+
* @public
|
|
4187
|
+
* @type {number}
|
|
4188
|
+
* @name angleVariation
|
|
4189
|
+
* @default 0
|
|
4190
|
+
* @memberof ParticleEmitterSettings
|
|
4191
|
+
*/
|
|
4192
|
+
angleVariation: number;
|
|
4193
|
+
/**
|
|
4194
|
+
* Minimum time each particle lives once it is emitted in ms.
|
|
4195
|
+
* @public
|
|
4196
|
+
* @type {number}
|
|
4197
|
+
* @name minLife
|
|
4198
|
+
* @default 1000
|
|
4199
|
+
* @memberof ParticleEmitterSettings
|
|
4200
|
+
*/
|
|
4201
|
+
minLife: number;
|
|
4202
|
+
/**
|
|
4203
|
+
* Maximum time each particle lives once it is emitted in ms.
|
|
4204
|
+
* @public
|
|
4205
|
+
* @type {number}
|
|
4206
|
+
* @name maxLife
|
|
4207
|
+
* @default 3000
|
|
4208
|
+
* @memberof ParticleEmitterSettings
|
|
4209
|
+
*/
|
|
4210
|
+
maxLife: number;
|
|
4211
|
+
/**
|
|
4212
|
+
* Start speed of particles.<br>
|
|
4213
|
+
* @public
|
|
4214
|
+
* @type {number}
|
|
4215
|
+
* @name speed
|
|
4216
|
+
* @default 2
|
|
4217
|
+
* @memberof ParticleEmitterSettings
|
|
4218
|
+
*/
|
|
4219
|
+
speed: number;
|
|
4220
|
+
/**
|
|
4221
|
+
* Variation in the start speed of particles
|
|
4222
|
+
* @public
|
|
4223
|
+
* @type {number}
|
|
4224
|
+
* @name speedVariation
|
|
4225
|
+
* @default 1
|
|
4226
|
+
* @memberof ParticleEmitterSettings
|
|
4227
|
+
*/
|
|
4228
|
+
speedVariation: number;
|
|
4229
|
+
/**
|
|
4230
|
+
* Minimum start rotation for particles sprites in Radians
|
|
4231
|
+
* @public
|
|
4232
|
+
* @type {number}
|
|
4233
|
+
* @name minRotation
|
|
4234
|
+
* @default 0
|
|
4235
|
+
* @memberof ParticleEmitterSettings
|
|
4236
|
+
*/
|
|
4237
|
+
minRotation: number;
|
|
4238
|
+
/**
|
|
4239
|
+
* Maximum start rotation for particles sprites in Radians
|
|
4240
|
+
* @public
|
|
4241
|
+
* @type {number}
|
|
4242
|
+
* @name maxRotation
|
|
4243
|
+
* @default 0
|
|
4244
|
+
* @memberof ParticleEmitterSettings
|
|
4245
|
+
*/
|
|
4246
|
+
maxRotation: number;
|
|
4247
|
+
/**
|
|
4248
|
+
* Minimum start scale ratio for particles (1 = no scaling)
|
|
4249
|
+
* @public
|
|
4250
|
+
* @type {number}
|
|
4251
|
+
* @name minStartScale
|
|
4252
|
+
* @default 1
|
|
4253
|
+
* @memberof ParticleEmitterSettings
|
|
4254
|
+
*/
|
|
4255
|
+
minStartScale: number;
|
|
4256
|
+
/**
|
|
4257
|
+
* Maximum start scale ratio for particles (1 = no scaling)
|
|
4258
|
+
* @public
|
|
4259
|
+
* @type {number}
|
|
4260
|
+
* @name maxStartScale
|
|
4261
|
+
* @default 1
|
|
4262
|
+
* @memberof ParticleEmitterSettings
|
|
4263
|
+
*/
|
|
4264
|
+
maxStartScale: number;
|
|
4265
|
+
/**
|
|
4266
|
+
* Minimum end scale ratio for particles
|
|
4267
|
+
* @public
|
|
4268
|
+
* @type {number}
|
|
4269
|
+
* @name minEndScale
|
|
4270
|
+
* @default 0
|
|
4271
|
+
* @memberof ParticleEmitterSettings
|
|
4272
|
+
*/
|
|
4273
|
+
minEndScale: number;
|
|
4274
|
+
/**
|
|
4275
|
+
* Maximum end scale ratio for particles
|
|
4276
|
+
* @public
|
|
4277
|
+
* @type {number}
|
|
4278
|
+
* @name maxEndScale
|
|
4279
|
+
* @default 0
|
|
4280
|
+
* @memberof ParticleEmitterSettings
|
|
4281
|
+
*/
|
|
4282
|
+
maxEndScale: number;
|
|
4283
|
+
/**
|
|
4284
|
+
* Vertical force (Gravity) for each particle
|
|
4285
|
+
* @public
|
|
4286
|
+
* @type {number}
|
|
4287
|
+
* @name gravity
|
|
4288
|
+
* @default 0
|
|
4289
|
+
* @memberof ParticleEmitterSettings
|
|
4290
|
+
* @see game.world.gravity
|
|
4291
|
+
*/
|
|
4292
|
+
gravity: number;
|
|
4293
|
+
/**
|
|
4294
|
+
* Horizontal force (like a Wind) for each particle
|
|
4295
|
+
* @public
|
|
4296
|
+
* @type {number}
|
|
4297
|
+
* @name wind
|
|
4298
|
+
* @default 0
|
|
4299
|
+
* @memberof ParticleEmitterSettings
|
|
4300
|
+
*/
|
|
4301
|
+
wind: number;
|
|
4302
|
+
/**
|
|
4303
|
+
* Update the rotation of particle in accordance the particle trajectory.<br>
|
|
4304
|
+
* The particle sprite should aim at zero angle (draw from left to right).<br>
|
|
4305
|
+
* Override the particle minRotation and maxRotation.<br>
|
|
4306
|
+
* @public
|
|
4307
|
+
* @type {boolean}
|
|
4308
|
+
* @name followTrajectory
|
|
4309
|
+
* @default false
|
|
4310
|
+
* @memberof ParticleEmitterSettings
|
|
4311
|
+
*/
|
|
4312
|
+
followTrajectory: boolean;
|
|
4313
|
+
/**
|
|
4314
|
+
* Enable the Texture Additive by composite operation ("additive" blendMode)
|
|
4315
|
+
* @public
|
|
4316
|
+
* @type {boolean}
|
|
4317
|
+
* @name textureAdditive
|
|
4318
|
+
* @default false
|
|
4319
|
+
* @memberof ParticleEmitterSettings
|
|
4320
|
+
* @see ParticleEmitterSettings.blendMode
|
|
4321
|
+
*/
|
|
4322
|
+
textureAdditive: boolean;
|
|
4323
|
+
/**
|
|
4324
|
+
* the blend mode to be applied when rendering particles.
|
|
4325
|
+
* (note: this will superseed the `textureAdditive` setting if different than "normal")
|
|
4326
|
+
* @public
|
|
4327
|
+
* @type {string}
|
|
4328
|
+
* @name blendMode
|
|
4329
|
+
* @default normal
|
|
4330
|
+
* @memberof ParticleEmitterSettings
|
|
4331
|
+
* @see CanvasRenderer#setBlendMode
|
|
4332
|
+
* @see WebGLRenderer#setBlendMode
|
|
4333
|
+
*/
|
|
4334
|
+
blendMode: string;
|
|
4335
|
+
/**
|
|
4336
|
+
* Update particles only in the viewport, remove it when out of viewport.
|
|
4337
|
+
* @public
|
|
4338
|
+
* @type {boolean}
|
|
4339
|
+
* @name onlyInViewport
|
|
4340
|
+
* @default true
|
|
4341
|
+
* @memberof ParticleEmitterSettings
|
|
4342
|
+
*/
|
|
4343
|
+
onlyInViewport: boolean;
|
|
4344
|
+
/**
|
|
4345
|
+
* Render particles in screen space.
|
|
4346
|
+
* @public
|
|
4347
|
+
* @type {boolean}
|
|
4348
|
+
* @name floating
|
|
4349
|
+
* @default false
|
|
4350
|
+
* @memberof ParticleEmitterSettings
|
|
4351
|
+
*/
|
|
4352
|
+
floating: boolean;
|
|
4353
|
+
/**
|
|
4354
|
+
* Maximum number of particles launched each time in this emitter (used only if emitter is Stream).
|
|
4355
|
+
* @public
|
|
4356
|
+
* @type {number}
|
|
4357
|
+
* @name maxParticles
|
|
4358
|
+
* @default 10
|
|
4359
|
+
* @memberof ParticleEmitterSettings
|
|
4360
|
+
*/
|
|
4361
|
+
maxParticles: number;
|
|
4362
|
+
/**
|
|
4363
|
+
* How often a particle is emitted in ms (used only if emitter is a Stream).
|
|
4364
|
+
* @public
|
|
4365
|
+
* @type {number}
|
|
4366
|
+
* @name frequency
|
|
4367
|
+
* @default 100
|
|
4368
|
+
* @memberof ParticleEmitterSettings
|
|
4369
|
+
*/
|
|
4370
|
+
frequency: number;
|
|
4371
|
+
/**
|
|
4372
|
+
* Duration that the emitter releases particles in ms (used only if emitter is Stream).
|
|
4373
|
+
* After this period, the emitter stop the launch of particles.
|
|
4374
|
+
* @public
|
|
4375
|
+
* @type {number}
|
|
4376
|
+
* @name duration
|
|
4377
|
+
* @default Infinity
|
|
4378
|
+
* @memberof ParticleEmitterSettings
|
|
4379
|
+
*/
|
|
4380
|
+
duration: number;
|
|
4381
|
+
/**
|
|
4382
|
+
* Skip n frames after updating the particle system once.
|
|
4383
|
+
* This can be used to reduce the performance impact of emitters with many particles.
|
|
4384
|
+
* @public
|
|
4385
|
+
* @type {number}
|
|
4386
|
+
* @name framesToSkip
|
|
4387
|
+
* @default 0
|
|
4388
|
+
* @memberof ParticleEmitterSettings
|
|
4389
|
+
*/
|
|
4390
|
+
framesToSkip: number;
|
|
4391
|
+
});
|
|
4122
4392
|
/** @ignore */
|
|
4123
4393
|
_stream: boolean;
|
|
4124
4394
|
/** @ignore */
|
|
@@ -4127,95 +4397,43 @@ export class ParticleEmitter extends Rect {
|
|
|
4127
4397
|
_durationTimer: number;
|
|
4128
4398
|
/** @ignore */
|
|
4129
4399
|
_enabled: boolean;
|
|
4130
|
-
|
|
4131
|
-
|
|
4132
|
-
|
|
4133
|
-
/**
|
|
4134
|
-
* @ignore
|
|
4135
|
-
*/
|
|
4136
|
-
set z(arg: number);
|
|
4137
|
-
/**
|
|
4138
|
-
* @ignore
|
|
4139
|
-
*/
|
|
4140
|
-
get z(): number;
|
|
4141
|
-
set floating(arg: boolean);
|
|
4142
|
-
/**
|
|
4143
|
-
* Floating property for particles, value is forwarded to the particle container <br>
|
|
4144
|
-
* @type {boolean}
|
|
4145
|
-
* @name floating
|
|
4146
|
-
* @memberof ParticleEmitter
|
|
4147
|
-
*/
|
|
4148
|
-
get floating(): boolean;
|
|
4149
|
-
/**
|
|
4150
|
-
* @ignore
|
|
4151
|
-
*/
|
|
4152
|
-
onActivateEvent(): void;
|
|
4153
|
-
/**
|
|
4154
|
-
* @ignore
|
|
4155
|
-
*/
|
|
4156
|
-
onDeactivateEvent(): void;
|
|
4400
|
+
_updateCount: number;
|
|
4401
|
+
settings: {};
|
|
4402
|
+
_dt: number;
|
|
4157
4403
|
/**
|
|
4158
|
-
*
|
|
4404
|
+
* Reset the emitter with particle emitter settings.
|
|
4405
|
+
* @param {object} settings [optional] object with emitter settings. See {@link ParticleEmitterSettings}
|
|
4159
4406
|
*/
|
|
4160
|
-
|
|
4407
|
+
reset(settings?: object): void;
|
|
4161
4408
|
/**
|
|
4162
|
-
* returns a random point
|
|
4163
|
-
* @name getRandomPointX
|
|
4164
|
-
* @memberof ParticleEmitter
|
|
4165
|
-
* @function
|
|
4409
|
+
* returns a random point on the x axis within the bounds of this emitter
|
|
4166
4410
|
* @returns {number}
|
|
4167
4411
|
*/
|
|
4168
4412
|
getRandomPointX(): number;
|
|
4169
4413
|
/**
|
|
4170
|
-
* returns a random point
|
|
4171
|
-
* @name getRandomPointY
|
|
4172
|
-
* @memberof ParticleEmitter
|
|
4173
|
-
* @function
|
|
4414
|
+
* returns a random point on the y axis within the bounds this emitter
|
|
4174
4415
|
* @returns {number}
|
|
4175
4416
|
*/
|
|
4176
4417
|
getRandomPointY(): number;
|
|
4177
|
-
/**
|
|
4178
|
-
* Reset the emitter with default values.<br>
|
|
4179
|
-
* @function
|
|
4180
|
-
* @param {object} settings [optional] object with emitter settings. See {@link ParticleEmitterSettings}
|
|
4181
|
-
* @name reset
|
|
4182
|
-
* @memberof ParticleEmitter
|
|
4183
|
-
*/
|
|
4184
|
-
reset(settings: object): void;
|
|
4185
4418
|
/** @ignore */
|
|
4186
4419
|
addParticles(count: any): void;
|
|
4187
4420
|
/**
|
|
4188
|
-
* Emitter is of type stream and is launching particles
|
|
4189
|
-
* @function
|
|
4421
|
+
* Emitter is of type stream and is launching particles
|
|
4190
4422
|
* @returns {boolean} Emitter is Stream and is launching particles
|
|
4191
|
-
* @name isRunning
|
|
4192
|
-
* @memberof ParticleEmitter
|
|
4193
4423
|
*/
|
|
4194
4424
|
isRunning(): boolean;
|
|
4195
4425
|
/**
|
|
4196
|
-
* Launch particles from emitter constantly
|
|
4197
|
-
* Particles example: Fountains
|
|
4426
|
+
* Launch particles from emitter constantly (e.g. for stream)
|
|
4198
4427
|
* @param {number} duration [optional] time that the emitter releases particles in ms
|
|
4199
|
-
* @function
|
|
4200
|
-
* @name streamParticles
|
|
4201
|
-
* @memberof ParticleEmitter
|
|
4202
4428
|
*/
|
|
4203
4429
|
streamParticles(duration: number): void;
|
|
4204
|
-
frequency: any;
|
|
4205
4430
|
/**
|
|
4206
|
-
* Stop the emitter from generating new particles (used only if emitter is Stream)
|
|
4207
|
-
* @function
|
|
4208
|
-
* @name stopStream
|
|
4209
|
-
* @memberof ParticleEmitter
|
|
4431
|
+
* Stop the emitter from generating new particles (used only if emitter is Stream)
|
|
4210
4432
|
*/
|
|
4211
4433
|
stopStream(): void;
|
|
4212
4434
|
/**
|
|
4213
|
-
* Launch all particles from emitter and stop
|
|
4214
|
-
* Particles example: Explosions <br>
|
|
4435
|
+
* Launch all particles from emitter and stop (e.g. for explosion)
|
|
4215
4436
|
* @param {number} total [optional] number of particles to launch
|
|
4216
|
-
* @function
|
|
4217
|
-
* @name burstParticles
|
|
4218
|
-
* @memberof ParticleEmitter
|
|
4219
4437
|
*/
|
|
4220
4438
|
burstParticles(total: number): void;
|
|
4221
4439
|
/**
|
|
@@ -4224,32 +4442,35 @@ export class ParticleEmitter extends Rect {
|
|
|
4224
4442
|
update(dt: any): boolean;
|
|
4225
4443
|
}
|
|
4226
4444
|
export namespace ParticleEmitterSettings {
|
|
4227
|
-
|
|
4228
|
-
|
|
4229
|
-
|
|
4230
|
-
|
|
4231
|
-
|
|
4232
|
-
|
|
4233
|
-
|
|
4234
|
-
|
|
4235
|
-
|
|
4236
|
-
|
|
4237
|
-
|
|
4238
|
-
|
|
4239
|
-
|
|
4240
|
-
|
|
4241
|
-
|
|
4242
|
-
|
|
4243
|
-
|
|
4244
|
-
|
|
4245
|
-
|
|
4246
|
-
|
|
4247
|
-
|
|
4248
|
-
|
|
4249
|
-
|
|
4250
|
-
|
|
4251
|
-
|
|
4252
|
-
|
|
4445
|
+
const width: number;
|
|
4446
|
+
const height: number;
|
|
4447
|
+
const image: HTMLCanvasElement;
|
|
4448
|
+
const textureSize: number;
|
|
4449
|
+
const tint: string;
|
|
4450
|
+
const totalParticles: number;
|
|
4451
|
+
const angle: number;
|
|
4452
|
+
const angleVariation: number;
|
|
4453
|
+
const minLife: number;
|
|
4454
|
+
const maxLife: number;
|
|
4455
|
+
const speed: number;
|
|
4456
|
+
const speedVariation: number;
|
|
4457
|
+
const minRotation: number;
|
|
4458
|
+
const maxRotation: number;
|
|
4459
|
+
const minStartScale: number;
|
|
4460
|
+
const maxStartScale: number;
|
|
4461
|
+
const minEndScale: number;
|
|
4462
|
+
const maxEndScale: number;
|
|
4463
|
+
const gravity: number;
|
|
4464
|
+
const wind: number;
|
|
4465
|
+
const followTrajectory: boolean;
|
|
4466
|
+
const textureAdditive: boolean;
|
|
4467
|
+
const blendMode: string;
|
|
4468
|
+
const onlyInViewport: boolean;
|
|
4469
|
+
const floating: boolean;
|
|
4470
|
+
const maxParticles: number;
|
|
4471
|
+
const frequency: number;
|
|
4472
|
+
const duration: number;
|
|
4473
|
+
const framesToSkip: number;
|
|
4253
4474
|
}
|
|
4254
4475
|
/**
|
|
4255
4476
|
* @classdesc
|
|
@@ -4943,6 +5164,16 @@ export class Rect extends Polygon {
|
|
|
4943
5164
|
* @memberof Rect
|
|
4944
5165
|
*/
|
|
4945
5166
|
public get centerY(): number;
|
|
5167
|
+
/**
|
|
5168
|
+
* center the rectangle position around the given coordinates
|
|
5169
|
+
* @name centerOn
|
|
5170
|
+
* @memberof Rect.prototype
|
|
5171
|
+
* @function
|
|
5172
|
+
* @param {number} x the x coordinate around which to center this rectangle
|
|
5173
|
+
* @param {number} x the y coordinate around which to center this rectangle
|
|
5174
|
+
* @returns {Rect} this rectangle
|
|
5175
|
+
*/
|
|
5176
|
+
centerOn(x: number, y: any): Rect;
|
|
4946
5177
|
/**
|
|
4947
5178
|
* resize the rectangle
|
|
4948
5179
|
* @name resize
|
|
@@ -8791,7 +9022,7 @@ export class WebGLRenderer extends Renderer {
|
|
|
8791
9022
|
* <img src="images/normal-blendmode.png" width="510"/> <br>
|
|
8792
9023
|
* - "multiply" : the pixels of the top layer are multiplied with the corresponding pixel of the bottom layer. A darker picture is the result. <br>
|
|
8793
9024
|
* <img src="images/multiply-blendmode.png" width="510"/> <br>
|
|
8794
|
-
* - "lighter" : where both content overlap the color is determined by adding color values. <br>
|
|
9025
|
+
* - "additive or lighter" : where both content overlap the color is determined by adding color values. <br>
|
|
8795
9026
|
* <img src="images/lighter-blendmode.png" width="510"/> <br>
|
|
8796
9027
|
* - "screen" : The pixels are inverted, multiplied, and inverted again. A lighter picture is the result (opposite of multiply) <br>
|
|
8797
9028
|
* <img src="images/screen-blendmode.png" width="510"/> <br>
|
|
@@ -8799,7 +9030,7 @@ export class WebGLRenderer extends Renderer {
|
|
|
8799
9030
|
* @see https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/globalCompositeOperation
|
|
8800
9031
|
* @memberof WebGLRenderer.prototype
|
|
8801
9032
|
* @function
|
|
8802
|
-
* @param {string} [mode="normal"] blend mode : "normal", "multiply", "lighter", "screen"
|
|
9033
|
+
* @param {string} [mode="normal"] blend mode : "normal", "multiply", "lighter", "additive", "screen"
|
|
8803
9034
|
* @param {WebGLRenderingContext} [gl]
|
|
8804
9035
|
*/
|
|
8805
9036
|
setBlendMode(mode?: string, gl?: WebGLRenderingContext): void;
|
|
@@ -9158,7 +9389,7 @@ declare namespace device$1 {
|
|
|
9158
9389
|
namespace turnOnPointerLock { }
|
|
9159
9390
|
namespace turnOffPointerLock { }
|
|
9160
9391
|
}
|
|
9161
|
-
|
|
9392
|
+
declare var event$1: Readonly<{
|
|
9162
9393
|
__proto__: any;
|
|
9163
9394
|
BOOT: string;
|
|
9164
9395
|
STATE_PAUSE: string;
|
|
@@ -9191,8 +9422,8 @@ export var event: Readonly<{
|
|
|
9191
9422
|
WINDOW_ONORIENTATION_CHANGE: string;
|
|
9192
9423
|
WINDOW_ONSCROLL: string;
|
|
9193
9424
|
VIEWPORT_ONCHANGE: string;
|
|
9194
|
-
|
|
9195
|
-
|
|
9425
|
+
ONCONTEXT_LOST: string;
|
|
9426
|
+
ONCONTEXT_RESTORED: string;
|
|
9196
9427
|
emit: typeof emit;
|
|
9197
9428
|
on: typeof on;
|
|
9198
9429
|
once: typeof once;
|
|
@@ -11257,31 +11488,6 @@ declare function round(num: number, dec?: number): number;
|
|
|
11257
11488
|
* }
|
|
11258
11489
|
*/
|
|
11259
11490
|
declare function toBeCloseTo(expected: number, actual: number, precision?: number): boolean;
|
|
11260
|
-
/**
|
|
11261
|
-
* @classdesc
|
|
11262
|
-
* Particle Container Object.
|
|
11263
|
-
* @class ParticleContainer
|
|
11264
|
-
* @augments Container
|
|
11265
|
-
* @param {ParticleEmitter} emitter the emitter which owns this container
|
|
11266
|
-
*/
|
|
11267
|
-
declare class ParticleContainer extends Container {
|
|
11268
|
-
/**
|
|
11269
|
-
* @ignore
|
|
11270
|
-
*/
|
|
11271
|
-
constructor(emitter: any);
|
|
11272
|
-
_updateCount: number;
|
|
11273
|
-
_dt: number;
|
|
11274
|
-
_emitter: any;
|
|
11275
|
-
/**
|
|
11276
|
-
* @ignore
|
|
11277
|
-
*/
|
|
11278
|
-
update(dt: any): boolean;
|
|
11279
|
-
/**
|
|
11280
|
-
* @ignore
|
|
11281
|
-
*/
|
|
11282
|
-
draw(renderer: any, rect: any): void;
|
|
11283
|
-
}
|
|
11284
|
-
declare var pixel: HTMLCanvasElement | OffscreenCanvas;
|
|
11285
11491
|
/**
|
|
11286
11492
|
* @classdesc
|
|
11287
11493
|
* a Vertex Buffer object
|
|
@@ -11825,7 +12031,6 @@ declare function releaseAllPointerEvents(region: Rect | Polygon | Line | Ellipse
|
|
|
11825
12031
|
* @memberof input
|
|
11826
12032
|
* @public
|
|
11827
12033
|
* @function
|
|
11828
|
-
* @param {Function} [success] callback if the request is successful
|
|
11829
12034
|
* @returns {boolean} return true if the request was successfully submitted
|
|
11830
12035
|
* @example
|
|
11831
12036
|
* // register on the pointer lock change event
|
|
@@ -12217,7 +12422,7 @@ declare function scale(x: number, y: number): void;
|
|
|
12217
12422
|
* @name prefixed
|
|
12218
12423
|
* @function
|
|
12219
12424
|
* @param {string} name Property name
|
|
12220
|
-
* @param {object} [obj=
|
|
12425
|
+
* @param {object} [obj=globalThis] Object or element reference to access
|
|
12221
12426
|
* @returns {string} Value of property
|
|
12222
12427
|
* @memberof utils.agent
|
|
12223
12428
|
*/
|
|
@@ -12229,7 +12434,7 @@ declare function prefixed(name: string, obj?: object): string;
|
|
|
12229
12434
|
* @function
|
|
12230
12435
|
* @param {string} name Property name
|
|
12231
12436
|
* @param {string} value Property value
|
|
12232
|
-
* @param {object} [obj=
|
|
12437
|
+
* @param {object} [obj=globalThis] Object or element reference to access
|
|
12233
12438
|
* @returns {boolean} true if one of the vendor-prefixed property was found
|
|
12234
12439
|
* @memberof utils.agent
|
|
12235
12440
|
*/
|
|
@@ -12394,4 +12599,4 @@ declare function defer(func: Function, thisArg: object, ...args: any[]): number;
|
|
|
12394
12599
|
* @returns {Function} the function that will be throttled
|
|
12395
12600
|
*/
|
|
12396
12601
|
declare function throttle(fn: Function, delay: number, no_trailing: any): Function;
|
|
12397
|
-
export { Bounds$1 as Bounds, math as Math, device$1 as device, pooling as pool, timer$1 as timer };
|
|
12602
|
+
export { Bounds$1 as Bounds, math as Math, device$1 as device, event$1 as event, pooling as pool, timer$1 as timer };
|