🔨 Initial attempt on window-opening animation
This commit is contained in:
+20
-8
@@ -74,15 +74,23 @@ var EnergizeB = class EnergizeB {
|
||||
// ---------------------------------------------------------------- API for extension.js
|
||||
|
||||
// This is called from extension.js whenever a window is closed with this effect.
|
||||
static createShader(actor, settings) {
|
||||
return new Shader(settings);
|
||||
static createShader(actor, settings, forOpening) {
|
||||
return new Shader(settings, forOpening);
|
||||
}
|
||||
|
||||
// This is also called from extension.js. It is used to tweak the ongoing transition of
|
||||
// the actor - usually windows are faded to transparency and scaled down slightly by
|
||||
// GNOME Shell. For this effect, windows should neither be scaled nor faded.
|
||||
static getCloseTransition(actor, settings) {
|
||||
return {'opacity': {to: 255}, 'scale-x': {to: 1.0}, 'scale-y': {to: 1.0}};
|
||||
// This is also called from extension.js. It is used to tweak a window's open / close
|
||||
// transitions - usually windows are faded in / out and scaled up / down by GNOME Shell.
|
||||
// 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. This also
|
||||
// determines how the uProgress uniform value will progress in the shader.
|
||||
// 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}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -99,7 +107,7 @@ if (utils.isInShellProcess()) {
|
||||
const shaderSnippets = Me.imports.src.shaderSnippets;
|
||||
|
||||
Shader = GObject.registerClass({}, class Shader extends Clutter.ShaderEffect {
|
||||
_init(settings) {
|
||||
_init(settings, forOpening) {
|
||||
super._init({shader_type: Clutter.ShaderType.FRAGMENT_SHADER});
|
||||
|
||||
const color = Clutter.Color.from_string(settings.get_string('energize-b-color'))[1];
|
||||
@@ -162,6 +170,10 @@ if (utils.isInShellProcess()) {
|
||||
// Compute fading window opacity.
|
||||
float windowMask = pow(1.0 - fadeProgress, 2.0);
|
||||
|
||||
#if ${forOpening ? '1' : '0'}
|
||||
windowMask = 1.0 - windowMask;
|
||||
#endif
|
||||
|
||||
return vec4(showerMask, streakMask, atomMask, windowMask);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user