1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
//! Scalar easing curves.
//!
//! Each function mirrors a counterpart in culori 4.0.2's `src/easing/` and
//! `src/interpolate/` modules. Curve factories return a closure
//! `Fn(f64) -> f64`; constant-curve helpers return the same shape so the
//! call sites compose uniformly.
//!
//! ```rust
//! use culors::easing_smoothstep;
//! let s = easing_smoothstep();
//! assert!((s(0.5) - 0.5).abs() < 1e-12);
//! ```
/// Color-interpolation hint exponential. Matches culori's `midpoint(H)`:
///
/// ```js
/// const midpoint = (H = 0.5) => t =>
/// H <= 0 ? 1 : H >= 1 ? 0 : Math.pow(t, Math.log(0.5) / Math.log(H));
/// ```
///
/// `H` is the parameter value at which the curve passes through `0.5`. The
/// degenerate cases `H <= 0` and `H >= 1` collapse to the constants `1` and
/// `0` respectively, identical to culori.
/// Cubic smoothstep `t * t * (3 - 2 * t)`.
/// Inverse of [`easing_smoothstep`]: `0.5 - sin(asin(1 - 2t) / 3)`.
/// Quintic smootherstep proposed by K. Perlin:
/// `t^3 * (t * (t * 6 - 15) + 10)`.
/// Sinusoidal in-out easing: `(1 - cos(t * π)) / 2`.
/// Power curve `t^γ`. With `γ == 1` returns the identity (matching culori,
/// which short-circuits the `Math.pow` call to avoid unneeded denorm work).