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 {
657657
658658 #[derive(knuffel::DecodeScalar, Debug, Clone, Copy, PartialEq)]
659659 pub enum AnimationCurve {
660+ Linear,
660661 EaseOutQuad,
661662 EaseOutCubic,
662663 EaseOutExpo,
src/animation/mod.rsmodified+3 -0
@@ -41,6 +41,7 @@ enum Kind {
4141
4242 #[derive(Debug, Clone, Copy)]
4343 pub enum Curve {
44+ Linear,
4445 EaseOutQuad,
4546 EaseOutCubic,
4647 EaseOutExpo,
@@ -358,6 +359,7 @@ impl Animation {
358359 impl Curve {
359360 pub fn y(self, x: f64) -> f64 {
360361 match self {
362+ Curve::Linear => x,
361363 Curve::EaseOutQuad => EaseOutQuad.y(x),
362364 Curve::EaseOutCubic => EaseOutCubic.y(x),
363365 Curve::EaseOutExpo => 1. - 2f64.powf(-10. * x),
@@ -368,6 +370,7 @@ impl Curve {
368370 impl From<niri_config::AnimationCurve> for Curve {
369371 fn from(value: niri_config::AnimationCurve) -> Self {
370372 match value {
373+ niri_config::AnimationCurve::Linear => Curve::Linear,
371374 niri_config::AnimationCurve::EaseOutQuad => Curve::EaseOutQuad,
372375 niri_config::AnimationCurve::EaseOutCubic => Curve::EaseOutCubic,
373376 niri_config::AnimationCurve::EaseOutExpo => Curve::EaseOutExpo,
wiki/Configuration:-Animations.mdmodified+2 -1
@@ -71,11 +71,12 @@ animations {
7171 }
7272 ```
7373
74-Currently, niri only supports three curves:
74+Currently, niri only supports four curves:
7575
7676 - `ease-out-quad` <sup>Since: 0.1.5</sup>
7777 - `ease-out-cubic`
7878 - `ease-out-expo`
79+- `linear` <sup>Since: 0.1.6</sup>
7980
8081 You can get a feel for them on pages like [easings.net](https://easings.net/).
8182