Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private int[] separateColor(int color) {
- return new int[] {
- (color >> 16) & 0xFF,
- (color >> 8) & 0xFF,
- color & 0xFF
- };
- }
- private int combineColor(int[] rgb) {
- return (rgb[0] << 16) & 0xFF0000 | (rgb[1] << 8) & 0xFF00 | rgb[2] & 0xFF;
- }
- private int[] lerpArrays(float delta, int[] a1, int[] a2) {
- if (a1.length != a2.length)
- throw new RuntimeException("a1.length != a2.length");
- int[] a3 = new int[a1.length];
- for (int i = 0; i < a1.length; i++)
- a3[i] = MathHelper.floor(MathHelper.lerp(delta, a1[i], a2[i]));
- return a3;
- }
- private int lerpColors(float delta, int color1, int color2) {
- return combineColor(lerpArrays(delta, separateColor(color1), separateColor(color2)));
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement