LYGIA Shader Library

bounceOut (lygia/animation/easing/bounceOut)

Bounce out easing. From https://github.com/stackgl/glsl-easings

Dependencies:

Use:

<float> bounceOut(<float> x)

Check it on Github



#ifndef FNC_BOUNCEOUT
#define FNC_BOUNCEOUT
float bounceOut(in float t) {
    const float a = 4.0 / 11.0;
    const float b = 8.0 / 11.0;
    const float c = 9.0 / 10.0;

    const float ca = 4356.0 / 361.0;
    const float cb = 35442.0 / 1805.0;
    const float cc = 16061.0 / 1805.0;

    float t2 = t * t;

    return t < a
        ? 7.5625 * t2
        : t < b
            ? 9.075 * t2 - 9.9 * t + 3.4
            : t < c
                ? ca * t2 - cb * t + cc
                : 10.8 * t * t - 20.52 * t + 10.72;
}
#endif

Use:

<f32> bounceOut(<f32> x)

Check it on Github


fn bounceOut(t: f32) -> f32 {
    let a = 4.0 / 11.0;
    let b = 8.0 / 11.0;
    let c = 9.0 / 10.0;

    let ca = 4356.0 / 361.0;
    let cb = 35442.0 / 1805.0;
    let cc = 16061.0 / 1805.0;

    let t2 = t * t;

    return select(
      select(
        select(
          10.8 * t * t - 20.52 * t + 10.72,
          ca * t2 - cb * t + cc,
          t < c
        ),
        9.075 * t2 - 9.9 * t + 3.4,
        t < b
      ),
      7.5625 * t2,
      t < a
    );
}

Examples

LYGIA is dual-licensed under the Prosperity License and the Patron License for sponsors and contributors.

Sponsors and contributors are automatically added to the Patron License and they can ignore the any non-commercial rule of the Prosperity Licensed software (please take a look to the exception).

It's also possible to get a permanent comercial license hook to a single and specific version of LYGIA.

Get the latest news and releases

Sign up for the news letter bellow, joing the LYGIA's channel on Discord or follow the Github repository