com.watabou.utils.ColorMath Java Examples

The following examples show how to use com.watabou.utils.ColorMath. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: MagicMissile.java    From shattered-pixel-dungeon-gdx with GNU General Public License v3.0 6 votes vote down vote up
public void reset( float x, float y ) {
	revive();
	
	this.x = x;
	this.y = y;
	
	left = lifespan;
	size = 4;
	
	if (Random.Int(10) == 0){
		color(ColorMath.random(0xFFF568, 0x80791A));
	} else {
		color(ColorMath.random(0x805500, 0x332500));
	}
	
	speed.set( Random.Float( -10, +10 ), Random.Float( -10, +10 ) );
}
 
Example #2
Source File: MagicMissile.java    From shattered-pixel-dungeon with GNU General Public License v3.0 6 votes vote down vote up
public void reset( float x, float y ) {
	revive();
	
	this.x = x;
	this.y = y;
	
	left = lifespan;
	size = 4;
	
	if (Random.Int(10) == 0){
		color(ColorMath.random(0xFFF266, 0x80771A));
	} else {
		color(ColorMath.random(0x805500, 0x332500));
	}
	
	speed.set( Random.Float( -10, +10 ), Random.Float( -10, +10 ) );
}
 
Example #3
Source File: WandOfLivingEarth.java    From shattered-pixel-dungeon with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void staffFx(MagesStaff.StaffParticle particle) {
	if (Random.Int(10) == 0){
		particle.color(ColorMath.random(0xFFF568, 0x80791A));
	} else {
		particle.color(ColorMath.random(0x805500, 0x332500));
	}
	particle.am = 1f;
	particle.setLifespan(2f);
	particle.setSize( 1f, 2f);
	particle.shuffleXY(0.5f);
	float dst = Random.Float(11f);
	particle.x -= dst;
	particle.y += dst;
}
 
Example #4
Source File: PoisonParticle.java    From unleashed-pixel-dungeon with GNU General Public License v3.0 5 votes vote down vote up
@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 ) );
}
 
Example #5
Source File: EarthParticle.java    From unleashed-pixel-dungeon with GNU General Public License v3.0 5 votes vote down vote up
public EarthParticle() {
	super();
	
	color( ColorMath.random( 0x444444, 0x777766 ) );
	angle = Random.Float( -30, 30 );
	
	lifespan = 0.5f;
}
 
Example #6
Source File: PurpleParticle.java    From YetAnotherPixelDungeon with GNU General Public License v3.0 5 votes vote down vote up
@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 ) );
}
 
Example #7
Source File: PoisonParticle.java    From pixel-dungeon with GNU General Public License v3.0 5 votes vote down vote up
@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 ) );
}
 
Example #8
Source File: ShadowParticle.java    From pixel-dungeon with GNU General Public License v3.0 5 votes vote down vote up
@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; 
}
 
Example #9
Source File: PurpleParticle.java    From pixel-dungeon with GNU General Public License v3.0 5 votes vote down vote up
@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 ) );
}
 
Example #10
Source File: SewerLevel.java    From shattered-pixel-dungeon with GNU General Public License v3.0 5 votes vote down vote up
public WaterParticle() {
	super();
	
	acc.y = 50;
	am = 0.5f;
	
	color( ColorMath.random( 0xb6ccc2, 0x3b6653 ) );
	size( 2 );
}
 
Example #11
Source File: Fireball.java    From shattered-pixel-dungeon with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void update() {
	
	super.update();
	
	if (Random.Float() < Game.elapsed) {
		PixelParticle spark = (PixelParticle)sparks.recycle( PixelParticle.Shrinking.class );
		spark.reset( x, y, ColorMath.random( COLOR, 0x66FF66 ), 2, Random.Float( 0.5f, 1.0f ) );
		spark.speed.set(
			Random.Float( -40, +40 ),
			Random.Float( -60, +20 ) );
		spark.acc.set( 0, +80 );
		sparks.add( spark );
	}
}
 
Example #12
Source File: Fireball.java    From YetAnotherPixelDungeon with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void update() {
	
	super.update();
	
	if (Random.Float() < Game.elapsed) {
		PixelParticle spark = (PixelParticle)sparks.recycle( PixelParticle.Shrinking.class );
		spark.reset( x, y, ColorMath.random( COLOR, 0x66FF66 ), 2, Random.Float( 0.5f, 1.0f ) );
		spark.speed.set( 
			Random.Float( -40, +40 ), 
			Random.Float( -60, +20 ) );
		spark.acc.set( 0, +80 );
		sparks.add( spark );
	}
}
 
Example #13
Source File: PoisonParticle.java    From shattered-pixel-dungeon with GNU General Public License v3.0 5 votes vote down vote up
@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 ) );
}
 
Example #14
Source File: CorrosionParticle.java    From shattered-pixel-dungeon with GNU General Public License v3.0 5 votes vote down vote up
@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 ) );
}
 
Example #15
Source File: ShadowParticle.java    From shattered-pixel-dungeon with GNU General Public License v3.0 5 votes vote down vote up
@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;
}
 
