diff --git a/extension.js b/extension.js index b13952d..327c67e 100644 --- a/extension.js +++ b/extension.js @@ -60,6 +60,7 @@ class Extension { new Me.imports.src.Incinerate.Incinerate(), new Me.imports.src.Matrix.Matrix(), new Me.imports.src.Pixelate.Pixelate(), + new Me.imports.src.PixelWheel.PixelWheel(), new Me.imports.src.SnapOfDisintegration.SnapOfDisintegration(), new Me.imports.src.TRexAttack.TRexAttack(), new Me.imports.src.TVEffect.TVEffect(), diff --git a/prefs.js b/prefs.js index 05b9d5d..7fb21d1 100644 --- a/prefs.js +++ b/prefs.js @@ -56,6 +56,7 @@ var PreferencesDialog = class PreferencesDialog { new Me.imports.src.Incinerate.Incinerate(), new Me.imports.src.Matrix.Matrix(), new Me.imports.src.Pixelate.Pixelate(), + new Me.imports.src.PixelWheel.PixelWheel(), new Me.imports.src.SnapOfDisintegration.SnapOfDisintegration(), new Me.imports.src.TRexAttack.TRexAttack(), new Me.imports.src.TVEffect.TVEffect(), diff --git a/resources/shaders/common.glsl b/resources/shaders/common.glsl index 98507b1..1c06bc0 100644 --- a/resources/shaders/common.glsl +++ b/resources/shaders/common.glsl @@ -142,6 +142,7 @@ vec3 tritone(float val, vec3 shadows, vec3 midtones, vec3 highlights) { // https://gitlab.gnome.org/GNOME/mutter/-/blob/main/clutter/clutter/clutter-easing.c float easeOutQuad(float x) { return -1.0 * x * (x - 2.0); } +float easeInQuad(float x) { return x * x; } // --------------------------------------------------------------------- edge mask helpers diff --git a/resources/shaders/pixel-wheel.frag b/resources/shaders/pixel-wheel.frag new file mode 100644 index 0000000..b48ac03 --- /dev/null +++ b/resources/shaders/pixel-wheel.frag @@ -0,0 +1,45 @@ +////////////////////////////////////////////////////////////////////////////////////////// +// ) ( // +// ( /( ( ( ) ( ( ( ( )\ ) ( ( // +// )\()) ))\ )( ( ( )\ ) )\))( )\ ( (()/( ( )\))( ( // +// ((_)\ /((_|()\ )\ ) )\ '(()/( ((_)()((_) )\ ) ((_)))\((_)()\ )\ // +// | |(_|_))( ((_)_(_/( _((_)) )(_)) _(()((_|_)_(_/( _| |((_)(()((_|(_) // +// | '_ \ || | '_| ' \)) | ' \()| || | \ V V / | ' \)) _` / _ \ V V (_-< // +// |_.__/\_,_|_| |_||_| |_|_|_| \_, | \_/\_/|_|_||_|\__,_\___/\_/\_//__/ // +// |__/ // +// Copyright (c) 2021 Simon Schneegans // +// Released under the GPLv3 or later. See LICENSE file for details. // +////////////////////////////////////////////////////////////////////////////////////////// + +// The content from common.glsl is automatically prepended to each shader effect. + +uniform float uPixelSize; +uniform float uSpokeCount; + +void main() { + // We simply inverse the progress for opening windows. + float progress = smoothstep(0.0, 1.0, uForOpening ? 1.0 - uProgress : uProgress); + + // The current level of pixelation increases with the progress. + float pixelSize = ceil(uPixelSize * progress + 1.0); + vec2 pixelGrid = vec2(pixelSize) / uSize; + vec2 texcoord = iTexCoord.st - mod(iTexCoord.st, pixelGrid) + pixelGrid * 0.5; + vec4 oColor = getInputColor(texcoord); + + // Now hide the spoke sections. + vec2 down = vec2(0.0, 1.0); + vec2 fragDir = normalize(texcoord - 0.5); + + // Compute angle to down direction. + float angle = 0.5 * acos(dot(down, fragDir)) / 3.14159265359; + if (fragDir.x < 0.0) { + angle = 1.0 - angle; + } + + // Progressively hide the spokes. + if (mod(angle * uSpokeCount, 1.0) < progress) { + oColor.a = 0.0; + } + + setOutputColor(oColor); +} \ No newline at end of file diff --git a/resources/ui/gtk3/PixelWheel.ui b/resources/ui/gtk3/PixelWheel.ui new file mode 100644 index 0000000..4b1b1a9 --- /dev/null +++ b/resources/ui/gtk3/PixelWheel.ui @@ -0,0 +1,192 @@ + + + + + 2000 + 100 + 1 + 100 + + + + 50 + 1 + 1 + 10 + + + + 50 + 1 + 1 + 10 + + + + vertical + + + + + + none + + + + + 10 + 10 + 10 + 10 + 0 + + + 8 + + + Animation Time [ms] + 0 + start + center + 1 + + + + + end + center + 1 + 0 + left + 300 + pixel-wheel-animation-time + + + + + + + edit-clear-symbolic + 1 + + + Reset to Default Value + + + + + + + + + + + 10 + 10 + 10 + 10 + 0 + + + 8 + + + Spoke Count + 0 + start + center + 1 + + + + + end + center + 1 + 0 + left + 300 + pixel-wheel-spoke-count + + + + + + + edit-clear-symbolic + 1 + + + Reset to Default Value + + + + + + + + + + + 10 + 10 + 10 + 10 + 0 + + + 8 + + + Pixel Size + 0 + start + center + 1 + + + + + end + center + 1 + 0 + left + 300 + pixel-wheel-pixel-size + + + + + + + edit-clear-symbolic + 1 + + + Reset to Default Value + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/resources/ui/gtk4/PixelWheel.ui b/resources/ui/gtk4/PixelWheel.ui new file mode 100644 index 0000000..ae51709 --- /dev/null +++ b/resources/ui/gtk4/PixelWheel.ui @@ -0,0 +1,163 @@ + + + + + vertical + + + + + + none + 1 + + + + + 0 + + + + + Animation Time [ms] + 0 + start + center + 1 + + + + + end + center + 1 + 0 + left + 300 + + + 2000 + 100 + 1 + 100 + + + + + + + edit-clear-symbolic + Reset to Default Value + + + + + + + + + + + 0 + + + + + Spoke Count + 0 + start + center + 1 + + + + + end + center + 1 + 0 + left + 300 + + + 50 + 1 + 1 + 10 + + + + + + + edit-clear-symbolic + Reset to Default Value + + + + + + + + + + + 0 + + + + + Pixel Size + 0 + start + center + 1 + + + + + end + center + 1 + 0 + left + 300 + + + 50 + 1 + 1 + 10 + + + + + + + edit-clear-symbolic + Reset to Default Value + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/schemas/org.gnome.shell.extensions.burn-my-windows.gschema.xml b/schemas/org.gnome.shell.extensions.burn-my-windows.gschema.xml index b54d4e5..b862806 100644 --- a/schemas/org.gnome.shell.extensions.burn-my-windows.gschema.xml +++ b/schemas/org.gnome.shell.extensions.burn-my-windows.gschema.xml @@ -118,6 +118,41 @@ The size of the maximum pixelation. + + + + + + + false + Pixel Wheel Close Effect + Use the Pixel Wheel effect for window closing. + + + + false + Pixel Wheel Open Effect + Use the Pixel Wheel effect for window opening. + + + + 300 + Pixel Wheel Animation Time + The time the Pixel Wheel effect takes. + + + + 12 + Pixel Wheel Spoke Count + The number of sections in the wheel. + + + + 10 + Pixel Wheel Pixel Size + The size of the maximum pixelation. + + @@ -152,7 +187,7 @@ The Y scale of the effect. - + 10 Doom Pixel Size The size of the maximum pixelation.