18 lines
618 B
GLSL
18 lines
618 B
GLSL
#include "../../math/const.glsl"
|
|
|
|
/*
|
|
contributors: Hugh Kennedy (https://github.com/hughsk)
|
|
description: Elastic in/out easing. From https://github.com/stackgl/glsl-easings
|
|
use: elasticInOut(<float> x)
|
|
examples:
|
|
- https://raw.githubusercontent.com/patriciogonzalezvivo/lygia_examples/main/animation_easing.frag
|
|
*/
|
|
|
|
#ifndef FNC_ELASTICINOUT
|
|
#define FNC_ELASTICINOUT
|
|
float elasticInOut(in float t) {
|
|
return t < 0.5
|
|
? 0.5 * sin(+13.0 * HALF_PI * 2.0 * t) * pow(2.0, 10.0 * (2.0 * t - 1.0))
|
|
: 0.5 * sin(-13.0 * HALF_PI * ((2.0 * t - 1.0) + 1.0)) * pow(2.0, -10.0 * (2.0 * t - 1.0)) + 1.0;
|
|
}
|
|
#endif
|