eazy_data/easing/polynomial/
linear.rs

1//! # The Linear Curve.
2//!
3//! An algebric curve of degree one.
4//!
5//! #### formula.
6//!
7//! `p`
8
9use crate::easing::Curve;
10
11/// ### The [`Linear`] Easing Function.
12///
13/// #### examples.
14///
15/// ```
16/// use eazy::Curve;
17/// use eazy::polynomial::linear::Linear;
18///
19/// let p = Linear.y(1.0);
20/// ```
21#[derive(Debug)]
22pub struct Linear;
23
24impl Curve for Linear {
25  #[inline(always)]
26  fn y(&self, p: f32) -> f32 {
27    p
28  }
29}
30
31#[test]
32fn test_linear() {
33  let p = Linear.y(100.0);
34
35  assert_eq!(p, 100.0);
36}