aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIvan Molodetskikh <yalterz@gmail.com>2024-05-15 21:24:18 +0400
committerIvan Molodetskikh <yalterz@gmail.com>2024-05-15 21:24:18 +0400
commit17a71bd4245b0231103d6dad70294b927c22406c (patch)
tree5bade73a8d203e99d8cc1347ce54497ec0c94500
parenta39aaa312dbdafe6ca2e2c6806140374104e483b (diff)
downloadniri-17a71bd4245b0231103d6dad70294b927c22406c.tar.gz
niri-17a71bd4245b0231103d6dad70294b927c22406c.tar.bz2
niri-17a71bd4245b0231103d6dad70294b927c22406c.zip
wiki: Add expanding circle example to window-open
-rw-r--r--wiki/examples/open_custom_shader.frag17
1 files changed, 16 insertions, 1 deletions
diff --git a/wiki/examples/open_custom_shader.frag b/wiki/examples/open_custom_shader.frag
index d5d39cdb..0b3c8af9 100644
--- a/wiki/examples/open_custom_shader.frag
+++ b/wiki/examples/open_custom_shader.frag
@@ -105,9 +105,24 @@ vec4 default_open(vec3 coords_geo, vec3 size_geo) {
return color;
}
+// Example: show the window as an expanding circle.
+// Recommended setting: duration-ms 250
+vec4 expanding_circle(vec3 coords_geo, vec3 size_geo) {
+ vec3 coords_tex = niri_geo_to_tex * coords_geo;
+ vec4 color = texture2D(niri_tex, coords_tex.st);
+
+ vec2 coords = (coords_geo.xy - vec2(0.5, 0.5)) * size_geo.xy * 2.0;
+ coords = coords / length(size_geo.xy);
+ float p = niri_clamped_progress;
+ if (p * p <= dot(coords, coords))
+ color = vec4(0.0);
+
+ return color;
+}
+
// This is the function that you must define.
vec4 open_color(vec3 coords_geo, vec3 size_geo) {
// You can pick one of the example functions or write your own.
- return solid_gradient(coords_geo, size_geo);
+ return expanding_circle(coords_geo, size_geo);
}