Here you can find the source of lerp(final double percent, final int startColor, final int endColor)
public static int lerp(final double percent, final int startColor, final int endColor)
//package com.java2s; /**/* w w w . j a va2s . c o m*/ * Copyright (c) 2008-2012 Ardor Labs, Inc. * * This file is part of Ardor3D. * * Ardor3D is free software: you can redistribute it and/or modify it * under the terms of its license which may be found in the accompanying * LICENSE file or at <http://www.ardor3d.com/LICENSE>. */ public class Main { public static int lerp(final double percent, final int startColor, final int endColor) { if (startColor == endColor) { return startColor; } else if (percent <= 0.0) { return startColor; } else if (percent >= 1.0) { return endColor; } final int r = (int) ((1.0 - percent) * (startColor >> 24 & 0xFF) + percent * (endColor >> 24 & 0xFF)); final int g = (int) ((1.0 - percent) * (startColor >> 16 & 0xFF) + percent * (endColor >> 16 & 0xFF)); final int b = (int) ((1.0 - percent) * (startColor >> 8 & 0xFF) + percent * (endColor >> 8 & 0xFF)); final int a = (int) ((1.0 - percent) * (startColor & 0xFF) + percent * (endColor & 0xFF)); return r << 24 | g << 16 | b << 8 | a; } }