fuckingtech/public/assets/glsl/lygia/animation/easing/elasticInOut.glsl
Elias Rhouzlane bf76c6b086 fix: code
2025-04-06 17:23:52 +02:00

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