🎉 Add shift parameter to glide effect [generate-references]
This commit is contained in:
@@ -86,6 +86,16 @@ SPDX-License-Identifier: GPL-3.0-or-later
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string>Shift</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QDoubleSpinBox" name="kcfg_Squish">
|
||||
<property name="maximum">
|
||||
@@ -109,6 +119,19 @@ SPDX-License-Identifier: GPL-3.0-or-later
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<widget class="QDoubleSpinBox" name="kcfg_Shift">
|
||||
<property name="minimum">
|
||||
<double>-1.000000000000000</double>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<double>1.000000000000000</double>
|
||||
</property>
|
||||
<property name="singleStep">
|
||||
<double>0.1</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources />
|
||||
|
||||
+5
-2
@@ -12,13 +12,16 @@ SPDX-License-Identifier: GPL-3.0-or-later
|
||||
<default>250</default>
|
||||
</entry>
|
||||
<entry name="Scale" type="Double">
|
||||
<default>0.9</default>
|
||||
<default>0.95</default>
|
||||
</entry>
|
||||
<entry name="Squish" type="Double">
|
||||
<default>0.1</default>
|
||||
<default>0.15</default>
|
||||
</entry>
|
||||
<entry name="Tilt" type="Double">
|
||||
<default>-0.3</default>
|
||||
</entry>
|
||||
<entry name="Shift" type="Double">
|
||||
<default>-0.05</default>
|
||||
</entry>
|
||||
</group>
|
||||
</kcfg>
|
||||
@@ -8,3 +8,4 @@
|
||||
effect.setUniform(this.shader, 'uScale', effect.readConfig('Scale', 1.0));
|
||||
effect.setUniform(this.shader, 'uSquish', effect.readConfig('Squish', 1.0));
|
||||
effect.setUniform(this.shader, 'uTilt', effect.readConfig('Tilt', 1.0));
|
||||
effect.setUniform(this.shader, 'uShift', effect.readConfig('Shift', 1.0));
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
uniform float uScale;
|
||||
uniform float uSquish;
|
||||
uniform float uTilt;
|
||||
uniform float uShift;
|
||||
|
||||
void main() {
|
||||
// We reverse the progress for window opening.
|
||||
@@ -35,6 +36,9 @@ void main() {
|
||||
// 'Tilt' image texture around x-axis.
|
||||
coords.x /= mix(1.0, 1.0 - 0.1 * uTilt * coords.y, progress);
|
||||
|
||||
// Move image texture vertically.
|
||||
coords.y += uShift * progress;
|
||||
|
||||
// Move texture coordinate center to corner again.
|
||||
coords = coords * 0.5 + 0.5;
|
||||
|
||||
|
||||
@@ -141,6 +141,39 @@ SPDX-License-Identifier: GPL-3.0-or-later
|
||||
</object>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<object class="AdwActionRow">
|
||||
<property name="title" translatable="yes">Shift</property>
|
||||
<child>
|
||||
<object class="GtkScale">
|
||||
<property name="valign">center</property>
|
||||
<property name="draw-value">1</property>
|
||||
<property name="digits">2</property>
|
||||
<property name="value-pos">left</property>
|
||||
<property name="width-request">300</property>
|
||||
<property name="adjustment">
|
||||
<object class="GtkAdjustment" id="glide-shift">
|
||||
<property name="upper">1</property>
|
||||
<property name="lower">-1</property>
|
||||
<property name="step-increment">0.01</property>
|
||||
<property name="page-increment">0.1</property>
|
||||
</object>
|
||||
</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="reset-glide-shift">
|
||||
<property name="icon-name">edit-clear-symbolic</property>
|
||||
<property name="valign">center</property>
|
||||
<property name="tooltip-text" translatable="yes">Reset to Default Value</property>
|
||||
<style>
|
||||
<class name="flat" />
|
||||
</style>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
|
||||
</object>
|
||||
|
||||
</interface>
|
||||
@@ -35,6 +35,13 @@ SPDX-License-Identifier: GPL-3.0-or-later
|
||||
<property name="page-increment">0.1</property>
|
||||
</object>
|
||||
|
||||
<object class="GtkAdjustment" id="glide-shift">
|
||||
<property name="upper">1</property>
|
||||
<property name="lower">-1</property>
|
||||
<property name="step-increment">0.01</property>
|
||||
<property name="page-increment">0.1</property>
|
||||
</object>
|
||||
|
||||
<object class="GtkBox" id="glide-prefs">
|
||||
<property name="orientation">vertical</property>
|
||||
|
||||
@@ -243,6 +250,55 @@ SPDX-License-Identifier: GPL-3.0-or-later
|
||||
</object>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<object class="GtkListBoxRow">
|
||||
<property name="margin-start">10</property>
|
||||
<property name="margin-end">10</property>
|
||||
<property name="margin-top">10</property>
|
||||
<property name="margin-bottom">10</property>
|
||||
<property name="activatable">0</property>
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<property name="spacing">8</property>
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="label" translatable="yes">Shift</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="halign">start</property>
|
||||
<property name="valign">center</property>
|
||||
<property name="hexpand">1</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkScale">
|
||||
<property name="halign">end</property>
|
||||
<property name="valign">center</property>
|
||||
<property name="draw-value">1</property>
|
||||
<property name="digits">2</property>
|
||||
<property name="value-pos">left</property>
|
||||
<property name="width-request">300</property>
|
||||
<property name="adjustment">glide-shift</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="reset-glide-shift">
|
||||
<child>
|
||||
<object class="GtkImage">
|
||||
<property name="icon-name">edit-clear-symbolic</property>
|
||||
<property name="icon-size">1</property>
|
||||
</object>
|
||||
</child>
|
||||
<property name="tooltip-text" translatable="yes">Reset to Default Value</property>
|
||||
<style>
|
||||
<class name="flat" />
|
||||
</style>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
|
||||
@@ -204,6 +204,51 @@ SPDX-License-Identifier: GPL-3.0-or-later
|
||||
</object>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<object class="GtkListBoxRow">
|
||||
<property name="activatable">0</property>
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="label" translatable="yes">Shift</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="halign">start</property>
|
||||
<property name="valign">center</property>
|
||||
<property name="hexpand">1</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkScale">
|
||||
<property name="halign">end</property>
|
||||
<property name="valign">center</property>
|
||||
<property name="draw-value">1</property>
|
||||
<property name="digits">2</property>
|
||||
<property name="value-pos">left</property>
|
||||
<property name="width-request">300</property>
|
||||
<property name="adjustment">
|
||||
<object class="GtkAdjustment" id="glide-shift">
|
||||
<property name="upper">1</property>
|
||||
<property name="lower">-1</property>
|
||||
<property name="step-increment">0.01</property>
|
||||
<property name="page-increment">0.1</property>
|
||||
</object>
|
||||
</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="reset-glide-shift">
|
||||
<property name="icon-name">edit-clear-symbolic</property>
|
||||
<property name="tooltip-text" translatable="yes">Reset to Default Value</property>
|
||||
<style>
|
||||
<class name="flat" />
|
||||
</style>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
|
||||
</object>
|
||||
</child>
|
||||
|
||||
@@ -320,13 +320,13 @@ SPDX-License-Identifier: CC0-1.0
|
||||
</key>
|
||||
|
||||
<key name="glide-scale" type="d">
|
||||
<default>0.9</default>
|
||||
<default>0.95</default>
|
||||
<summary>Glide Scale</summary>
|
||||
<description>The scale of the window.</description>
|
||||
</key>
|
||||
|
||||
<key name="glide-squish" type="d">
|
||||
<default>0.1</default>
|
||||
<default>0.15</default>
|
||||
<summary>Glide Squish</summary>
|
||||
<description>The amount of squishing.</description>
|
||||
</key>
|
||||
@@ -337,6 +337,12 @@ SPDX-License-Identifier: CC0-1.0
|
||||
<description>The amount of tilting.</description>
|
||||
</key>
|
||||
|
||||
<key name="glide-shift" type="d">
|
||||
<default>-0.05</default>
|
||||
<summary>Glide Shift</summary>
|
||||
<description>The amount of shifting.</description>
|
||||
</key>
|
||||
|
||||
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
|
||||
<!-- Matrix Options -->
|
||||
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
|
||||
|
||||
@@ -42,6 +42,7 @@ var Glide = class {
|
||||
shader._uScale = shader.get_uniform_location('uScale');
|
||||
shader._uSquish = shader.get_uniform_location('uSquish');
|
||||
shader._uTilt = shader.get_uniform_location('uTilt');
|
||||
shader._uShift = shader.get_uniform_location('uShift');
|
||||
|
||||
// Write all uniform values at the start of each animation.
|
||||
shader.connect('begin-animation', (shader, settings) => {
|
||||
@@ -49,6 +50,7 @@ var Glide = class {
|
||||
shader.set_uniform_float(shader._uScale, 1, [settings.get_double('glide-scale')]);
|
||||
shader.set_uniform_float(shader._uSquish, 1, [settings.get_double('glide-squish')]);
|
||||
shader.set_uniform_float(shader._uTilt, 1, [settings.get_double('glide-tilt')]);
|
||||
shader.set_uniform_float(shader._uShift, 1, [settings.get_double('glide-shift')]);
|
||||
// clang-format on
|
||||
});
|
||||
});
|
||||
@@ -90,6 +92,7 @@ var Glide = class {
|
||||
dialog.bindAdjustment('glide-scale');
|
||||
dialog.bindAdjustment('glide-squish');
|
||||
dialog.bindAdjustment('glide-tilt');
|
||||
dialog.bindAdjustment('glide-shift');
|
||||
|
||||
// Finally, return the new settings page.
|
||||
return dialog.getBuilder().get_object('glide-prefs');
|
||||
|
||||
Reference in New Issue
Block a user