Example #16
Source File: PurpleParticle.java    From shattered-pixel-dungeon with GNU General Public License v3.0 5 votes vote down vote up
@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 ) );
}
 
Example #17
Source File: PoisonParticle.java    From shattered-pixel-dungeon-gdx with GNU General Public License v3.0 5 votes vote down vote up
@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 ) );
}
 
Example #18
Source File: WandOfCorrosion.java    From shattered-pixel-dungeon with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void staffFx(MagesStaff.StaffParticle particle) {
	particle.color( ColorMath.random( 0xAAAAAA, 0xFF8800) );
	particle.am = 0.6f;
	particle.setLifespan( 1f );
	particle.acc.set(0, 20);
	particle.setSize( 0.5f, 3f );
	particle.shuffleXY( 1f );
}
 
Example #19
Source File: WandOfRegrowth.java    From shattered-pixel-dungeon with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void staffFx(MagesStaff.StaffParticle particle) {
	particle.color( ColorMath.random(0x004400, 0x88CC44) );
	particle.am = 1f;
	particle.setLifespan(1f);
	particle.setSize( 1f, 1.5f);
	particle.shuffleXY(0.5f);
	float dst = Random.Float(11f);
	particle.x -= dst;
	particle.y += dst;
}
 
Example #20
Source File: BloodSink.java    From remixed-dungeon with GNU General Public License v3.0 5 votes vote down vote up
public BloodParticle() {
    super();

    acc.y = 50;
    am = 0.5f;

    color( ColorMath.random( 0xe6e600, 0x9fe05d ) );
    size( 2 );
}
 
Example #21
Source File: WaterSink.java    From remixed-dungeon with GNU General Public License v3.0 5 votes vote down vote up
public WaterParticle() {
    super();

    acc.y = 50;
    am = 0.5f;

    color(ColorMath.random(0xb6ccc2, 0x3b6653));
    size(2);
}
 
Example #22
Source File: NewFireball.java    From remixed-dungeon with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void update() {
	
	super.update();
	
	if (Random.Float() < Game.elapsed) {
		PixelParticle spark = (PixelParticle)sparks.recycle( PixelParticle.Shrinking.class );
		spark.reset( x, y, ColorMath.random( 0x000000, COLOR ), 2, Random.Float( 0.5f, 1.0f ) );
		spark.speed.set( 
			Random.Float( -70, +40 ),
			Random.Float( -60, +70 ) );
		spark.acc.set( 0, +80 );
		sparks.add( spark );
	}
}
 
Example #23
Source File: Fireball.java    From remixed-dungeon with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void update() {
	
	super.update();
	
	if (Random.Float() < Game.elapsed) {
		PixelParticle spark = (PixelParticle)sparks.recycle( PixelParticle.Shrinking.class );
		spark.reset( x, y, ColorMath.random( COLOR, 0x66FF66 ), 2, Random.Float( 0.5f, 1.0f ) );
		spark.speed.set( 
			Random.Float( -40, +40 ), 
			Random.Float( -60, +20 ) );
		spark.acc.set( 0, +80 );
		sparks.add( spark );
	}
}
 
Example #24
Source File: PoisonParticle.java    From remixed-dungeon with GNU General Public License v3.0 5 votes vote down vote up
@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 ) );
}
 
Example #25
Source File: ShadowParticle.java    From remixed-dungeon with GNU General Public License v3.0 5 votes vote down vote up
@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; 
}
 
Example #26
Source File: PurpleParticle.java    From remixed-dungeon with GNU General Public License v3.0 5 votes vote down vote up
@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 ) );
}
 
Example #27
Source File: SewerLevel.java    From shattered-pixel-dungeon-gdx with GNU General Public License v3.0 5 votes vote down vote up
public WaterParticle() {
	super();
	
	acc.y = 50;
	am = 0.5f;
	
	color( ColorMath.random( 0xb6ccc2, 0x3b6653 ) );
	size( 2 );
}
 
Example #28
Source File: Fireball.java    From shattered-pixel-dungeon-gdx with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void update() {
	
	super.update();
	
	if (Random.Float() < Game.elapsed) {
		PixelParticle spark = (PixelParticle)sparks.recycle( PixelParticle.Shrinking.class );
		spark.reset( x, y, ColorMath.random( COLOR, 0x66FF66 ), 2, Random.Float( 0.5f, 1.0f ) );
		spark.speed.set(
			Random.Float( -40, +40 ),
			Random.Float( -60, +20 ) );
		spark.acc.set( 0, +80 );
		sparks.add( spark );
	}
}
 
Example #29
Source File: CorrosionParticle.java    From shattered-pixel-dungeon-gdx with GNU General Public License v3.0 5 votes vote down vote up
@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 ) );
}
 
Example #30
Source File: EarthParticle.java    From shattered-pixel-dungeon-gdx with GNU General Public License v3.0 5 votes vote down vote up
public EarthParticle() {
	super();
	
	color( ColorMath.random( 0x444444, 0x777766 ) );
	angle = Random.Float( -30, 30 );
	
	lifespan = 0.5f;
}