UNPKG

ridder

Version:

A straightforward game engine for simple data-driven games in JavaScript

13 lines (12 loc) 493 B
import { easings } from "./easings.js"; /** * Return the value between {@link start} and {@link end} using the {@link easing} function, based on the elapsed time. * * @see {@link EasingDictionary} for the list of possible easing functions. * * @see {@link https://github.com/patrickswijgman/ridder/blob/main/examples/tween/index.ts} for an example. * */ export function tween(start, end, duration, easing, elapsed) { return easings[easing](elapsed, start, end - start, duration); }