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 {
611 611
612 #[derive(knuffel::DecodeScalar, Debug, Clone, Copy, PartialEq)]612 #[derive(knuffel::DecodeScalar, Debug, Clone, Copy, PartialEq)]
613 pub enum AnimationCurve {613 pub enum AnimationCurve {
614+ EaseOutQuad,
614 EaseOutCubic,615 EaseOutCubic,
615 EaseOutExpo,616 EaseOutExpo,
616 }617 }
src/animation/mod.rsmodified+4 -1
@@ -1,6 +1,6 @@
1 use std::time::Duration;1 use std::time::Duration;
2 2
3-use keyframe::functions::EaseOutCubic;3+use keyframe::functions::{EaseOutCubic, EaseOutQuad};
4 use keyframe::EasingFunction;4 use keyframe::EasingFunction;
5 use portable_atomic::{AtomicF64, Ordering};5 use portable_atomic::{AtomicF64, Ordering};
6 6
@@ -35,6 +35,7 @@ enum Kind {
35 35
36 #[derive(Debug, Clone, Copy)]36 #[derive(Debug, Clone, Copy)]
37 pub enum Curve {37 pub enum Curve {
38+ EaseOutQuad,
38 EaseOutCubic,39 EaseOutCubic,
39 EaseOutExpo,40 EaseOutExpo,
40 }41 }
@@ -276,6 +277,7 @@ impl Animation {
276 impl Curve {277 impl Curve {
277 pub fn y(self, x: f64) -> f64 {278 pub fn y(self, x: f64) -> f64 {
278 match self {279 match self {
280+ Curve::EaseOutQuad => EaseOutQuad.y(x),
279 Curve::EaseOutCubic => EaseOutCubic.y(x),281 Curve::EaseOutCubic => EaseOutCubic.y(x),
280 Curve::EaseOutExpo => 1. - 2f64.powf(-10. * x),282 Curve::EaseOutExpo => 1. - 2f64.powf(-10. * x),
281 }283 }
@@ -285,6 +287,7 @@ impl Curve {
285 impl From<niri_config::AnimationCurve> for Curve {287 impl From<niri_config::AnimationCurve> for Curve {
286 fn from(value: niri_config::AnimationCurve) -> Self {288 fn from(value: niri_config::AnimationCurve) -> Self {
287 match value {289 match value {
290+ niri_config::AnimationCurve::EaseOutQuad => Curve::EaseOutQuad,
288 niri_config::AnimationCurve::EaseOutCubic => Curve::EaseOutCubic,291 niri_config::AnimationCurve::EaseOutCubic => Curve::EaseOutCubic,
289 niri_config::AnimationCurve::EaseOutExpo => Curve::EaseOutExpo,292 niri_config::AnimationCurve::EaseOutExpo => Curve::EaseOutExpo,
290 }293 }
wiki/Configuration:-Animations.mdmodified+6 -1
@@ -62,7 +62,12 @@ animations {
62 }62 }
63 ```63 ```
64 64
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+
66 You can get a feel for them on pages like [easings.net](https://easings.net/).71 You can get a feel for them on pages like [easings.net](https://easings.net/).
67 72
68 #### Spring73 #### Spring