Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into DOMMatrix
- Loading branch information
Showing
33 changed files
with
758 additions
and
483 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
*.sublime-workspace | ||
.DS_Store | ||
build/ | ||
dist/ | ||
node_modules | ||
npm-debug.log |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
export default function(a, b) { | ||
var d = new Date; | ||
return a = +a, b -= a, function(t) { | ||
return d.setTime(a + b * t), d; | ||
return a = +a, b = +b, function(t) { | ||
return d.setTime(a * (1 - t) + b * t), d; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
export {default as interpolate} from "./value.js"; | ||
export {default as interpolateArray} from "./array.js"; | ||
export {default as interpolateBasis} from "./basis.js"; | ||
export {default as interpolateBasisClosed} from "./basisClosed.js"; | ||
export {default as interpolateDate} from "./date.js"; | ||
export {default as interpolateDiscrete} from "./discrete.js"; | ||
export {default as interpolateHue} from "./hue.js"; | ||
export {default as interpolateNumber} from "./number.js"; | ||
export {default as interpolateNumberArray} from "./numberArray.js"; | ||
export {default as interpolateObject} from "./object.js"; | ||
export {default as interpolateRound} from "./round.js"; | ||
export {default as interpolateString} from "./string.js"; | ||
export {interpolateTransformCss, interpolateTransformSvg} from "./transform/index.js"; | ||
export {default as interpolateZoom} from "./zoom.js"; | ||
export {default as interpolateRgb, rgbBasis as interpolateRgbBasis, rgbBasisClosed as interpolateRgbBasisClosed} from "./rgb.js"; | ||
export {default as interpolateHsl, hslLong as interpolateHslLong} from "./hsl.js"; | ||
export {default as interpolateLab} from "./lab.js"; | ||
export {default as interpolateHcl, hclLong as interpolateHclLong} from "./hcl.js"; | ||
export {default as interpolateCubehelix, cubehelixLong as interpolateCubehelixLong} from "./cubehelix.js"; | ||
export {default as piecewise} from "./piecewise.js"; | ||
export {default as quantize} from "./quantize.js"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
export default function(a, b) { | ||
return a = +a, b -= a, function(t) { | ||
return a + b * t; | ||
return a = +a, b = +b, function(t) { | ||
return a * (1 - t) + b * t; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
export default function(a, b) { | ||
if (!b) b = []; | ||
var n = a ? Math.min(b.length, a.length) : 0, | ||
c = b.slice(), | ||
i; | ||
return function(t) { | ||
for (i = 0; i < n; ++i) c[i] = a[i] * (1 - t) + b[i] * t; | ||
return c; | ||
}; | ||
} | ||
|
||
export function isNumberArray(x) { | ||
return ArrayBuffer.isView(x) && !(x instanceof DataView); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
import value from "./value"; | ||
import value from "./value.js"; | ||
|
||
export default function(a, b) { | ||
var i = {}, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
export default function(a, b) { | ||
return a = +a, b -= a, function(t) { | ||
return Math.round(a + b * t); | ||
return a = +a, b = +b, function(t) { | ||
return Math.round(a * (1 - t) + b * t); | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
var tape = require("tape"), | ||
interpolate = require("../"); | ||
|
||
tape("interpolateNumberArray(a, b) interpolates defined elements in a and b", function(test) { | ||
test.deepEqual(interpolate.interpolateNumberArray(Float64Array.of(2, 12), Float64Array.of(4, 24))(0.5), Float64Array.of(3, 18)); | ||
test.end(); | ||
}); | ||
|
||
tape("interpolateNumberArray(a, b) ignores elements in a that are not in b", function(test) { | ||
test.deepEqual(interpolate.interpolateNumberArray(Float64Array.of(2, 12, 12), Float64Array.of(4, 24))(0.5), Float64Array.of(3, 18)); | ||
test.end(); | ||
}); | ||
|
||
tape("interpolateNumberArray(a, b) uses constant elements in b that are not in a", function(test) { | ||
test.deepEqual(interpolate.interpolateNumberArray(Float64Array.of(2, 12), Float64Array.of(4, 24, 12))(0.5), Float64Array.of(3, 18, 12)); | ||
test.end(); | ||
}); | ||
|
||
tape("interpolateNumberArray(a, b) treats undefined as an empty array", function(test) { | ||
test.deepEqual(interpolate.interpolateNumberArray(undefined, [2, 12])(0.5), [2, 12]); | ||
test.deepEqual(interpolate.interpolateNumberArray([2, 12], undefined)(0.5), []); | ||
test.deepEqual(interpolate.interpolateNumberArray(undefined, undefined)(0.5), []); | ||
test.end(); | ||
}); | ||
|
||
tape("interpolateNumberArray(a, b) uses b’s array type", function(test) { | ||
test.ok(interpolate.interpolateNumberArray(Float64Array.of(2, 12), Float64Array.of(4, 24, 12))(0.5) instanceof Float64Array); | ||
test.ok(interpolate.interpolateNumberArray(Float64Array.of(2, 12), Float32Array.of(4, 24, 12))(0.5) instanceof Float32Array); | ||
test.ok(interpolate.interpolateNumberArray(Float64Array.of(2, 12), Uint8Array.of(4, 24, 12))(0.5) instanceof Uint8Array); | ||
test.ok(interpolate.interpolateNumberArray(Float64Array.of(2, 12), Uint16Array.of(4, 24, 12))(0.5) instanceof Uint16Array); | ||
test.end(); | ||
}); | ||
|
||
tape("interpolateNumberArray(a, b) works with unsigned data", function(test) { | ||
test.deepEqual(interpolate.interpolateNumberArray(Uint8Array.of(1, 12), Uint8Array.of(255, 0))(0.5), Uint8Array.of(128, 6)); | ||
test.end(); | ||
}); | ||
|
||
tape("interpolateNumberArray(a, b) gives exact ends", function(test) { | ||
var i = interpolate.interpolateNumberArray(Float64Array.of(2e42), Float64Array.of(355)); | ||
test.deepEqual(i(0), Float64Array.of(2e42)); | ||
test.deepEqual(i(1), Float64Array.of(355)); | ||
test.end(); | ||
}); |
Oops, something went wrong.