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 WoolParticle() { super(); color( ColorMath.random( 0x999999, 0xEEEEE0 ) ); acc.set( 0, -40 ); }
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 EarthParticle() { super(); lifespan = 0.5f; color( ColorMath.random( 0x555555, 0x777766 ) ); acc.set( 0, +40 ); }
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 EarthParticle() { super(); lifespan = 0.5f; color( ColorMath.random( 0x555555, 0x777766 ) ); acc.set( 0, +40 ); }
public static int random( int a, int b ) { return interpolate( a, b, Random.Float() ); }
public EarthParticle() { super(); color( ColorMath.random( 0x444444, 0x777766 ) ); angle = Random.Float( -30, 30 ); lifespan = 0.5f; }
public static int random( int a, int b ) { return interpolate( a, b, Random.Float() ); }
public WoolParticle() { super(); color( ColorMath.random( 0x999999, 0xEEEEE0 ) ); acc.set( 0, -40 ); }
public static int random( int a, int b ) { return interpolate( a, b, Random.Float() ); }
public WaterParticle() { super(); acc.y = 50; am = 0.5f; color( ColorMath.random( 0xb6ccc2, 0x3b6653 ) ); size( 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; } }
public EarthParticle() { super(); lifespan = 0.5f; color( ColorMath.random( 0x555555, 0x777766 ) ); acc.set( 0, +40 ); }
@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; } }
public EarthParticle() { super(); color( ColorMath.random( 0x444444, 0x777766 ) ); angle = Random.Float( -30, 30 ); lifespan = 0.5f; }
@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; } }
public WaterParticle() { super(); acc.y = 50; am = 0.5f; color( ColorMath.random( 0xb6ccc2, 0x3b6653 ) ); size( 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 ) ); } }
public WoolParticle() { super(); color( ColorMath.random( 0x999999, 0xEEEEE0 ) ); acc.set( 0, -40 ); }