torcurve

Function torcurve 

Source
pub fn torcurve(x: f64, a: f64, b: f64, c: f64) -> f64
Expand description

a generalized, parameterized curve formula for generating lots of different curve shapes useful for easing, etc.

§Arguments

  • x - input that drives the curve. clamped to 0..=1
  • a - controls the start of the curve
  • b - controls the middle of the curve
  • c - pinches the tail of the curve

§Example

use torcurve_rs::torcurve;
fn run_code() {
    for i in 0..=10 {
         println!("curve {}", torcurve(i as f64 * 0.1, 3.0, 0.0, 0.0));
    }
}

note: implemented using https://jsfiddle.net/torcado194/5ocmt48a/latest as reference, the js fiddle may be useful to tune the parameters