eazy_data/easing/polynomial/none.rs
1//! # The Constant Curve.
2//!
3//! An algebric curve of degree zero.
4//!
5//! #### formula.
6//!
7//! `p^0`
8
9use crate::easing::Curve;
10
11/// ### The [`None`] Easing Function.
12///
13/// It's used explicitly as a placeholder to informs that an animation is not
14/// currently active. In our case, we define the none constant value to `1`
15/// instead of `minus infinity`.
16///
17/// #### examples.
18///
19/// ```
20/// use eazy::Curve;
21/// use eazy::power::none::None;
22///
23/// let p = None.y(0.0);
24/// ```
25#[derive(Debug)]
26pub struct None;
27
28impl Curve for None {
29 #[inline(always)]
30 fn y(&self, _p: f32) -> f32 {
31 1.0
32 }
33}
34
35#[test]
36fn test_none() {
37 assert!(None.y(0.0) == 1.0);
38 assert!(None.y(0.5) == 1.0);
39 assert!(None.y(1.0) == 1.0);
40}