20250101
This commit is contained in:
+2
-1
@@ -49,6 +49,7 @@ import TVGlitch from './src/effects/TVGlitch.js';
|
|||||||
import Wisps from './src/effects/Wisps.js';
|
import Wisps from './src/effects/Wisps.js';
|
||||||
import Mushroom from './src/effects/Mushroom.js';
|
import Mushroom from './src/effects/Mushroom.js';
|
||||||
|
|
||||||
|
import SimpleFade from './src/effects/SimpleFade.js';
|
||||||
|
|
||||||
|
|
||||||
import * as Main from 'resource:///org/gnome/shell/ui/main.js';
|
import * as Main from 'resource:///org/gnome/shell/ui/main.js';
|
||||||
@@ -82,7 +83,7 @@ export default class BurnMyWindows extends Extension {
|
|||||||
new Matrix(), new PaintBrush(), new Pixelate(), new PixelWheel(),
|
new Matrix(), new PaintBrush(), new Pixelate(), new PixelWheel(),
|
||||||
new PixelWipe(), new Portal(), new RGBWarp(), new SnapOfDisintegration(),
|
new PixelWipe(), new Portal(), new RGBWarp(), new SnapOfDisintegration(),
|
||||||
new TeamRocket(), new TRexAttack(), new TVEffect(), new TVGlitch(),
|
new TeamRocket(), new TRexAttack(), new TVEffect(), new TVGlitch(),
|
||||||
new Wisps(), new Mushroom(),
|
new Wisps(), new Mushroom(), new SimpleFade(),
|
||||||
|
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ import TVEffect from './src/effects/TVEffect.js';
|
|||||||
import TVGlitch from './src/effects/TVGlitch.js';
|
import TVGlitch from './src/effects/TVGlitch.js';
|
||||||
import Wisps from './src/effects/Wisps.js';
|
import Wisps from './src/effects/Wisps.js';
|
||||||
|
|
||||||
|
import SimpleFade from './src/effects/SimpleFade.js';
|
||||||
|
|
||||||
import {ExtensionPreferences, gettext as _} from 'resource:///org/gnome/Shell/Extensions/js/extensions/prefs.js';
|
import {ExtensionPreferences, gettext as _} from 'resource:///org/gnome/Shell/Extensions/js/extensions/prefs.js';
|
||||||
|
|
||||||
@@ -84,7 +84,7 @@ export default class BurnMyWindowsPreferences extends ExtensionPreferences {
|
|||||||
Pixelate, PixelWheel, PixelWipe,
|
Pixelate, PixelWheel, PixelWipe,
|
||||||
Portal, RGBWarp, SnapOfDisintegration,
|
Portal, RGBWarp, SnapOfDisintegration,
|
||||||
TeamRocket, TRexAttack, TVEffect,
|
TeamRocket, TRexAttack, TVEffect,
|
||||||
TVGlitch, Wisps,
|
TVGlitch, Wisps, SimpleFade,
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,116 @@
|
|||||||
|
//////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// ) ( //
|
||||||
|
// ( /( ( ( ) ( ( ( ( )\ ) ( ( //
|
||||||
|
// )\()) ))\ )( ( ( )\ ) )\))( )\ ( (()/( ( )\))( ( //
|
||||||
|
// ((_)\ /((_|()\ )\ ) )\ '(()/( ((_)()((_) )\ ) ((_)))\((_)()\ )\ //
|
||||||
|
// | |(_|_))( ((_)_(_/( _((_)) )(_)) _(()((_|_)_(_/( _| |((_)(()((_|(_) //
|
||||||
|
// | '_ \ || | '_| ' \)) | ' \()| || | \ V V / | ' \)) _` / _ \ V V (_-< //
|
||||||
|
// |_.__/\_,_|_| |_||_| |_|_|_| \_, | \_/\_/|_|_||_|\__,_\___/\_/\_//__/ //
|
||||||
|
// |__/ //
|
||||||
|
//////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
// SPDX-FileCopyrightText: Justin Garza JGarza9788@gmail.com
|
||||||
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
|
||||||
|
// The content from common.glsl is automatically prepended to each shader effect. This
|
||||||
|
// provides the standard input:
|
||||||
|
|
||||||
|
// vec2 iTexCoord: Texture coordinates for retrieving the window input color.
|
||||||
|
// bool uIsFullscreen: True if the window is maximized or in fullscreen mode.
|
||||||
|
// bool uForOpening: True if a window-open animation is ongoing, false otherwise.
|
||||||
|
// float uProgress: A value which transitions from 0 to 1 during the animation.
|
||||||
|
// float uDuration: The duration of the current animation in seconds.
|
||||||
|
// vec2 uSize: The size of uTexture in pixels.
|
||||||
|
// float uPadding: The empty area around the actual window (e.g. where the shadow
|
||||||
|
// is drawn). For now, this will only be set on GNOME.
|
||||||
|
|
||||||
|
// Furthermore, there are two global methods for reading the window input color and
|
||||||
|
// setting the shader output color. Both methods assume straight alpha:
|
||||||
|
|
||||||
|
// vec4 getInputColor(vec2 coords)
|
||||||
|
// void setOutputColor(vec4 outColor)
|
||||||
|
|
||||||
|
// The width of the fading effect is loaded from the settings.
|
||||||
|
// uniform float uFadeWidth;
|
||||||
|
|
||||||
|
float uBlurQuality = 5.0;
|
||||||
|
vec4 uSeed = vec4(0.4,0.2,0.4,0.6);
|
||||||
|
|
||||||
|
// A simple blur function
|
||||||
|
vec4 blur(vec2 uv, float radius, float samples) {
|
||||||
|
// Initialize the color accumulator to zero.
|
||||||
|
vec4 color = vec4(0.0);
|
||||||
|
|
||||||
|
// Define a constant for 2 * PI (tau), which represents a full circle in radians.
|
||||||
|
const float tau = 6.28318530718;
|
||||||
|
|
||||||
|
// Number of directions for sampling around the circle.
|
||||||
|
const float directions = 15.0;
|
||||||
|
|
||||||
|
// Outer loop iterates over multiple directions evenly spaced around a circle.
|
||||||
|
for (float d = 0.0; d < tau; d += tau / directions) {
|
||||||
|
// Inner loop samples along each direction, with decreasing intensity.
|
||||||
|
for (float s = 0.0; s < 1.0; s += 1.0 / samples) {
|
||||||
|
// Calculate the offset for this sample based on direction, radius, and step.
|
||||||
|
// The (1.0 - s) term ensures more sampling occurs closer to the center.
|
||||||
|
vec2 offset = vec2(cos(d), sin(d)) * radius * (1.0 - s) / uSize;
|
||||||
|
|
||||||
|
// Add the sampled color at the offset position to the accumulator.
|
||||||
|
color += getInputColor(uv + offset);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Normalize the accumulated color by dividing by the total number of samples
|
||||||
|
// and directions to ensure the result is averaged.
|
||||||
|
return color / samples / directions;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
void main() {
|
||||||
|
// Calculate the progression value based on the animation direction.
|
||||||
|
// If opening, use uProgress as-is; if closing, invert the progression.
|
||||||
|
float progress = uForOpening ? 1.0 - uProgress : uProgress ;
|
||||||
|
|
||||||
|
//r is for random .. 4 random numbers between -1.0 and 1.0
|
||||||
|
vec4 r = hash42(iTexCoord.st * progress * 0.1) * 2.0 - vec4(0.5);
|
||||||
|
|
||||||
|
//zero to one... mostly one
|
||||||
|
float ztomo = remap(
|
||||||
|
progress,
|
||||||
|
0.0,0.1,
|
||||||
|
0.0,1.0
|
||||||
|
);
|
||||||
|
ztomo = easeInOutSine(ztomo);
|
||||||
|
|
||||||
|
|
||||||
|
//out Expo
|
||||||
|
float oExpo = easeOutExpo(progress);
|
||||||
|
float iExpo = easeInExpo(progress);
|
||||||
|
float ioSine = easeInOutSine(progress);
|
||||||
|
float ioSine_r = 1.0 - ioSine;
|
||||||
|
|
||||||
|
vec2 uv = iTexCoord.st;
|
||||||
|
|
||||||
|
// change the center
|
||||||
|
uv = uv * 2.0 - 1.0;
|
||||||
|
|
||||||
|
//scale
|
||||||
|
uv /= ioSine_r;
|
||||||
|
|
||||||
|
//re-center
|
||||||
|
uv = uv * 0.5 + 0.5;
|
||||||
|
|
||||||
|
// uv.x -= simplex3D(r.xyz * 50.0) * 0.1;
|
||||||
|
// uv.y -= simplex3D(r.xyz * 50.0) * 0.1;
|
||||||
|
|
||||||
|
// uv.x -= sin(progress)
|
||||||
|
|
||||||
|
//get color
|
||||||
|
vec4 oColor = blur(uv, ztomo * 100.0,uBlurQuality);
|
||||||
|
oColor.a *= ioSine_r;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
setOutputColor(oColor);
|
||||||
|
}
|
||||||
@@ -123,8 +123,6 @@ void main() {
|
|||||||
// scale progress ... the first half of the animation
|
// scale progress ... the first half of the animation
|
||||||
float scalep = remap(
|
float scalep = remap(
|
||||||
progress,
|
progress,
|
||||||
//0.0,clamp(uWT + 0.1,0.0,1.0),
|
|
||||||
// 0.0,0.6,
|
|
||||||
0.0,uWT+0.1,
|
0.0,uWT+0.1,
|
||||||
0.0,1.0
|
0.0,1.0
|
||||||
);
|
);
|
||||||
@@ -135,8 +133,6 @@ void main() {
|
|||||||
// sparkle progress ... the second half of the animation
|
// sparkle progress ... the second half of the animation
|
||||||
float sparkp = remap(
|
float sparkp = remap(
|
||||||
progress,
|
progress,
|
||||||
// clamp((1.0 - uWT) - 0.1,0.0,1.0),1.0,
|
|
||||||
// 0.4,1.0,
|
|
||||||
uWT-0.1,1.0,
|
uWT-0.1,1.0,
|
||||||
0.0,1.0
|
0.0,1.0
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -1126,6 +1126,29 @@ SPDX-License-Identifier: CC0-1.0
|
|||||||
<description>Sparkle Size</description>
|
<description>Sparkle Size</description>
|
||||||
</key>
|
</key>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
|
||||||
|
<!-- Simple Fade Effect Options -->
|
||||||
|
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
|
||||||
|
|
||||||
|
<key name="simple-fade-enable-effect" type="b">
|
||||||
|
<default>false</default>
|
||||||
|
<summary>Simple Fade Enable Effect</summary>
|
||||||
|
<description>Use the Simple Fade effect.</description>
|
||||||
|
</key>
|
||||||
|
|
||||||
|
<key name="simple-fade-animation-time" type="i">
|
||||||
|
<default>3000</default>
|
||||||
|
<summary>Simple Fade Animation Time</summary>
|
||||||
|
<description>The time the Simple Fade effect takes.</description>
|
||||||
|
</key>
|
||||||
|
|
||||||
|
<key name="simple-fade-width" type="d">
|
||||||
|
<default>0.1</default>
|
||||||
|
<summary>Simple Fade Width</summary>
|
||||||
|
<description>Width of the fading effect.</description>
|
||||||
|
</key>
|
||||||
|
|
||||||
</schema>
|
</schema>
|
||||||
|
|
||||||
</schemalist>
|
</schemalist>
|
||||||
|
|||||||
@@ -0,0 +1,93 @@
|
|||||||
|
//////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// ) ( //
|
||||||
|
// ( /( ( ( ) ( ( ( ( )\ ) ( ( //
|
||||||
|
// )\()) ))\ )( ( ( )\ ) )\))( )\ ( (()/( ( )\))( ( //
|
||||||
|
// ((_)\ /((_|()\ )\ ) )\ '(()/( ((_)()((_) )\ ) ((_)))\((_)()\ )\ //
|
||||||
|
// | |(_|_))( ((_)_(_/( _((_)) )(_)) _(()((_|_)_(_/( _| |((_)(()((_|(_) //
|
||||||
|
// | '_ \ || | '_| ' \)) | ' \()| || | \ V V / | ' \)) _` / _ \ V V (_-< //
|
||||||
|
// |_.__/\_,_|_| |_||_| |_|_|_| \_, | \_/\_/|_|_||_|\__,_\___/\_/\_//__/ //
|
||||||
|
// |__/ //
|
||||||
|
//////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
// SPDX-FileCopyrightText: Justin Garza JGarza9788@gmail.com
|
||||||
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
import * as utils from '../utils.js';
|
||||||
|
|
||||||
|
// We import the ShaderFactory only in the Shell process as it is not required in the
|
||||||
|
// preferences process. The preferences process does not create any shader instances, it
|
||||||
|
// only uses the static metadata of the effect.
|
||||||
|
const ShaderFactory = await utils.importInShellOnly('./ShaderFactory.js');
|
||||||
|
|
||||||
|
const _ = await utils.importGettext();
|
||||||
|
|
||||||
|
//////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// This effect ... //
|
||||||
|
// <- Please add a description of your effect here -> //
|
||||||
|
//////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
// The effect class can be used to get some metadata (like the effect's name or supported
|
||||||
|
// GNOME Shell versions), to initialize the respective page of the settings dialog, as
|
||||||
|
// well as to create the actual shader for the effect.
|
||||||
|
export default class Effect {
|
||||||
|
// The constructor creates a ShaderFactory which will be used by extension.js to create
|
||||||
|
// shader instances for this effect. The shaders will be automagically created using the
|
||||||
|
// GLSL file in resources/shaders/<nick>.glsl. The callback will be called for each
|
||||||
|
// newly created shader instance.
|
||||||
|
constructor() {
|
||||||
|
this.shaderFactory = new ShaderFactory(Effect.getNick(), (shader) => {
|
||||||
|
// Store uniform locations of newly created shaders.
|
||||||
|
// shader._uFadeWidth = shader.get_uniform_location('uFadeWidth');
|
||||||
|
|
||||||
|
// Write all uniform values at the start of each animation.
|
||||||
|
shader.connect('begin-animation', (shader, settings) => {
|
||||||
|
|
||||||
|
// shader.set_uniform_float(shader._uFadeWidth, 1, [
|
||||||
|
// settings.get_double('simple-fade-width'),
|
||||||
|
// ]);
|
||||||
|
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------------------- metadata
|
||||||
|
|
||||||
|
// The effect is available on all GNOME Shell versions supported by this extension.
|
||||||
|
static getMinShellVersion() {
|
||||||
|
return [3, 36];
|
||||||
|
}
|
||||||
|
|
||||||
|
// This will be called in various places where a unique identifier for this effect is
|
||||||
|
// required. It should match the prefix of the settings keys which store whether the
|
||||||
|
// effect is enabled currently (e.g. '*-enable-effect'), and its animation time
|
||||||
|
// (e.g. '*-animation-time'). Also, the shader file and the settings UI files should be
|
||||||
|
// named likes this.
|
||||||
|
static getNick() {
|
||||||
|
return 'simple-fade';
|
||||||
|
}
|
||||||
|
|
||||||
|
// This will be shown in the sidebar of the preferences dialog as well as in the
|
||||||
|
// drop-down menus where the user can choose the effect.
|
||||||
|
static getLabel() {
|
||||||
|
return _('Simple Fade Effect');
|
||||||
|
}
|
||||||
|
|
||||||
|
// -------------------------------------------------------------------- API for prefs.js
|
||||||
|
|
||||||
|
// This is called by the preferences dialog whenever a new effect profile is loaded. It
|
||||||
|
// binds all user interface elements to the respective settings keys of the profile.
|
||||||
|
static bindPreferences(dialog) {
|
||||||
|
// Empty for now... Code is added here later in the tutorial!
|
||||||
|
}
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------- API for extension.js
|
||||||
|
|
||||||
|
// 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, forOpening, actor) {
|
||||||
|
return {x: 1.0, y: 1.0};
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -39,14 +39,14 @@ export default class Effect {
|
|||||||
constructor() {
|
constructor() {
|
||||||
this.shaderFactory = new ShaderFactory(Effect.getNick(), (shader) => {
|
this.shaderFactory = new ShaderFactory(Effect.getNick(), (shader) => {
|
||||||
// Store uniform locations of newly created shaders.
|
// Store uniform locations of newly created shaders.
|
||||||
shader._uWT = shader.get_uniform_location('uWT');
|
shader._uWT = shader.get_uniform_location('uWT');
|
||||||
shader._uXpos = shader.get_uniform_location('uXpos');
|
shader._uXpos = shader.get_uniform_location('uXpos');
|
||||||
shader._uYpos = shader.get_uniform_location('uYpos');
|
shader._uYpos = shader.get_uniform_location('uYpos');
|
||||||
shader._uWinRot = shader.get_uniform_location('uWinRot');
|
shader._uWinRot = shader.get_uniform_location('uWinRot');
|
||||||
shader._uSparkleRot = shader.get_uniform_location('uSparkleRot');
|
shader._uSparkleRot = shader.get_uniform_location('uSparkleRot');
|
||||||
shader._uSparkleSize = shader.get_uniform_location('uSparkleSize');
|
shader._uSparkleSize = shader.get_uniform_location('uSparkleSize');
|
||||||
|
|
||||||
shader._uSeed = shader.get_uniform_location('uSeed');
|
shader._uSeed = shader.get_uniform_location('uSeed');
|
||||||
|
|
||||||
// Write all uniform values at the start of each animation.
|
// Write all uniform values at the start of each animation.
|
||||||
shader.connect('begin-animation', (shader, settings) => {
|
shader.connect('begin-animation', (shader, settings) => {
|
||||||
@@ -63,7 +63,7 @@ export default class Effect {
|
|||||||
]);
|
]);
|
||||||
|
|
||||||
shader.set_uniform_float(shader._uWinRot, 1,
|
shader.set_uniform_float(shader._uWinRot, 1,
|
||||||
[settings.get_boolean('team-rocket-win-rot')]);
|
[settings.get_boolean('team-rocket-win-rot')]);
|
||||||
|
|
||||||
shader.set_uniform_float(shader._uSparkleRot, 1, [
|
shader.set_uniform_float(shader._uSparkleRot, 1, [
|
||||||
settings.get_double('team-rocket-sparkle-rot'),
|
settings.get_double('team-rocket-sparkle-rot'),
|
||||||
|
|||||||
Reference in New Issue
Block a user