wiki: Add animations page
Browse files at this commit4d8cb3a6e32fc06ad461a58d257c4f619db703b2Parent: 48b009b3 changed files +155 -73
- resources/default-config.kdl +2 -73
- wiki/Configuration:-Animations.md +152 -0
- wiki/_Sidebar.md +1 -0
resources/default-config.kdlmodified+2 -73
| @@ -223,85 +223,14 @@ hotkey-overlay { | |||
| 223 | } | 223 | } |
| 224 | 224 | ||
| 225 | // Animation settings. | 225 | // Animation settings. |
| 226 | +// The wiki explains how to configure individual animations: | ||
| 227 | +// https://github.com/YaLTeR/niri/wiki/Configuration:-Animations | ||
| 226 | animations { | 228 | animations { |
| 227 | // Uncomment to turn off all animations. | 229 | // Uncomment to turn off all animations. |
| 228 | // off | 230 | // off |
| 229 | 231 | ||
| 230 | // Slow down all animations by this factor. Values below 1 speed them up instead. | 232 | // Slow down all animations by this factor. Values below 1 speed them up instead. |
| 231 | // slowdown 3.0 | 233 | // slowdown 3.0 |
| 232 | - | ||
| 233 | - // You can configure all individual animations. | ||
| 234 | - // Available settings are the same for all of them. | ||
| 235 | - // - off disables the animation. | ||
| 236 | - // | ||
| 237 | - // Niri supports two animation types: easing and spring. | ||
| 238 | - // You can set properties for only ONE of them. | ||
| 239 | - // | ||
| 240 | - // Easing has the following settings: | ||
| 241 | - // - duration-ms sets the duration of the animation in milliseconds. | ||
| 242 | - // - curve sets the easing curve. Currently, available curves | ||
| 243 | - // are "ease-out-cubic" and "ease-out-expo". | ||
| 244 | - // | ||
| 245 | - // Spring animations work better with touchpad gestures, because they | ||
| 246 | - // take into account the velocity of your fingers as you release the swipe. | ||
| 247 | - // The parameters are less obvious and generally should be tuned | ||
| 248 | - // with trial and error. Notably, you cannot directly set the duration. | ||
| 249 | - // You can use this app to help visualize how the spring parameters | ||
| 250 | - // change the animation: https://flathub.org/apps/app.drey.Elastic | ||
| 251 | - // | ||
| 252 | - // A spring animation is configured like this: | ||
| 253 | - // - spring damping-ratio=1.0 stiffness=1000 epsilon=0.0001 | ||
| 254 | - // | ||
| 255 | - // The damping ratio goes from 0.1 to 10.0 and has the following properties: | ||
| 256 | - // - below 1.0: underdamped spring, will oscillate in the end. | ||
| 257 | - // - above 1.0: overdamped spring, won't oscillate. | ||
| 258 | - // - 1.0: critically damped spring, comes to rest in minimum possible time | ||
| 259 | - // without oscillations. | ||
| 260 | - // | ||
| 261 | - // However, even with damping ratio = 1.0 the spring animation may oscillate | ||
| 262 | - // if "launched" with enough velocity from a touchpad swipe. | ||
| 263 | - // | ||
| 264 | - // Lower stiffness will result in a slower animation more prone to oscillation. | ||
| 265 | - // | ||
| 266 | - // Set epsilon to a lower value if the animation "jumps" in the end. | ||
| 267 | - // | ||
| 268 | - // The spring mass is hardcoded to 1.0 and cannot be changed. Instead, change | ||
| 269 | - // stiffness proportionally. E.g. increasing mass by 2x is the same as | ||
| 270 | - // decreasing stiffness by 2x. | ||
| 271 | - | ||
| 272 | - // Animation when switching workspaces up and down, | ||
| 273 | - // including after the touchpad gesture. | ||
| 274 | - workspace-switch { | ||
| 275 | - // off | ||
| 276 | - // spring damping-ratio=1.0 stiffness=1000 epsilon=0.0001 | ||
| 277 | - } | ||
| 278 | - | ||
| 279 | - // All horizontal camera view movement: | ||
| 280 | - // - When a window off-screen is focused and the camera scrolls to it. | ||
| 281 | - // - When a new window appears off-screen and the camera scrolls to it. | ||
| 282 | - // - When a window resizes bigger and the camera scrolls to show it in full. | ||
| 283 | - // - And so on. | ||
| 284 | - horizontal-view-movement { | ||
| 285 | - // off | ||
| 286 | - // spring damping-ratio=1.0 stiffness=800 epsilon=0.0001 | ||
| 287 | - } | ||
| 288 | - | ||
| 289 | - // Window opening animation. Note that this one has different defaults. | ||
| 290 | - window-open { | ||
| 291 | - // off | ||
| 292 | - // duration-ms 150 | ||
| 293 | - // curve "ease-out-expo" | ||
| 294 | - | ||
| 295 | - // Example for a slightly bouncy window opening: | ||
| 296 | - // spring damping-ratio=0.8 stiffness=1000 epsilon=0.0001 | ||
| 297 | - } | ||
| 298 | - | ||
| 299 | - // Config parse error and new default config creation notification | ||
| 300 | - // open/close animation. | ||
| 301 | - config-notification-open-close { | ||
| 302 | - // off | ||
| 303 | - // spring damping-ratio=0.6 stiffness=1000 epsilon=0.001 | ||
| 304 | - } | ||
| 305 | } | 234 | } |
| 306 | 235 | ||
| 307 | // Window rules let you adjust behavior for individual windows. | 236 | // Window rules let you adjust behavior for individual windows. |
wiki/Configuration:-Animations.mdadded+152 -0
| @@ -0,0 +1,152 @@ | |||
| 1 | +### Overview | ||
| 2 | + | ||
| 3 | +Niri has several animations which you can configure in the same way. | ||
| 4 | +Additionally, you can disable or slow down all animations at once. | ||
| 5 | + | ||
| 6 | +Here's a quick glance at the available animations with their default values. | ||
| 7 | + | ||
| 8 | +``` | ||
| 9 | +animations { | ||
| 10 | + // Uncomment to turn off all animations. | ||
| 11 | + // You can also put "off" into each individual animation to disable it. | ||
| 12 | + // off | ||
| 13 | + | ||
| 14 | + // Slow down all animations by this factor. Values below 1 speed them up instead. | ||
| 15 | + // slowdown 3.0 | ||
| 16 | + | ||
| 17 | + // Individual animations. | ||
| 18 | + | ||
| 19 | + workspace-switch { | ||
| 20 | + spring damping-ratio=1.0 stiffness=1000 epsilon=0.0001 | ||
| 21 | + } | ||
| 22 | + | ||
| 23 | + horizontal-view-movement { | ||
| 24 | + spring damping-ratio=1.0 stiffness=800 epsilon=0.0001 | ||
| 25 | + } | ||
| 26 | + | ||
| 27 | + window-open { | ||
| 28 | + duration-ms 150 | ||
| 29 | + curve "ease-out-expo" | ||
| 30 | + } | ||
| 31 | + | ||
| 32 | + config-notification-open-close { | ||
| 33 | + spring damping-ratio=0.6 stiffness=1000 epsilon=0.001 | ||
| 34 | + } | ||
| 35 | +} | ||
| 36 | +``` | ||
| 37 | + | ||
| 38 | +### Animation Types | ||
| 39 | + | ||
| 40 | +There are two animation types: easing and spring. | ||
| 41 | +Each animation can be either an easing or a spring. | ||
| 42 | + | ||
| 43 | +#### Easing | ||
| 44 | + | ||
| 45 | +This is a common animation type that changes the value over a set duration using a Bézier curve. | ||
| 46 | + | ||
| 47 | +To use this animation, set the following parameters: | ||
| 48 | + | ||
| 49 | +- `duration-ms`: duration of the animation in milliseconds. | ||
| 50 | +- `curve`: the easing curve to use. | ||
| 51 | + | ||
| 52 | +Currently, niri only supports two curves: `ease-out-cubic` and `ease-out-expo`. | ||
| 53 | +You can get a feel for them on pages like [easings.net](https://easings.net/). | ||
| 54 | + | ||
| 55 | +#### Spring | ||
| 56 | + | ||
| 57 | +Spring animations use a model of a physical spring to animate the value. | ||
| 58 | +They notably feel better with touchpad gestures, because they take into account the velocity of your fingers as you release the swipe. | ||
| 59 | +Springs can also oscillate / bounce at the end with the right parameters if you like that sort of thing, but they don't have to (and by default they mostly don't). | ||
| 60 | + | ||
| 61 | +Due to springs using a physical model, the animation parameters are less obvious and generally should be tuned with trial and error. | ||
| 62 | +Notably, you cannot directly set the duration. | ||
| 63 | +You can use the [Elastic](https://flathub.org/apps/app.drey.Elastic) app to help visualize how the spring parameters change the animation. | ||
| 64 | + | ||
| 65 | +A spring animation is configured like this, with three mandatory parameters: | ||
| 66 | + | ||
| 67 | +``` | ||
| 68 | +animations { | ||
| 69 | + workspace-switch { | ||
| 70 | + spring damping-ratio=1.0 stiffness=1000 epsilon=0.0001 | ||
| 71 | + } | ||
| 72 | +} | ||
| 73 | +``` | ||
| 74 | + | ||
| 75 | +The `damping-ratio` goes from 0.1 to 10.0 and has the following properties: | ||
| 76 | + | ||
| 77 | +- below 1.0: underdamped spring, will oscillate in the end. | ||
| 78 | +- above 1.0: overdamped spring, won't oscillate. | ||
| 79 | +- 1.0: critically damped spring, comes to rest in minimum possible time without oscillations. | ||
| 80 | + | ||
| 81 | +However, even with damping ratio = 1.0, the spring animation may oscillate if "launched" with enough velocity from a touchpad swipe. | ||
| 82 | + | ||
| 83 | +Lower `stiffness` will result in a slower animation more prone to oscillation. | ||
| 84 | + | ||
| 85 | +Set `epsilon` to a lower value if the animation "jumps" at the end. | ||
| 86 | + | ||
| 87 | +> [!TIP] | ||
| 88 | +> The spring *mass* (which you can see in Elastic) is hardcoded to 1.0 and cannot be changed. | ||
| 89 | +> Instead, change `stiffness` proportionally. | ||
| 90 | +> E.g. increasing mass by 2× is the same as decreasing stiffness by 2×. | ||
| 91 | + | ||
| 92 | +### Animations | ||
| 93 | + | ||
| 94 | +Now let's go into more detail on the animations that you can configure. | ||
| 95 | + | ||
| 96 | +#### `workspace-switch` | ||
| 97 | + | ||
| 98 | +Animation when switching workspaces up and down, including after the vertical touchpad gesture (a spring is recommended). | ||
| 99 | + | ||
| 100 | +``` | ||
| 101 | +animations { | ||
| 102 | + workspace-switch { | ||
| 103 | + spring damping-ratio=1.0 stiffness=1000 epsilon=0.0001 | ||
| 104 | + } | ||
| 105 | +} | ||
| 106 | +``` | ||
| 107 | + | ||
| 108 | +#### `horizontal-view-movement` | ||
| 109 | + | ||
| 110 | +All horizontal camera view movement animations, such as: | ||
| 111 | + | ||
| 112 | +- When a window off-screen is focused and the camera scrolls to it. | ||
| 113 | +- When a new window appears off-screen and the camera scrolls to it. | ||
| 114 | +- When a window resizes bigger and the camera scrolls to show it in full. | ||
| 115 | +- After a horizontal touchpad gesture (a spring is recommended). | ||
| 116 | + | ||
| 117 | +``` | ||
| 118 | +animations { | ||
| 119 | + horizontal-view-movement { | ||
| 120 | + spring damping-ratio=1.0 stiffness=800 epsilon=0.0001 | ||
| 121 | + } | ||
| 122 | +} | ||
| 123 | +``` | ||
| 124 | + | ||
| 125 | +#### `window-open` | ||
| 126 | + | ||
| 127 | +Window opening animation. | ||
| 128 | + | ||
| 129 | +This one uses an easing type by default. | ||
| 130 | + | ||
| 131 | +``` | ||
| 132 | +animations { | ||
| 133 | + window-open { | ||
| 134 | + duration-ms 150 | ||
| 135 | + curve "ease-out-expo" | ||
| 136 | + } | ||
| 137 | +} | ||
| 138 | +``` | ||
| 139 | + | ||
| 140 | +#### `config-notification-open-close` | ||
| 141 | + | ||
| 142 | +The open/close animation of the config parse error and new default config notifications. | ||
| 143 | + | ||
| 144 | +This one uses an underdamped spring by default (`damping-ratio=0.6`) which causes a slight oscillation in the end. | ||
| 145 | + | ||
| 146 | +``` | ||
| 147 | +animations { | ||
| 148 | + config-notification-open-close { | ||
| 149 | + spring damping-ratio=0.6 stiffness=1000 epsilon=0.001 | ||
| 150 | + } | ||
| 151 | +} | ||
| 152 | +``` | ||
wiki/_Sidebar.mdmodified+1 -0
| @@ -9,6 +9,7 @@ | |||
| 9 | * [Overview](./Configuration:-Overview.md) | 9 | * [Overview](./Configuration:-Overview.md) |
| 10 | * [Input](./Configuration:-Input.md) | 10 | * [Input](./Configuration:-Input.md) |
| 11 | * [Window Rules](./Configuration:-Window-Rules.md) | 11 | * [Window Rules](./Configuration:-Window-Rules.md) |
| 12 | +* [Animations](./Configuration:-Animations.md) | ||
| 12 | 13 | ||
| 13 | ## Development | 14 | ## Development |
| 14 | * [Design Principles](./Design-Principles.md) | 15 | * [Design Principles](./Design-Principles.md) |