Files

119 lines
3.9 KiB
KDL

animations {
workspace-switch {
spring damping-ratio=0.80 stiffness=523 epsilon=0.0001
}
window-open {
duration-ms 400
curve "ease-out-expo"
custom-shader r"
vec4 door_rise(vec3 coords_geo, vec3 size_geo) {
float progress = niri_clamped_progress;
// Tilt from 90 degrees (flat) to 0 degrees (upright)
float tilt = (1.0 - progress) * 1.57079632;
// Pivot point at bottom edge
vec2 coords = coords_geo.xy * size_geo.xy;
coords.y = size_geo.y - coords.y;
// Distance from pivot (bottom edge)
float dist_from_pivot = coords.y;
// Calculate 3D position
// Negative z_offset so it goes away from viewer (backward)
float z_offset = -dist_from_pivot * sin(tilt);
float y_compressed = dist_from_pivot * cos(tilt);
// Apply perspective based on depth
float perspective = 600.0;
float perspective_scale = perspective / (perspective + z_offset);
// Scale everything by perspective
coords.x = (coords.x - size_geo.x * 0.5) * perspective_scale + size_geo.x * 0.5;
coords.y = y_compressed * perspective_scale;
// Flip Y back to normal coordinates
coords.y = size_geo.y - coords.y;
coords_geo = vec3(coords / size_geo.xy, 1.0);
vec3 coords_tex = niri_geo_to_tex * coords_geo;
vec4 color = texture2D(niri_tex, coords_tex.st);
// Brighten as it rises
float brightness = 0.4 + 0.6 * progress;
color.rgb *= brightness;
return color * progress;
}
vec4 open_color(vec3 coords_geo, vec3 size_geo) {
return door_rise(coords_geo, size_geo);
}"
}
window-close {
duration-ms 400
curve "ease-out-expo"
custom-shader r"
vec4 bob_and_slide(vec3 coords_geo, vec3 size_geo) {
float progress = niri_clamped_progress;
float y_offset = 0.0;
// Bob phase (0.0 to 0.25) - goes up then back to 0
if (progress < 0.25) {
float t = progress / 0.25;
// Parabola: goes up to peak at t=0.5, back down to 0 at t=1.0
y_offset = -40.0 * (1.0 - 4.0 * (t - 0.5) * (t - 0.5));
}
// Slide phase (0.25 to 1.0) - slides down
else {
float slide_progress = (progress - 0.25) / 0.75;
y_offset = -slide_progress * (size_geo.y + 100.0);
}
// Apply transformation
vec2 coords = coords_geo.xy * size_geo.xy;
coords.y = coords.y + y_offset;
coords_geo = vec3(coords / size_geo.xy, 1.0);
vec3 coords_tex = niri_geo_to_tex * coords_geo;
vec4 color = texture2D(niri_tex, coords_tex.st);
return color;
}
vec4 close_color(vec3 coords_geo, vec3 size_geo) {
return bob_and_slide(coords_geo, size_geo);
}"
}
horizontal-view-movement {
spring damping-ratio=0.65 stiffness=423 epsilon=0.0001
}
window-movement {
spring damping-ratio=0.65 stiffness=300 epsilon=0.0001
}
window-resize {
custom-shader r"
vec4 resize_color(vec3 coords_curr_geo, vec3 size_curr_geo) {
vec3 coords_tex_next = niri_geo_to_tex_next * coords_curr_geo;
vec4 color = texture2D(niri_tex_next, coords_tex_next.st);
return color;
}
"
}
config-notification-open-close {
spring damping-ratio=0.65 stiffness=923 epsilon=0.001
}
screenshot-ui-open {
duration-ms 200
curve "ease-out-quad"
}
overview-open-close {
spring damping-ratio=0.85 stiffness=800 epsilon=0.0001
}
}