🔧 Tweak fire animation fading even more

This commit is contained in:
Simon Schneegans
2021-12-25 20:30:40 +01:00
parent 3c83f7c5bc
commit a3711e8606
+8 -3
View File
@@ -51,7 +51,7 @@ var FireShader = GObject.registerClass({Properties: {}, Signals: {}},
// These may be configurable in the future. // These may be configurable in the future.
const float EDGE_FADE = 70; const float EDGE_FADE = 70;
const float FADE_WIDTH = 0.1; const float FADE_WIDTH = 0.1;
const float HIDE_TIME = 0.3; const float HIDE_TIME = 0.4;
const vec2 FIRE_SCALE = vec2(400, 600) * ${settings.get_double('flame-scale')}; const vec2 FIRE_SCALE = vec2(400, 600) * ${settings.get_double('flame-scale')};
const float FIRE_SPEED = ${settings.get_double('flame-movement-speed')}; const float FIRE_SPEED = ${settings.get_double('flame-movement-speed')};
@@ -105,8 +105,8 @@ var FireShader = GObject.registerClass({Properties: {}, Signals: {}},
// Fade-out when the window burned down. // Fade-out when the window burned down.
if (uProgress > hideTime) { if (uProgress > hideTime) {
float fade = cos(afterBurnProgress*3.14159*0.5); float fade = sqrt(1-afterBurnProgress*afterBurnProgress);
effectMask *= mix(1-t, 1, fade) * fade; effectMask *= mix(1, 1-t, afterBurnProgress) * fade;
} }
// Fade at window borders. // Fade at window borders.
@@ -139,6 +139,11 @@ var FireShader = GObject.registerClass({Properties: {}, Signals: {}},
// Add the fire to the window. // Add the fire to the window.
cogl_color_out += fire; cogl_color_out += fire;
// These are pretty useful for understanding how this works.
// cogl_color_out = vec4(vec3(noise), 1);
// cogl_color_out = vec4(vec3(effectMask.x), 1);
// cogl_color_out = vec4(vec3(effectMask.y), 1);
} }
`); `);
}; };