diff --git a/.travis.yml b/.travis.yml index 3701d1c..ee292cb 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,6 +2,7 @@ language: rust rust: - nightly + - beta - stable os: @@ -11,4 +12,5 @@ os: script: - cargo build --verbose - cargo test --verbose + - cargo test --features="serde_serialization" --verbose - cargo doc --verbose diff --git a/Cargo.toml b/Cargo.toml index d43b11e..0032750 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "envelope" description = "An interpolatable Envelope trait along with a generic 2D Point trait. Useful for controlling parameters over time." -version = "0.8.0" +version = "0.8.1" authors = ["mitchmindtree "] readme = "README.md" keywords = ["interpolate", "dsp", "audio", "time", "2D"] diff --git a/src/interpolate.rs b/src/interpolate.rs index 031abd4..d0aa97e 100644 --- a/src/interpolate.rs +++ b/src/interpolate.rs @@ -77,6 +77,14 @@ pub fn ease

(x: P::X, start: &P, end: &P, ease_fn: EaseFunction) -> P::Y } +/// Get bezier point for bezier curve. +#[inline] +fn bezier_pt(n1: T, n2: T, perc: T) -> T + where T: Scalar +{ + (n2 - n1.clone()) * perc + n1 +} + /// Interpolate between the given start and end points given some bezier curve. #[inline] pub fn bezier

(x: P::X, start: &P, end: &P, curve: ::Scalar) -> P::Y @@ -85,15 +93,6 @@ pub fn bezier

(x: P::X, start: &P, end: &P, curve: ::Scalar) ::Scalar: Scalar + NumCast, { maybe_exact_point(&x, start, end).unwrap_or_else(|| { - - /// Get bezier point for bezier curve. - #[inline] - fn bezier_pt(n1: T, n2: T, perc: T) -> T - where T: Scalar - { - (n2 - n1.clone()) * perc + n1 - } - let x = P::x_to_scalar(x.clone()); let start_x = P::x_to_scalar(start.x()); let end_x = P::x_to_scalar(end.x());