Welcome on MasterOf13FPS! MasterOf13FPS

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

How to code side rainbow rectangle

easy. draw a rect, and do as color
[HIDE]
Code:
    private int getRainbow(int speed, int offset) {
        float hue = (System.currentTimeMillis() + offset) % speed;
        hue /= speed;
        return Color.getHSBColor(hue, 1f, 1f).getRGB();
    }
[/HIDE]

then make an int for example like this
private int antiskid;
antiskid++;

and ask how big it is:
[HIDE]
Code:
if(antiskid >= 5) {
 //Do it
}
[/HIDE]

at //Do it
-> ask, how big the x-axis is and as bigger it is, as later starts the
rainbow-effect. then you have a rect with
different colors.
but if you want to let it fading from right to left, like in liquidbounce,
then I have - unfortunately, unfortunately, - no idea how that works XD
hope i helped you,
LG Antiskid
 
Last edited by a moderator:
Use the upper code and divide the height or width of the rect into segments. Then just increase the offset for every segment, if done you'll get a fade effect
 
//X Y X1 Y1
drawRect(0.0f, 22.0f, 2.0f, 42.0f, getRainbow(2500, -15));


public static int getRainbow(final int speed, final double d) {
float hue = (float)((System.currentTimeMillis() + d) % speed);
hue /= speed;
return Color.getHSBColor(hue, 1.0f, 0.7f).getRGB();
}
 
shape1
shape2
shape3
shape4
shape5
shape6
Back
Top