SHOW:
|
|
- or go back to the newest paste.
1 | private int r = 255; // Default color to red. | |
2 | private int g = 0; | |
3 | private int b = 0; | |
4 | ||
5 | private void nextRGB() { | |
6 | if (r == 255 && g < 255 && b == 0) | |
7 | g += 15; | |
8 | if (g == 255 && r > 0 && b == 0) | |
9 | r -= 15; | |
10 | if (g == 255 && b < 255 && r == 0) | |
11 | b += 15; | |
12 | if (b == 255 && g > 0 && r == 0) | |
13 | g -= 15; | |
14 | if (b == 255 && r < 255 && g == 0) | |
15 | r += 15; | |
16 | if (r == 255 && b > 0 && g == 0) | |
17 | b -= 15; | |
18 | } |