Here you can find the source of lerp(float a, float b, float f)
Parameter | Description |
---|---|
a | The starting float |
b | The ending float |
f | The percentage between the two floats |
public static float lerp(float a, float b, float f)
//package com.java2s; //License from project: LGPL public class Main { /**//ww w. j a v a 2 s .c o m * Linearly interpolates between two floats * * @param a The starting float * @param b The ending float * @param f The percentage between the two floats * @return The float which if f% between a and b */ public static float lerp(float a, float b, float f) { return a + f * (b - a); } /** * Linearly interpolates between two doubles * * @param a The starting double * @param b The ending dluble * @param f The percentage between the two double * @return The double which if f% between a and b */ public static double lerp(double a, double b, double f) { return a + f * (b - a); } }