You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
14 lines
360 B
14 lines
360 B
1 year ago
|
import {basis} from "./basis";
|
||
|
|
||
|
export default function(values) {
|
||
|
var n = values.length;
|
||
|
return function(t) {
|
||
|
var i = Math.floor(((t %= 1) < 0 ? ++t : t) * n),
|
||
|
v0 = values[(i + n - 1) % n],
|
||
|
v1 = values[i % n],
|
||
|
v2 = values[(i + 1) % n],
|
||
|
v3 = values[(i + 2) % n];
|
||
|
return basis((t - i / n) * n, v0, v1, v2, v3);
|
||
|
};
|
||
|
}
|