* @ignore
(dt: number)
| 276 | * @ignore |
| 277 | */ |
| 278 | override update(dt: number): boolean { |
| 279 | // frame-skip: only do the bookkeeping when actually configured. |
| 280 | // Defaults to 0 (every frame), and that path is the hot one. |
| 281 | if (this.settings.framesToSkip > 0) { |
| 282 | if (++this._updateCount > this.settings.framesToSkip) { |
| 283 | this._updateCount = 0; |
| 284 | } |
| 285 | if (this._updateCount > 0) { |
| 286 | this._dt += dt; |
| 287 | return this.isDirty; |
| 288 | } |
| 289 | dt += this._dt; |
| 290 | this._dt = 0; |
| 291 | } |
| 292 | |
| 293 | // Update particles. `super.update(dt)` walks every child |
| 294 | // (each Particle) through Container.update — visibility check, |
| 295 | // per-particle `update(dt)`, etc. CRITICAL: assign it to a |
| 296 | // local first, then OR into `this.isDirty`. Writing this as |
| 297 | // `this.isDirty = this.isDirty || super.update(dt)` would |
| 298 | // short-circuit when `isDirty` is already true (very common), |
| 299 | // silently skipping the whole child walk — particles would |
| 300 | // keep `inViewport = false` and never draw. |
| 301 | const childrenDirty = super.update(dt); |
| 302 | this.isDirty = this.isDirty || childrenDirty; |
| 303 | |
| 304 | // Launch new particles, if emitter is Stream |
| 305 | if (this._enabled && this._stream) { |
| 306 | // Check if the emitter has duration set |
| 307 | if (this._durationTimer !== Infinity) { |
| 308 | this._durationTimer -= dt; |
| 309 | |
| 310 | if (this._durationTimer <= 0) { |
| 311 | this.stopStream(); |
| 312 | return this.isDirty; |
| 313 | } |
| 314 | } |
| 315 | |
| 316 | // Increase the emitter launcher timer |
| 317 | this._frequencyTimer += dt; |
| 318 | |
| 319 | // Check for new particles launch |
| 320 | const particlesCount = this.getChildren().length; |
| 321 | if ( |
| 322 | particlesCount < this.settings.totalParticles && |
| 323 | this._frequencyTimer >= this.settings.frequency |
| 324 | ) { |
| 325 | this.addParticles( |
| 326 | Math.min( |
| 327 | this.settings.maxParticles, |
| 328 | this.settings.totalParticles - particlesCount, |
| 329 | ), |
| 330 | ); |
| 331 | this._frequencyTimer = 0; |
| 332 | this.isDirty = true; |
| 333 | } |
| 334 | } |
| 335 |
nothing calls this directly
no test coverage detected