flow like the river
This commit is contained in:
commit
013fe673f3
42435 changed files with 5764238 additions and 0 deletions
19
VISUALIZACION/node_modules/d3-interpolate/src/basis.js
generated
vendored
Executable file
19
VISUALIZACION/node_modules/d3-interpolate/src/basis.js
generated
vendored
Executable file
|
|
@ -0,0 +1,19 @@
|
|||
export function basis(t1, v0, v1, v2, v3) {
|
||||
var t2 = t1 * t1, t3 = t2 * t1;
|
||||
return ((1 - 3 * t1 + 3 * t2 - t3) * v0
|
||||
+ (4 - 6 * t2 + 3 * t3) * v1
|
||||
+ (1 + 3 * t1 + 3 * t2 - 3 * t3) * v2
|
||||
+ t3 * v3) / 6;
|
||||
}
|
||||
|
||||
export default function(values) {
|
||||
var n = values.length - 1;
|
||||
return function(t) {
|
||||
var i = t <= 0 ? (t = 0) : t >= 1 ? (t = 1, n - 1) : Math.floor(t * n),
|
||||
v1 = values[i],
|
||||
v2 = values[i + 1],
|
||||
v0 = i > 0 ? values[i - 1] : 2 * v1 - v2,
|
||||
v3 = i < n - 1 ? values[i + 2] : 2 * v2 - v1;
|
||||
return basis((t - i / n) * n, v0, v1, v2, v3);
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue