Java tutorial
//package com.java2s; public class Main { /** * @param pX * @param pY * @param pMix [0...1] * @return pX * (1 - pMix) + pY * pMix */ public static final float mix(final float pX, final float pY, final float pMix) { return pX * (1 - pMix) + pY * pMix; } /** * @param pX * @param pY * @param pMix [0...1] * @return (int)Math.round(pX * (1 - pMix) + pY * pMix) */ public static final int mix(final int pX, final int pY, final float pMix) { return (int) Math.round(pX * (1 - pMix) + pY * pMix); } }