forge
Explore
Log in

Don't you dare go Hollow

Add linear animation curve

Browse files at this commit

29c7552852874a08f9e70ed52ddfb6be8f55bc69Ivan MolodetskikhParent: d2ed42a
niri-config/src/lib.rsmodified+1 -0
@@ -657,6 +657,7 @@ pub struct EasingParams {
657 657
658 #[derive(knuffel::DecodeScalar, Debug, Clone, Copy, PartialEq)]658 #[derive(knuffel::DecodeScalar, Debug, Clone, Copy, PartialEq)]
659 pub enum AnimationCurve {659 pub enum AnimationCurve {
660+ Linear,
660 EaseOutQuad,661 EaseOutQuad,
661 EaseOutCubic,662 EaseOutCubic,
662 EaseOutExpo,663 EaseOutExpo,
src/animation/mod.rsmodified+3 -0
@@ -41,6 +41,7 @@ enum Kind {
41 41
42 #[derive(Debug, Clone, Copy)]42 #[derive(Debug, Clone, Copy)]
43 pub enum Curve {43 pub enum Curve {
44+ Linear,
44 EaseOutQuad,45 EaseOutQuad,
45 EaseOutCubic,46 EaseOutCubic,
46 EaseOutExpo,47 EaseOutExpo,
@@ -358,6 +359,7 @@ impl Animation {
358 impl Curve {359 impl Curve {
359 pub fn y(self, x: f64) -> f64 {360 pub fn y(self, x: f64) -> f64 {
360 match self {361 match self {
362+ Curve::Linear => x,
361 Curve::EaseOutQuad => EaseOutQuad.y(x),363 Curve::EaseOutQuad => EaseOutQuad.y(x),
362 Curve::EaseOutCubic => EaseOutCubic.y(x),364 Curve::EaseOutCubic => EaseOutCubic.y(x),
363 Curve::EaseOutExpo => 1. - 2f64.powf(-10. * x),365 Curve::EaseOutExpo => 1. - 2f64.powf(-10. * x),
@@ -368,6 +370,7 @@ impl Curve {
368 impl From<niri_config::AnimationCurve> for Curve {370 impl From<niri_config::AnimationCurve> for Curve {
369 fn from(value: niri_config::AnimationCurve) -> Self {371 fn from(value: niri_config::AnimationCurve) -> Self {
370 match value {372 match value {
373+ niri_config::AnimationCurve::Linear => Curve::Linear,
371 niri_config::AnimationCurve::EaseOutQuad => Curve::EaseOutQuad,374 niri_config::AnimationCurve::EaseOutQuad => Curve::EaseOutQuad,
372 niri_config::AnimationCurve::EaseOutCubic => Curve::EaseOutCubic,375 niri_config::AnimationCurve::EaseOutCubic => Curve::EaseOutCubic,
373 niri_config::AnimationCurve::EaseOutExpo => Curve::EaseOutExpo,376 niri_config::AnimationCurve::EaseOutExpo => Curve::EaseOutExpo,
wiki/Configuration:-Animations.mdmodified+2 -1
@@ -71,11 +71,12 @@ animations {
71 }71 }
72 ```72 ```
73 73
74-Currently, niri only supports three curves:74+Currently, niri only supports four curves:
75 75
76 - `ease-out-quad` <sup>Since: 0.1.5</sup>76 - `ease-out-quad` <sup>Since: 0.1.5</sup>
77 - `ease-out-cubic`77 - `ease-out-cubic`
78 - `ease-out-expo`78 - `ease-out-expo`
79+- `linear` <sup>Since: 0.1.6</sup>
79 80
80 You can get a feel for them on pages like [easings.net](https://easings.net/).81 You can get a feel for them on pages like [easings.net](https://easings.net/).
81 82