Adds FPS limit option to preserve browser performance #28
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Adds fps to options and associated documentation. Works by calling a setTimeout at the end of each draw instead of immediately calling the next draw. setTimeout is controlled by fps option, or can be set to 0 for no throttling. Defaults to 60FPS, which should keep Firefox tabs from crashing when they encounter this library.
Draw loop tracks elapsed time since last draw and multiplies particle speed by time so that the distance particles cover stays the same regardless of the chosen FPS. Speed is also divided by an arbitrary number to keep the distance covered by certain clock speeds roughly equal in the frame-limited animation loop to what they would have been in the unlimited loop. This is just so a clock of "25" still looks the same speed as it did without frame limiting.
fixes #23