forge
Explore
Log in

Don't you dare go Hollow

Add ease-out-quad curve

Browse files at this commit

209492e7005bd9e58b216ff7f3a0ea39670f3a5dIvan MolodetskikhParent: 7e0d3d3
niri-config/src/lib.rsmodified+1 -0
@@ -611,6 +611,7 @@ impl EasingParams {
611611
612612 #[derive(knuffel::DecodeScalar, Debug, Clone, Copy, PartialEq)]
613613 pub enum AnimationCurve {
614+ EaseOutQuad,
614615 EaseOutCubic,
615616 EaseOutExpo,
616617 }
src/animation/mod.rsmodified+4 -1
@@ -1,6 +1,6 @@
11 use std::time::Duration;
22
3-use keyframe::functions::EaseOutCubic;
3+use keyframe::functions::{EaseOutCubic, EaseOutQuad};
44 use keyframe::EasingFunction;
55 use portable_atomic::{AtomicF64, Ordering};
66
@@ -35,6 +35,7 @@ enum Kind {
3535
3636 #[derive(Debug, Clone, Copy)]
3737 pub enum Curve {
38+ EaseOutQuad,
3839 EaseOutCubic,
3940 EaseOutExpo,
4041 }
@@ -276,6 +277,7 @@ impl Animation {
276277 impl Curve {
277278 pub fn y(self, x: f64) -> f64 {
278279 match self {
280+ Curve::EaseOutQuad => EaseOutQuad.y(x),
279281 Curve::EaseOutCubic => EaseOutCubic.y(x),
280282 Curve::EaseOutExpo => 1. - 2f64.powf(-10. * x),
281283 }
@@ -285,6 +287,7 @@ impl Curve {
285287 impl From<niri_config::AnimationCurve> for Curve {
286288 fn from(value: niri_config::AnimationCurve) -> Self {
287289 match value {
290+ niri_config::AnimationCurve::EaseOutQuad => Curve::EaseOutQuad,
288291 niri_config::AnimationCurve::EaseOutCubic => Curve::EaseOutCubic,
289292 niri_config::AnimationCurve::EaseOutExpo => Curve::EaseOutExpo,
290293 }
wiki/Configuration:-Animations.mdmodified+6 -1
@@ -62,7 +62,12 @@ animations {
6262 }
6363 ```
6464
65-Currently, niri only supports two curves: `ease-out-cubic` and `ease-out-expo`.
65+Currently, niri only supports three curves:
66+
67+- `ease-out-quad` <sup>Since: 0.1.5</sup>
68+- `ease-out-cubic`
69+- `ease-out-expo`
70+
6671 You can get a feel for them on pages like [easings.net](https://easings.net/).
6772
6873 #### Spring