Skip to main content

sampled

Function sampled 

Source
pub fn sampled(
    function: impl Fn(f64) -> f64,
    tolerance: f64,
    max_points: usize,
) -> Easing
Expand description

function, which runs from 0 at 0 to 1 at 1, as a points easing: straight lines within tolerance of it at the quarter points of every piece, through at most max_points points (and at most MAX_EASING_POINTS).

The piece furthest from the function is halved, the earliest on a tie, until every piece is within tolerance or narrower than 1/65536, or the points run out. The order is fixed and every point’s x is a dyadic fraction, so the table is the same wherever function gives the same values.