-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add automatic random splats on timer. #22
base: master
Are you sure you want to change the base?
Conversation
(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 |
setTimeout(autosplat, config.AUTOSPLAT_DELAY*1000); | ||
} | ||
|
||
setTimeout(autosplat, config.AUTOSPLAT_DELAY*1000); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, merged your code into [email protected]: npm i webgl-fluid WebGLFluid(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
}) |
您好,我已经收到你的信件!我会及时阅读并作出回应!
|
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.