Welcome on MasterOf13FPS! MasterOf13FPS

Register today or sign up if you are already a member and never miss any cool content again :)

Color fading (dark to light) effect?

bkm_

New member
Joined
Jan 4, 2021
Messages
9
Reaction score
3
Points
3
Location
Toronto, CA
Hello,

This is kind of a noob question, but could someone explain how to achieve a color fading effect like this:

I know you have to use System.currentTimeMillis() to achieve a rainbow effect. However, how would I adjust the hue to achieve the above effect?

Thanks in advance.
 
Looks like they just change the brightness of the color

To change the brightness of a color, you can use something like this
Code:
// Do this when you initialize your arraylist or change the color.
Color c = Color.white;
float[] hsb = new float[3];
Color.RGBtoHSB(c.getRed(), c.getGreen(), c.getRed(), hsb);

//This is the color for your text
Color newColor = Color.getHSBColor(hsb[0], hsb[1],  brightness)

for brightness I would simply use Math.cos to fade between 0.8 and 1
0.1*cos(x)+0.9
you can use the System.currentTimeMillis() calculation from the rainbow effect for x
 
Looks like they just change the brightness of the color

To change the brightness of a color, you can use something like this
Code:
// Do this when you initialize your arraylist or change the color.
Color c = Color.white;
float[] hsb = new float[3];
Color.RGBtoHSB(c.getRed(), c.getGreen(), c.getRed(), hsb);

//This is the color for your text
Color newColor = Color.getHSBColor(hsb[0], hsb[1],  saturation)

for saturation I would simply use Math.cos to fade between 0.8 and 1
0.1*cos(x)+0.9
you can use the System.currentTimeMillis() calculation from the rainbow effect for x
I appreciate the help. I'll try to implement this.
 
shape1
shape2
shape3
shape4
shape5
shape6
Back
Top