public static int interpolate( float p, int... colors ) { if (p <= 0) { return colors[0]; } else if (p >= 1) { return colors[colors.length-1]; } int segment = (int)((colors.length-1) * p); return interpolate( colors[segment], colors[segment+1], (p * (colors.length - 1)) % 1 ); }
public static int interpolate( float p, int... colors ) { if (p <= 0) { return colors[0]; } else if (p >= 1) { return colors[colors.length-1]; } int segment = (int)(colors.length * p); return interpolate( colors[segment], colors[segment+1], (p * (colors.length - 1)) % 1 ); }
public static int interpolate( float p, int... colors ) { if (p <= 0) { return colors[0]; } else if (p >= 1) { return colors[colors.length-1]; } int segment = (int)((colors.length-1) * p); return interpolate( colors[segment], colors[segment+1], (p * (colors.length - 1)) % 1 ); }
public static int random( int a, int b ) { return interpolate( a, b, Random.Float() ); }
public static int random( int a, int b ) { return interpolate( a, b, Random.Float() ); }
public static int random( int a, int b ) { return interpolate( a, b, Random.Float() ); }
@Override public void update() { super.update(); float p = left / lifespan; // alpha: 0 -> 1 -> 0; size: 6 -> 0; color: 0x660044 -> 0x000000 color( ColorMath.interpolate( 0x000000, 0x440044, p ) ); am = p < 0.5f ? p * p * 4 : (1 - p) * 2; } }
@Override public void update() { super.update(); float p = left / lifespan; // alpha: 0 -> 1 -> 0; size: 6 -> 0; color: 0x660044 -> 0x000000 color( ColorMath.interpolate( 0x000000, 0x440044, p ) ); am = p < 0.5f ? p * p * 4 : (1 - p) * 2; } }
@Override public void update() { super.update(); float p = left / lifespan; // alpha: 0 -> 1 -> 0; size: 6 -> 0; color: 0x660044 -> 0x000000 color( ColorMath.interpolate( 0x000000, 0x440044, p ) ); am = p < 0.5f ? p * p * 4 : (1 - p) * 2; } }
@Override public void update() { super.update(); // alpha: 1 -> 0; size: 1 -> 5 size( 5 - (am = left / lifespan) * 4 ); // color: 0xFF0044 -> 0x220066 color( ColorMath.interpolate( 0x220066, 0xFF0044, am ) ); } }
@Override public void update() { super.update(); // alpha: 1 -> 0; size: 1 -> 4 size( 4 - (am = left / lifespan) * 3 ); // color: 0x8844FF -> 0x00FF00 color( ColorMath.interpolate( 0x00FF00, 0x8844FF, am ) ); } }
@Override public void update() { super.update(); // alpha: 1 -> 0; size: 1 -> 5 size( 5 - (am = left / lifespan) * 4 ); // color: 0xFF0044 -> 0x220066 color( ColorMath.interpolate( 0x220066, 0xFF0044, am ) ); } }
@Override public void update() { super.update(); // alpha: 1 -> 0; size: 1 -> 5 size( 5 - (am = left / lifespan) * 4 ); // color: 0xFF0044 -> 0x220066 color( ColorMath.interpolate( 0x220066, 0xFF0044, am ) ); } }
@Override public void update() { super.update(); // alpha: 1 -> 0; size: 1 -> 4 size( 4 - (am = left / lifespan) * 3 ); // color: 0xAAAAAA -> 0xFF8800 color( ColorMath.interpolate( 0xFF8800, 0xAAAAAA, am ) ); }
@Override public void update() { super.update(); // alpha: 1 -> 0; size: 1 -> 4 size( 4 - (am = left / lifespan) * 3 ); // color: 0x8844FF -> 0x00FF00 color( ColorMath.interpolate( 0x00FF00, 0x8844FF, am ) ); } }
@Override public void update() { super.update(); // alpha: 1 -> 0; size: 1 -> 4 size( 4 - (am = left / lifespan) * 3 ); // color: 0xAAAAAA -> 0xFF8800 color( ColorMath.interpolate( 0xFF8800, 0xAAAAAA, am ) ); }
@Override public void update() { super.update(); // alpha: 1 -> 0; size: 1 -> 4 size( 4 - (am = left / lifespan) * 3 ); // color: 0x8844FF -> 0x00FF00 color( ColorMath.interpolate( 0x00FF00, 0x8844FF, am ) ); } }
hardlight( ColorMath.interpolate( 0xAAAAAA, 0xFF8800 , p )); case STENCH: case SMOKE:
warning += Game.elapsed * 5f *(0.4f - (health/max)); warning %= 1f; avatar.tint(ColorMath.interpolate(warning, warningColors), 0.5f ); } else { avatar.resetColor();
warning += Game.elapsed * 5f *(0.4f - (health/max)); warning %= 1f; avatar.tint(ColorMath.interpolate(warning, warningColors), 0.5f ); } else { avatar.resetColor();