wiki: Add expanding circle example to window-open

This commit is contained in:
Ivan Molodetskikh
2024-05-15 21:24:18 +04:00
parent a39aaa312d
commit 17a71bd424
+16 -1
View File
@@ -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);
}