aboutsummaryrefslogtreecommitdiff
path: root/wiki/Configuration:-Animations.md
diff options
context:
space:
mode:
authorIvan Molodetskikh <yalterz@gmail.com>2024-05-12 09:52:21 +0400
committerIvan Molodetskikh <yalterz@gmail.com>2024-05-12 09:52:36 +0400
commit9004c8395438038d69f7b479a8a9035663cb4be0 (patch)
tree349acfc1e9ac7df31bb52db66f7f9e8a59d19e79 /wiki/Configuration:-Animations.md
parent29c7552852874a08f9e70ed52ddfb6be8f55bc69 (diff)
downloadniri-9004c8395438038d69f7b479a8a9035663cb4be0.tar.gz
niri-9004c8395438038d69f7b479a8a9035663cb4be0.tar.bz2
niri-9004c8395438038d69f7b479a8a9035663cb4be0.zip
Implement custom shader for window-close anim
Diffstat (limited to 'wiki/Configuration:-Animations.md')
-rw-r--r--wiki/Configuration:-Animations.md41
1 files changed, 41 insertions, 0 deletions
diff --git a/wiki/Configuration:-Animations.md b/wiki/Configuration:-Animations.md
index f228a5a8..9bc184eb 100644
--- a/wiki/Configuration:-Animations.md
+++ b/wiki/Configuration:-Animations.md
@@ -169,6 +169,47 @@ animations {
}
```
+##### `custom-shader`
+
+<sup>Since: 0.1.6, experimental</sup>
+
+You can write a custom shader for drawing the window during a close animation.
+
+See [this example shader](./examples/close-custom-shader.frag) for a full documentation with several animations to experiment with.
+
+If a custom shader fails to compile, niri will print a warning and fall back to the default, or previous successfully compiled shader.
+
+> [!WARNING]
+>
+> Custom shaders do not have a backwards compatibility guarantee.
+> I may need to change their interface as I'm developing new features.
+
+Example: close will fill the current geometry with a solid gradient that gradually fades away.
+
+```
+animations {
+ window-resize {
+ spring damping-ratio=1.0 stiffness=800 epsilon=0.0001
+
+ custom-shader r"
+ vec4 close_color(vec3 coords_geo, vec3 size_geo) {
+ vec4 color = vec4(0.0);
+
+ if (0.0 <= coords_geo.x && coords_geo.x <= 1.0
+ && 0.0 <= coords_geo.y && coords_geo.y <= 1.0)
+ {
+ vec4 from = vec4(1.0, 0.0, 0.0, 1.0);
+ vec4 to = vec4(0.0, 1.0, 0.0, 1.0);
+ color = mix(from, to, coords_geo.y);
+ }
+
+ return color * (1.0 - niri_clamped_progress);
+ }
+ "
+ }
+}
+```
+
#### `horizontal-view-movement`
All horizontal camera view movement animations, such as: