Skip to content

Commit

Permalink
feat: add set fps jsdoc
Browse files Browse the repository at this point in the history
feat: add set fps jsdoc
  • Loading branch information
drawcall committed Jan 26, 2025
1 parent 37dfd4d commit 3942c93
Show file tree
Hide file tree
Showing 9 changed files with 47 additions and 11 deletions.
12 changes: 10 additions & 2 deletions build/proton.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -147,8 +147,16 @@ declare class Proton$1 {
integrator: Integration;
_fps: string;
_interval: number;
set fps(fps: string);
get fps(): string;
/**
* Sets the frames per second (FPS) for the Proton system.
* @param {number|string} fps - The desired FPS. Use "auto" for default behavior, or a number for a specific FPS.
*/
set fps(fps: number | string);
/**
* Gets the current frames per second (FPS) setting.
* @returns {number|string} The current FPS setting. Returns "auto" if set to default, or a number representing the specific FPS.
*/
get fps(): number | string;
/**
* add a type of Renderer
*
Expand Down
14 changes: 12 additions & 2 deletions build/proton.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion build/proton.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion build/proton.min.js.map

Large diffs are not rendered by default.

14 changes: 12 additions & 2 deletions build/proton.web.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion build/proton.web.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion build/proton.web.min.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "proton-engine",
"version": "7.1.0",
"version": "7.1.1",
"description": "Proton is a simple and powerful javascript particle animation engine.",
"keywords": [
"particle",
Expand Down
8 changes: 8 additions & 0 deletions src/core/Proton.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,19 @@ export default class Proton {
this._interval = Proton.DEFAULT_INTERVAL;
}

/**
* Sets the frames per second (FPS) for the Proton system.
* @param {number|string} fps - The desired FPS. Use "auto" for default behavior, or a number for a specific FPS.
*/
set fps(fps) {
this._fps = fps;
this._interval = fps === "auto" ? Proton.DEFAULT_INTERVAL : MathUtil.floor(1 / fps, 7);
}

/**
* Gets the current frames per second (FPS) setting.
* @returns {number|string} The current FPS setting. Returns "auto" if set to default, or a number representing the specific FPS.
*/
get fps() {
return this._fps;
}
Expand Down

0 comments on commit 3942c93

Please sign in to comment.