♻️ Simplify transition tweaking
This commit is contained in:
+14
-22
@@ -97,22 +97,11 @@ var EnergizeA = class EnergizeA {
|
||||
return shader;
|
||||
}
|
||||
|
||||
// The tweakTransition() is called from extension.js to tweak a window's open / close
|
||||
// transitions - usually windows are faded in / out and scaled up / down by GNOME Shell.
|
||||
// The parameter 'forOpening' is set to true if this is called for a window-open
|
||||
// transition, for a window-close transition it is set to false. The modes can be set to
|
||||
// any value from here: https://gjs-docs.gnome.org/clutter8~8_api/clutter.animationmode.
|
||||
// The only required property is 'opacity', even if it transitions from 1.0 to 1.0. The
|
||||
// current value of the opacity transition is passed as uProgress to the shader.
|
||||
// Tweaking the actor's scale during the transition only works properly for GNOME 3.38+.
|
||||
|
||||
// For this effect, windows should neither be scaled nor faded.
|
||||
static tweakTransition(actor, settings, forOpening) {
|
||||
return {
|
||||
'opacity': {from: 255, to: 255, mode: 3},
|
||||
'scale-x': {from: 1.0, to: 1.0, mode: 3},
|
||||
'scale-y': {from: 1.0, to: 1.0, mode: 3}
|
||||
};
|
||||
// The getActorScale() is called from extension.js to adjust the actor's size during the
|
||||
// animation. This is useful if the effect requires drawing something beyond the usual
|
||||
// bounds of the actor. This only works for GNOME 3.38+.
|
||||
static getActorScale(settings) {
|
||||
return {x: 1.0, y: 1.0};
|
||||
}
|
||||
|
||||
// This is called from extension.js if the extension is disabled. This should free all
|
||||
@@ -169,6 +158,7 @@ if (utils.isInShellProcess()) {
|
||||
${shaderSnippets.standardUniforms()}
|
||||
${shaderSnippets.noise()}
|
||||
${shaderSnippets.edgeMask()}
|
||||
${shaderSnippets.easing()}
|
||||
|
||||
uniform vec3 uColor;
|
||||
uniform float uScale;
|
||||
@@ -181,10 +171,10 @@ if (utils.isInShellProcess()) {
|
||||
// This method returns two values:
|
||||
// result.x: A mask for the particles.
|
||||
// result.y: The opacity of the fading window.
|
||||
vec2 getMasks() {
|
||||
float fadeInProgress = clamp(uProgress/FADE_IN_TIME, 0, 1);
|
||||
float fadeOutProgress = clamp((uProgress-FADE_IN_TIME)/FADE_OUT_TIME, 0, 1);
|
||||
float heartProgress = clamp((uProgress-(1.0-HEART_FADE_TIME))/HEART_FADE_TIME, 0, 1);
|
||||
vec2 getMasks(float progress) {
|
||||
float fadeInProgress = clamp(progress/FADE_IN_TIME, 0, 1);
|
||||
float fadeOutProgress = clamp((progress-FADE_IN_TIME)/FADE_OUT_TIME, 0, 1);
|
||||
float heartProgress = clamp((progress-(1.0-HEART_FADE_TIME))/HEART_FADE_TIME, 0, 1);
|
||||
|
||||
// Compute mask for the "atom" particles.
|
||||
float dist = length(cogl_tex_coord_in[0].st - 0.5) * 4.0;
|
||||
@@ -214,7 +204,9 @@ if (utils.isInShellProcess()) {
|
||||
`;
|
||||
|
||||
const code = `
|
||||
vec2 masks = getMasks();
|
||||
float progress = easeOutQuad(uProgress);
|
||||
|
||||
vec2 masks = getMasks(progress);
|
||||
vec4 windowColor = texture2D(uTexture, cogl_tex_coord_in[0].st);
|
||||
|
||||
// Shell.GLSLEffect uses straight alpha. So we have to convert from premultiplied.
|
||||
@@ -226,7 +218,7 @@ if (utils.isInShellProcess()) {
|
||||
cogl_color_out.rgb = mix(uColor, windowColor.rgb, 0.2 * masks.y + 0.8);
|
||||
cogl_color_out.a = windowColor.a * masks.y;
|
||||
|
||||
vec2 scaledUV = (cogl_tex_coord_in[0].st-0.5) * (1.0 + 0.1*uProgress);
|
||||
vec2 scaledUV = (cogl_tex_coord_in[0].st-0.5) * (1.0 + 0.1*progress);
|
||||
scaledUV /= uScale;
|
||||
|
||||
// Add molecule particles.
|
||||
|
||||
Reference in New Issue
Block a user