Skip to content

Commit

Permalink
Merge pull request #690 from LiteralGenie/fix_snow_not_pausing
Browse files Browse the repository at this point in the history
Fix snow particles not pausing
  • Loading branch information
tonybaloney authored Feb 8, 2025
2 parents 970c7e6 + 98c6153 commit 66f1f13
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/panel/effects/snow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ export class SnowEffect implements Effect {

startTime: number = 0;
frameTime: number = 0;
maxTimeDelta: number = 0.1;

pAmount: number = 2500; // Snowiness
pSize: number[] = [0.5, 1.5]; // min and max size
Expand Down Expand Up @@ -162,8 +163,9 @@ export class SnowEffect implements Effect {
return;
}
// calculate the time since the last frame
// this can be large when window is minimized so also impose a limit
var timeNow = microtime();
var timeDelta = timeNow - this.frameTime;
var timeDelta = Math.min(timeNow - this.frameTime, this.maxTimeDelta);

for (var i = 0; i < this.particles.length; i++) {
var particle = this.particles[i];
Expand Down

0 comments on commit 66f1f13

Please sign in to comment.