Add some tests
Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>
This commit is contained in:
parent
d9b8f0d540
commit
a90b8f32f1
2 changed files with 38 additions and 0 deletions
|
@ -14,6 +14,8 @@ See the License for the specific language governing permissions and
|
|||
limitations under the License.
|
||||
*/
|
||||
|
||||
import { clamp } from "lodash";
|
||||
|
||||
/**
|
||||
* This method linearly interpolates between two points (start, end). This is
|
||||
* most commonly used to find a point some fraction of the way along a line
|
||||
|
@ -25,5 +27,6 @@ limitations under the License.
|
|||
* @returns
|
||||
*/
|
||||
export function lerp(start: number, end: number, amt: number) {
|
||||
amt = clamp(amt, 0, 1);
|
||||
return (1 - amt) * start + amt * end;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue