Skip to content

Commit

Permalink
Update simulationBuilder.js
Browse files Browse the repository at this point in the history
Add a safety margin to avoid disturbing 60fps in a 60Hz monitor
  • Loading branch information
hoiast committed Dec 1, 2022
1 parent daf9c45 commit 8ad218f
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/js/simulationBuilder.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,9 @@ export default class Simulation {

// . Frame per second counter
this.fpsMax = 60;
this.safetyMargin = 1.1; //10% more
this.lastFrameUpdate = new Date().getTime();
this.minIntervalBetweenFrames = 1000 / this.fpsMax;
this.minIntervalBetweenFrames = 1000 / (this.fpsMax * this.safetyMargin);

//Preserve context
this.simulationStep = this.simulationStep.bind(this);
Expand Down

0 comments on commit 8ad218f

Please sign in to comment.