Skip to content

Instantly share code, notes, and snippets.

View alexr4's full-sized avatar

Alexandre Rivaux alexr4

View GitHub Profile
@alexr4
alexr4 / argbToInt.java
Last active April 2, 2020 06:57
ARGB to int conversion
int argbToInt(argb[]){
if (argb[3] > 255) argb[3] = 255; else if (argb[3] < 0) argb[3] = 0;
if (argb[0] > 255) argb[0] = 255; else if (argb[0] < 0) argb[0] = 0;
if (argb[1] > 255) argb[1] = 255; else if (argb[1] < 0) argb[1] = 0;
if (argb[2] > 255) argb[2] = 255; else if (argb[2] < 0) argb[2] = 0;
return ((int)rgb[3] << 24) | ((int)rgb[0] << 16) | ((int)rgb[1] << 8) | (int)rgb[2];
}
@alexr4
alexr4 / easing.glsl
Last active November 15, 2021 19:21
Basic easing functions ported to GLSL (Quad, Cubic, Quartic, Quintic, Sin, Exp, Circ and Elastic)
/*Note : the value passed as parameter to the functions is the normalized time of the animation
*/
/* QUAD */
float inQuad(in float value)
{
return clamp(1.0 * value * value, 0, 1);
}
float outQuad(in float value)