diff options
| -rw-r--r-- | wiki/examples/open_custom_shader.frag | 17 |
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); } |
