Add some tests

Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>
This commit is contained in:
Šimon Brandner 2021-07-09 16:45:04 +02:00
parent d9b8f0d540
commit a90b8f32f1
No known key found for this signature in database
GPG key ID: 9760693FDD98A790
2 changed files with 38 additions and 0 deletions

View file

@ -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;
}