@thi.ng/ramp
Version:
Extensible keyframe interpolation/tweening of arbitrary, nested types
18 lines (17 loc) • 463 B
JavaScript
import { mix } from "@thi.ng/math/mix";
import { map } from "@thi.ng/transducers/map";
import { normRange } from "@thi.ng/transducers/norm-range";
const __samples = (ramp, n, start, end) => {
if (start === void 0 || end === void 0) {
const bounds = ramp.timeBounds();
start = start ?? bounds[0];
end = end ?? bounds[1];
}
return map((t) => {
t = mix(start, end, t);
return [t, ramp.at(t)];
}, normRange(n));
};
export {
__samples
};