Add automatic random splats on timer.#22
Open
DavidHaitch wants to merge 2 commits into
Open
Conversation
Author
|
(Tip: for best results, let the autosplats develop slowly over time, with low density and velocity diffusions.) |
|
This looks great! I'm going to try to incorporate these random autosplats with spotify song tempo |
canda
reviewed
Sep 3, 2019
| setTimeout(autosplat, config.AUTOSPLAT_DELAY*1000); | ||
| } | ||
|
|
||
| setTimeout(autosplat, config.AUTOSPLAT_DELAY*1000); |
There was a problem hiding this comment.
I'm not sure, but won't this recursion trigger a stack overflow over time?
If that's the case, how about using a setInterval instead?
Author
There was a problem hiding this comment.
After a few hours of runtime, I didn't observe any significant slowdown or memory increase. You may be right that this could happen, but I wanted to use a repeated setTimeout to enable the user to change the splat interval after start.
|
Thanks, merged your code into webgl-fluid@0.3.8: npm i webgl-fluidWebGLFluid(document.querySelector('canvas'), {
AUTO: true, // Whether to enable auto-splating
INTERVAL: 3000, // The time (in milliseconds) the timer should delay in between auto-splating
SPLAT_COUNT: Number.parseInt(Math.random() * 20) + 5, // Set the splats' count
}) |
|
您好,我已经收到你的信件!我会及时阅读并作出回应!
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.

I wanted to use this sim as a more passive visualization for a party. To support this, I've added an "auto-splat" mode that adds random splats on a configurable interval.