// ─────────────────────────────────────────────────────────────────────────────
// modules/animations.kdl — Niri animation settings (CyberQueer profile)
//
// PURPOSE: Defines easing/spring curves for every animated transition in niri:
//          window open/close/move, workspace switching, and UI overlays.
//
// SPRING PHYSICS MODEL: niri uses a physically-based damped spring rather than
//   a fixed-duration curve. Three parameters control it:
//
//   damping-ratio  — how quickly oscillation decays after the spring overshoots.
//                    1.0 = critically damped (no bounce, fastest settle).
//                    <1.0 = underdamped (bouncy). >1.0 = overdamped (sluggish).
//   stiffness      — spring constant; how hard the spring pulls toward the target.
//                    Higher = snappier motion; lower = floaty/elastic.
//   epsilon        — the displacement threshold below which animation stops.
//                    Smaller = more precise end position (negligible CPU cost).
// ─────────────────────────────────────────────────────────────────────────────

animations {

    // window-open: played when a new window first appears on screen.
    // damping-ratio=0.9: very slightly underdamped — tiny implicit "settle"
    //   without a visible bounce, making the open feel snappy and alive.
    // stiffness=800: high stiffness keeps the open fast (< ~120ms perceived).
    // epsilon=0.0001: stops at 0.01% residual — visually at rest immediately.
    window-open {
        spring damping-ratio=0.9 stiffness=800 epsilon=0.0001
    }

    // window-close: played when a window is destroyed/hidden.
    // Mirrors window-open so open and close feel symmetric.
    window-close {
        spring damping-ratio=0.9 stiffness=800 epsilon=0.0001
    }

    // window-movement: played when a window or column is repositioned within
    // the scrollable layout (e.g. Mod+Shift+H/L, consume/expel into column).
    window-movement {
        spring damping-ratio=0.9 stiffness=800 epsilon=0.0001
    }

    // horizontal-view-movement: played when the viewport scrolls horizontally
    // to follow the focused column.  This is the signature "infinite rail"
    // feel that distinguishes niri from traditional tiling compositors.
    horizontal-view-movement {
        spring damping-ratio=0.9 stiffness=800 epsilon=0.0001
    }

    // workspace-switch: played when switching between vertical workspaces
    // (Mod+Ctrl+J/K, Mod+1–0).  Consistent spring keeps it feeling cohesive.
    workspace-switch {
        spring damping-ratio=0.9 stiffness=800 epsilon=0.0001
    }

    // config-notification-open-close: the small "Configuration reloaded" toast
    // shown after a hot-reload.  Same spring for a unified UI feel.
    config-notification-open-close {
        spring damping-ratio=0.9 stiffness=800 epsilon=0.0001
    }

    // screenshot-ui-open: the interactive region-selection overlay.
    // WHY different curve: this is a modal overlay, not a layout element.
    //   A fixed-duration ease-out-cubic gives a crisp "snap into place" feel
    //   that communicates "you are now in screenshot mode" more clearly than a
    //   spring would.
    // duration-ms 200: fast enough not to interrupt workflow.
    // curve "ease-out-cubic": starts fast, decelerates smoothly to rest.
    screenshot-ui-open {
        duration-ms 200
        curve "ease-out-cubic"
    }
}
