You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
Snow effect becomes snowstorm when alt-tabbing away and back.
Screenshots
ssr-2025-02-07_16.48.02.mp4
Additional context
vscode seems to pause timers (setInterval(), requestAnimationFrame()) whenever the window is hidden, so updates to pet movement, ball physics, etc are also paused.
However SnowEffect additionally relies on a timeDelta: number to update particle position, so when reopening the window, this delta gets huge and the particles' y-pos goes through the floor. That causes all the particles to respawn at once.
Capping the max delta like ball.ts does to something like 0.1s makes this less noticeable
diff --git a/src/panel/effects/snow.ts b/src/panel/effects/snow.ts
index 2760738..7ef8742 100644
--- a/src/panel/effects/snow.ts+++ b/src/panel/effects/snow.ts@@ -67,6 +67,7 @@ export class SnowEffect implements Effect {
startTime: number = 0;
frameTime: number = 0;
+ maxDelta: number = 0.1;
pAmount: number = 2500; // Snowiness
pSize: number[] = [0.5, 1.5]; // min and max size
@@ -163,7 +164,7 @@ export class SnowEffect implements Effect {
}
// calculate the time since the last frame
var timeNow = microtime();
- var timeDelta = timeNow - this.frameTime;+ var timeDelta = Math.min(timeNow - this.frameTime, this.maxDelta);
for (var i = 0; i < this.particles.length; i++) {
var particle = this.particles[i];
ssr-2025-02-07_16.49.30.mp4
The text was updated successfully, but these errors were encountered:
But feel free to close it if the snowstorm version is preferred. It just caught my eye since I only use a single monitor and alt-tab a lot.
New winter theme looks great either way!
Yeah it does. Kiana Mosser was commissioned to design it especially for this extension. I worked on the snow effects to add a bit more depth. The brief was something like Donkey Kong Country series' snow levels
Describe the bug
Snow effect becomes snowstorm when alt-tabbing away and back.
Screenshots
ssr-2025-02-07_16.48.02.mp4
Additional context
vscode seems to pause timers (
setInterval()
,requestAnimationFrame()
) whenever the window is hidden, so updates to pet movement, ball physics, etc are also paused.However SnowEffect additionally relies on a
timeDelta: number
to update particle position, so when reopening the window, this delta gets huge and the particles' y-pos goes through the floor. That causes all the particles to respawn at once.Capping the max delta like ball.ts does to something like 0.1s makes this less noticeable
ssr-2025-02-07_16.49.30.mp4
The text was updated successfully, but these errors were encountered: