comment 0

Approximate normal distribution, bias and ease

This is faster than a ramp and it is quite predictable, and the ends are smooth:

@P.y = 4 * smooth(0, 1, @P.x) * smooth(0, 1, 1-@P.x);

Also you may shape it further with ease and bias functions, ends are still smooth:

void distort_bias(float dimension, bias) 
{
    if (dimension <= 0) dimension = 0; else if (dimension >= 1)
        dimension = 1;
    else
        dimension = (1-bias) / (((1.0 / dimension) - 2) * (bias) + 1);
}
float distort_bias(float dimension, bias) 
{
    float eval;
    if (dimension <= 0) eval = 0; else if (dimension >= 1)
        eval = 1;
    else
        eval = (1-bias) / (((1.0 / dimension) - 2) * (bias) + 1);
    return eval;
}
void distort_ease(float dimension, ease) 
{
    if(dimension<0.5)
        dimension = distort_bias(dimension*2,ease)/2;
    else
        dimension = 1 - distort_bias((1-dimension)*2,ease)/2;
}

Leave a Reply