victory-animation
Version:
animation wrapper for victory components
1,690 lines (1,489 loc) • 478 kB
JavaScript
(function webpackUniversalModuleDefinition(root, factory) {
if(typeof exports === 'object' && typeof module === 'object')
module.exports = factory(require("react"));
else if(typeof define === 'function' && define.amd)
define(["react"], factory);
else if(typeof exports === 'object')
exports["VictoryAnimation"] = factory(require("react"));
else
root["VictoryAnimation"] = factory(root["React"]);
})(this, function(__WEBPACK_EXTERNAL_MODULE_2__) {
return /******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId])
/******/ return installedModules[moduleId].exports;
/******/
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ exports: {},
/******/ id: moduleId,
/******/ loaded: false
/******/ };
/******/
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/
/******/ // Flag the module as loaded
/******/ module.loaded = true;
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/******/
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "";
/******/
/******/ // Load entry module and return exports
/******/ return __webpack_require__(0);
/******/ })
/************************************************************************/
/******/ ([
/* 0 */
/***/ function(module, exports, __webpack_require__) {
"use strict";
module.exports = {
VictoryAnimation: __webpack_require__(1)
};
/***/ },
/* 1 */
/***/ function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
var _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x = parent; _x2 = property; _x3 = receiver; _again = true; desc = parent = undefined; continue _function; } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } };
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) arr2[i] = arr[i]; return arr2; } else { return Array.from(arr); } }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
var _react = __webpack_require__(2);
var _react2 = _interopRequireDefault(_react);
var _d3Ease = __webpack_require__(3);
var _d3Ease2 = _interopRequireDefault(_d3Ease);
var _d3Interpolate = __webpack_require__(4);
var _d3Interpolate2 = _interopRequireDefault(_d3Interpolate);
var _d3Timer = __webpack_require__(6);
var _util = __webpack_require__(7);
// Nearly all animation libraries are duration-based, not velocity-based.
// In other words, you say "I want the animation to take this long", not
// "I want things to move this fast". Using velocity will make the animation
// take different amounts of time on computers of different speed, since
// they'll have a different framerate but still adjust values by the same
// velocity each frame. But for now we still support velocity as we have code
// using it. Since we use `d3-timer` now and it's duration-based, choose a
// velocity multiplier here that just happens to result in animations going
// approximately the same speed on systems getting around 60 fps.
var VELOCITY_MULTIPLIER = 16.5; // ~ 1 / 60
(0, _util.addVictoryInterpolator)();
var VictoryAnimation = (function (_React$Component) {
_inherits(VictoryAnimation, _React$Component);
_createClass(VictoryAnimation, null, [{
key: "propTypes",
value: {
/**
* The child of should be a function that takes an object of tweened values
* and returns a component to render.
*/
children: _react2["default"].PropTypes.func,
/**
* The velocity prop specifies how fast the animation should run.
*/
velocity: _react2["default"].PropTypes.number,
/**
* The easing prop specifies an easing function name to use for tweening.
*/
easing: _react2["default"].PropTypes.oneOf(["back", "backIn", "backOut", "backInOut", "bounce", "bounceIn", "bounceOut", "bounceInOut", "circle", "circleIn", "circleOut", "circleInOut", "linear", "linearIn", "linearOut", "linearInOut", "cubic", "cubicIn", "cubicOut", "cubicInOut", "elastic", "elasticIn", "elasticOut", "elasticInOut", "exp", "expIn", "expOut", "expInOut", "poly", "polyIn", "polyOut", "polyInOut", "quad", "quadIn", "quadOut", "quadInOut", "sin", "sinIn", "sinOut", "sinInOut"]),
/**
* The delay prop specifies a delay in milliseconds before the animation
* begins. If multiple values are in the animation queue, it is the delay
* between each animation.
*/
delay: _react2["default"].PropTypes.number,
/**
* The onEnd prop specifies a function to run when the animation ends. If
* multiple animations are in the queue, it is called after the last
* animation.
*/
onEnd: _react2["default"].PropTypes.func,
/**
* The data prop specifies the latest set of values to tween to. When this
* prop changes, VictoryAnimation will begin animating from the current
* value to the new value.
*/
data: _react2["default"].PropTypes.oneOfType([_react2["default"].PropTypes.object, _react2["default"].PropTypes.array])
},
enumerable: true
}, {
key: "defaultProps",
value: {
/* velocity modifies step each frame */
velocity: 0.02,
/* easing modifies step each frame */
easing: "quadInOut",
/* delay between transitions */
delay: 0,
/* we got nothin' */
data: {}
},
enumerable: true
}]);
function VictoryAnimation(props) {
_classCallCheck(this, VictoryAnimation);
_get(Object.getPrototypeOf(VictoryAnimation.prototype), "constructor", this).call(this, props);
/* defaults */
this.state = Array.isArray(this.props.data) ? this.props.data[0] : this.props.data;
this.interpolator = null;
this.queue = Array.isArray(this.props.data) ? this.props.data.slice(1) : [];
/* build easing function */
this.ease = _d3Ease2["default"][this.props.easing];
/*
unlike React.createClass({}), there is no autobinding of this in ES6 classes
so we bind functionToBeRunEachFrame to current instance of victory animation class
*/
this.functionToBeRunEachFrame = this.functionToBeRunEachFrame.bind(this);
}
_createClass(VictoryAnimation, [{
key: "componentDidMount",
value: function componentDidMount() {
// Length check prevents us from triggering `onEnd` in `traverseQueue`.
if (this.queue.length) {
this.traverseQueue();
}
}
/* lifecycle */
}, {
key: "componentWillReceiveProps",
value: function componentWillReceiveProps(nextProps) {
/* cancel existing loop if it exists */
if (this.timer) {
this.timer.stop();
}
/* If an object was supplied */
if (!Array.isArray(nextProps.data)) {
// Replace the tween queue. Could set `this.queue = [nextProps.data]`,
// but let's reuse the same array.
this.queue.length = 0;
this.queue.push(nextProps.data);
/* If an array was supplied */
} else {
var _queue;
/* Extend the tween queue */
(_queue = this.queue).push.apply(_queue, _toConsumableArray(nextProps.data));
}
/* Start traversing the tween queue */
this.traverseQueue();
}
}, {
key: "componentWillUnmount",
value: function componentWillUnmount() {
if (this.timer) {
this.timer.stop();
}
}
/* Traverse the tween queue */
}, {
key: "traverseQueue",
value: function traverseQueue() {
if (this.queue.length) {
/* Get the next index */
var data = this.queue[0];
/* compare cached version to next props */
this.interpolator = _d3Interpolate2["default"].value(this.state, data);
/* reset step to zero */
this.timer = (0, _d3Timer.timer)(this.functionToBeRunEachFrame, this.props.delay);
} else if (this.props.onEnd) {
this.props.onEnd();
}
}
/* every frame we... */
}, {
key: "functionToBeRunEachFrame",
value: function functionToBeRunEachFrame(elapsed) {
/*
step can generate imprecise values, sometimes greater than 1
if this happens set the state to 1 and return, cancelling the timer
*/
var step = elapsed / (VELOCITY_MULTIPLIER / this.props.velocity);
if (step >= 1) {
this.setState(this.interpolator(1));
this.timer.stop();
this.queue.shift();
this.traverseQueue(); // Will take care of calling `onEnd`.
return;
}
/*
if we're not at the end of the timer, set the state by passing
current step value that's transformed by the ease function to the
interpolator, which is cached for performance whenever props are received
*/
this.setState(this.interpolator(this.ease(step)));
}
}, {
key: "render",
value: function render() {
return this.props.children(this.state);
}
}]);
return VictoryAnimation;
})(_react2["default"].Component);
exports["default"] = VictoryAnimation;
module.exports = exports["default"];
/***/ },
/* 2 */
/***/ function(module, exports) {
module.exports = __WEBPACK_EXTERNAL_MODULE_2__;
/***/ },
/* 3 */
/***/ function(module, exports, __webpack_require__) {
(function (global, factory) {
true ? factory(exports) :
typeof define === 'function' && define.amd ? define('d3-ease', ['exports'], factory) :
factory((global.d3_ease = {}));
}(this, function (exports) { 'use strict';
var slice = Array.prototype.slice;
function curry1(type, a) {
return function(t) {
return type(t, a);
};
}
function curry2(type, a, b) {
return function(t) {
return type(t, a, b);
};
}
function curryN(type, args) {
args = slice.call(args);
args[0] = null;
return function(t) {
args[0] = t;
return type.apply(null, args);
};
}
function bind(type, a, b) {
switch (arguments.length) {
case 1: return type;
case 2: return curry1(type, a);
case 3: return curry2(type, a, b);
default: return curryN(type, arguments);
}
};
function linearIn(t) {
return +t;
};
function quadIn(t) {
return t * t;
};
function quadOut(t) {
return t * (2 - t);
};
function quadInOut(t) {
return ((t *= 2) <= 1 ? t * t : --t * (2 - t) + 1) / 2;
};
function cubicIn(t) {
return t * t * t;
};
function cubicOut(t) {
return --t * t * t + 1;
};
function cubicInOut(t) {
return ((t *= 2) <= 1 ? t * t * t : (t -= 2) * t * t + 2) / 2;
};
function polyIn(t, e) {
if (e == null) e = 3;
return Math.pow(t, e);
};
function polyOut(t, e) {
if (e == null) e = 3;
return 1 - Math.pow(1 - t, e);
};
function polyInOut(t, e) {
if (e == null) e = 3;
return ((t *= 2) <= 1 ? Math.pow(t, e) : 2 - Math.pow(2 - t, e)) / 2;
};
var pi = Math.PI;
var halfPi = pi / 2;
function sinIn(t) {
return 1 - Math.cos(t * halfPi);
};
function sinOut(t) {
return Math.sin(t * halfPi);
};
function sinInOut(t) {
return (1 - Math.cos(pi * t)) / 2;
};
function expIn(t) {
return Math.pow(2, 10 * t - 10);
};
function expOut(t) {
return 1 - Math.pow(2, -10 * t);
};
function expInOut(t) {
return ((t *= 2) <= 1 ? Math.pow(2, 10 * t - 10) : 2 - Math.pow(2, 10 - 10 * t)) / 2;
};
function circleIn(t) {
return 1 - Math.sqrt(1 - t * t);
};
function circleOut(t) {
return Math.sqrt(1 - --t * t);
};
function circleInOut(t) {
return ((t *= 2) <= 1 ? 1 - Math.sqrt(1 - t * t) : Math.sqrt(1 - (t -= 2) * t) + 1) / 2;
};
var b1 = 4 / 11;
var b2 = 6 / 11;
var b3 = 8 / 11;
var b4 = 3 / 4;
var b5 = 9 / 11;
var b6 = 10 / 11;
var b7 = 15 / 16;
var b8 = 21 / 22;
var b9 = 63 / 64;
var b0 = 1 / b1 / b1;
function bounceIn(t) {
return 1 - bounceOut(1 - t);
};
function bounceOut(t) {
return t < b1 ? b0 * t * t : t < b3 ? b0 * (t -= b2) * t + b4 : t < b6 ? b0 * (t -= b5) * t + b7 : b0 * (t -= b8) * t + b9;
};
function bounceInOut(t) {
return ((t *= 2) <= 1 ? 1 - bounceOut(1 - t) : bounceOut(t - 1) + 1) / 2;
};
function backIn(t, s) {
s = s == null ? 1.70158 : +s;
return t * t * ((s + 1) * t - s);
};
function backOut(t, s) {
s = s == null ? 1.70158 : +s;
return --t * t * ((s + 1) * t + s) + 1;
};
function backInOut(t, s) {
s = s == null ? 1.70158 : +s;
return ((t *= 2) < 1 ? t * t * ((s + 1) * t - s) : (t -= 2) * t * ((s + 1) * t + s) + 2) / 2;
};
var tau = 2 * Math.PI;
function elasticIn(t, a, p) {
a = a == null ? 1 : Math.max(1, a);
p = (p == null ? 0.3 : p) / tau;
return a * Math.pow(2, 10 * --t) * Math.sin((p * Math.asin(1 / a) - t) / p);
};
function elasticOut(t, a, p) {
a = a == null ? 1 : Math.max(1, a);
p = (p == null ? 0.3 : p) / tau;
return 1 - a * Math.pow(2, -10 * t) * Math.sin((+t + p * Math.asin(1 / a)) / p);
};
function elasticInOut(t, a, p) {
a = a == null ? 1 : Math.max(1, a);
p = (p == null ? 0.3 : p) / tau;
var s = p * Math.asin(1 / a);
return ((t = t * 2 - 1) < 0
? a * Math.pow(2, 10 * t) * Math.sin((s - t) / p)
: 2 - a * Math.pow(2, -10 * t) * Math.sin((s + t) / p)) / 2;
};
var version = "0.3.0";
exports.version = version;
exports.bind = bind;
exports.linear = linearIn;
exports.linearIn = linearIn;
exports.linearOut = linearIn;
exports.linearInOut = linearIn;
exports.quad = quadIn;
exports.quadIn = quadIn;
exports.quadOut = quadOut;
exports.quadInOut = quadInOut;
exports.cubic = cubicIn;
exports.cubicIn = cubicIn;
exports.cubicOut = cubicOut;
exports.cubicInOut = cubicInOut;
exports.poly = polyIn;
exports.polyIn = polyIn;
exports.polyOut = polyOut;
exports.polyInOut = polyInOut;
exports.sin = sinIn;
exports.sinIn = sinIn;
exports.sinOut = sinOut;
exports.sinInOut = sinInOut;
exports.exp = expIn;
exports.expIn = expIn;
exports.expOut = expOut;
exports.expInOut = expInOut;
exports.circle = circleIn;
exports.circleIn = circleIn;
exports.circleOut = circleOut;
exports.circleInOut = circleInOut;
exports.bounce = bounceIn;
exports.bounceIn = bounceIn;
exports.bounceOut = bounceOut;
exports.bounceInOut = bounceInOut;
exports.back = backIn;
exports.backIn = backIn;
exports.backOut = backOut;
exports.backInOut = backInOut;
exports.elastic = elasticIn;
exports.elasticIn = elasticIn;
exports.elasticOut = elasticOut;
exports.elasticInOut = elasticInOut;
}));
/***/ },
/* 4 */
/***/ function(module, exports, __webpack_require__) {
(function (global, factory) {
true ? factory(exports, __webpack_require__(5)) :
typeof define === 'function' && define.amd ? define('d3-interpolate', ['exports', 'd3-color'], factory) :
factory((global.d3_interpolate = {}),global.d3_color);
}(this, function (exports,d3Color) { 'use strict';
function deltaHue(h1, h0) {
var delta = h1 - h0;
return delta > 180 || delta < -180
? delta - 360 * Math.round(delta / 360)
: delta;
};
function cubehelixGamma(gamma) {
return function(a, b) {
a = d3Color.cubehelix(a);
b = d3Color.cubehelix(b);
var ah = isNaN(a.h) ? b.h : a.h,
as = isNaN(a.s) ? b.s : a.s,
al = a.l,
bh = isNaN(b.h) ? 0 : deltaHue(b.h, ah),
bs = isNaN(b.s) ? 0 : b.s - as,
bl = b.l - al;
return function(t) {
a.h = ah + bh * t;
a.s = as + bs * t;
a.l = al + bl * Math.pow(t, gamma);
return a + "";
};
};
};
function cubehelixGammaLong(gamma) {
return function(a, b) {
a = d3Color.cubehelix(a);
b = d3Color.cubehelix(b);
var ah = isNaN(a.h) ? b.h : a.h,
as = isNaN(a.s) ? b.s : a.s,
al = a.l,
bh = isNaN(b.h) ? 0 : b.h - ah,
bs = isNaN(b.s) ? 0 : b.s - as,
bl = b.l - al;
return function(t) {
a.h = ah + bh * t;
a.s = as + bs * t;
a.l = al + bl * Math.pow(t, gamma);
return a + "";
};
};
};
function rgb(a, b) {
a = d3Color.rgb(a);
b = d3Color.rgb(b);
var ar = a.r,
ag = a.g,
ab = a.b,
br = b.r - ar,
bg = b.g - ag,
bb = b.b - ab;
return function(t) {
a.r = ar + br * t;
a.g = ag + bg * t;
a.b = ab + bb * t;
return a + "";
};
};
function number(a, b) {
return a = +a, b -= a, function(t) {
return a + b * t;
};
};
function object(a, b) {
var i = {},
c = {},
k;
for (k in a) {
if (k in b) {
i[k] = value(a[k], b[k]);
} else {
c[k] = a[k];
}
}
for (k in b) {
if (!(k in a)) {
c[k] = b[k];
}
}
return function(t) {
for (k in i) c[k] = i[k](t);
return c;
};
};
var reA = /[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g;
var reB = new RegExp(reA.source, "g");
function zero(b) {
return function() {
return b;
};
}
function one(b) {
return function(t) {
return b(t) + "";
};
}
function string(a, b) {
var bi = reA.lastIndex = reB.lastIndex = 0, // scan index for next number in b
am, // current match in a
bm, // current match in b
bs, // string preceding current number in b, if any
i = -1, // index in s
s = [], // string constants and placeholders
q = []; // number interpolators
// Coerce inputs to strings.
a = a + "", b = b + "";
// Interpolate pairs of numbers in a & b.
while ((am = reA.exec(a))
&& (bm = reB.exec(b))) {
if ((bs = bm.index) > bi) { // a string precedes the next number in b
bs = b.slice(bi, bs);
if (s[i]) s[i] += bs; // coalesce with previous string
else s[++i] = bs;
}
if ((am = am[0]) === (bm = bm[0])) { // numbers in a & b match
if (s[i]) s[i] += bm; // coalesce with previous string
else s[++i] = bm;
} else { // interpolate non-matching numbers
s[++i] = null;
q.push({i: i, x: number(am, bm)});
}
bi = reB.lastIndex;
}
// Add remains of b.
if (bi < b.length) {
bs = b.slice(bi);
if (s[i]) s[i] += bs; // coalesce with previous string
else s[++i] = bs;
}
// Special optimization for only a single match.
// Otherwise, interpolate each of the numbers and rejoin the string.
return s.length < 2 ? (q[0]
? one(q[0].x)
: zero(b))
: (b = q.length, function(t) {
for (var i = 0, o; i < b; ++i) s[(o = q[i]).i] = o.x(t);
return s.join("");
});
};
var values = [
function(a, b) {
var t = typeof b, c;
return (t === "string" ? ((c = d3Color.color(b)) ? (b = c, rgb) : string)
: b instanceof d3Color.color ? rgb
: Array.isArray(b) ? array
: t === "object" && isNaN(b) ? object
: number)(a, b);
}
];
function value(a, b) {
var i = values.length, f;
while (--i >= 0 && !(f = values[i](a, b)));
return f;
};
// TODO sparse arrays?
function array(a, b) {
var x = [],
c = [],
na = a.length,
nb = b.length,
n0 = Math.min(a.length, b.length),
i;
for (i = 0; i < n0; ++i) x.push(value(a[i], b[i]));
for (; i < na; ++i) c[i] = a[i];
for (; i < nb; ++i) c[i] = b[i];
return function(t) {
for (i = 0; i < n0; ++i) c[i] = x[i](t);
return c;
};
};
function round(a, b) {
return a = +a, b -= a, function(t) {
return Math.round(a + b * t);
};
};
var rad2deg = 180 / Math.PI;
var identity = {a: 1, b: 0, c: 0, d: 1, e: 0, f: 0};
var g;
// Compute x-scale and normalize the first row.
// Compute shear and make second row orthogonal to first.
// Compute y-scale and normalize the second row.
// Finally, compute the rotation.
function Transform(string) {
if (!g) g = document.createElementNS("http://www.w3.org/2000/svg", "g");
if (string) g.setAttribute("transform", string), t = g.transform.baseVal.consolidate();
var t,
m = t ? t.matrix : identity,
r0 = [m.a, m.b],
r1 = [m.c, m.d],
kx = normalize(r0),
kz = dot(r0, r1),
ky = normalize(combine(r1, r0, -kz)) || 0;
if (r0[0] * r1[1] < r1[0] * r0[1]) {
r0[0] *= -1;
r0[1] *= -1;
kx *= -1;
kz *= -1;
}
this.rotate = (kx ? Math.atan2(r0[1], r0[0]) : Math.atan2(-r1[0], r1[1])) * rad2deg;
this.translate = [m.e, m.f];
this.scale = [kx, ky];
this.skew = ky ? Math.atan2(kz, ky) * rad2deg : 0;
}
function dot(a, b) {
return a[0] * b[0] + a[1] * b[1];
}
function normalize(a) {
var k = Math.sqrt(dot(a, a));
if (k) a[0] /= k, a[1] /= k;
return k;
}
function combine(a, b, k) {
a[0] += k * b[0];
a[1] += k * b[1];
return a;
}
function pop(s) {
return s.length ? s.pop() + "," : "";
}
function translate(ta, tb, s, q) {
if (ta[0] !== tb[0] || ta[1] !== tb[1]) {
var i = s.push("translate(", null, ",", null, ")");
q.push({i: i - 4, x: number(ta[0], tb[0])}, {i: i - 2, x: number(ta[1], tb[1])});
} else if (tb[0] || tb[1]) {
s.push("translate(" + tb + ")");
}
}
function rotate(ra, rb, s, q) {
if (ra !== rb) {
if (ra - rb > 180) rb += 360; else if (rb - ra > 180) ra += 360; // shortest path
q.push({i: s.push(pop(s) + "rotate(", null, ")") - 2, x: number(ra, rb)});
} else if (rb) {
s.push(pop(s) + "rotate(" + rb + ")");
}
}
function skew(wa, wb, s, q) {
if (wa !== wb) {
q.push({i: s.push(pop(s) + "skewX(", null, ")") - 2, x: number(wa, wb)});
} else if (wb) {
s.push(pop(s) + "skewX(" + wb + ")");
}
}
function scale(ka, kb, s, q) {
if (ka[0] !== kb[0] || ka[1] !== kb[1]) {
var i = s.push(pop(s) + "scale(", null, ",", null, ")");
q.push({i: i - 4, x: number(ka[0], kb[0])}, {i: i - 2, x: number(ka[1], kb[1])});
} else if (kb[0] !== 1 || kb[1] !== 1) {
s.push(pop(s) + "scale(" + kb + ")");
}
}
function transform(a, b) {
var s = [], // string constants and placeholders
q = []; // number interpolators
a = new Transform(a), b = new Transform(b);
translate(a.translate, b.translate, s, q);
rotate(a.rotate, b.rotate, s, q);
skew(a.skew, b.skew, s, q);
scale(a.scale, b.scale, s, q);
a = b = null; // gc
return function(t) {
var i = -1, n = q.length, o;
while (++i < n) s[(o = q[i]).i] = o.x(t);
return s.join("");
};
};
var rho = Math.SQRT2;
var rho2 = 2;
var rho4 = 4;
var epsilon2 = 1e-12;
function cosh(x) {
return ((x = Math.exp(x)) + 1 / x) / 2;
}
function sinh(x) {
return ((x = Math.exp(x)) - 1 / x) / 2;
}
function tanh(x) {
return ((x = Math.exp(2 * x)) - 1) / (x + 1);
}
// p0 = [ux0, uy0, w0]
// p1 = [ux1, uy1, w1]
function zoom(p0, p1) {
var ux0 = p0[0], uy0 = p0[1], w0 = p0[2],
ux1 = p1[0], uy1 = p1[1], w1 = p1[2],
dx = ux1 - ux0,
dy = uy1 - uy0,
d2 = dx * dx + dy * dy,
i,
S;
// Special case for u0 ≅ u1.
if (d2 < epsilon2) {
S = Math.log(w1 / w0) / rho;
i = function(t) {
return [
ux0 + t * dx,
uy0 + t * dy,
w0 * Math.exp(rho * t * S)
];
}
}
// General case.
else {
var d1 = Math.sqrt(d2),
b0 = (w1 * w1 - w0 * w0 + rho4 * d2) / (2 * w0 * rho2 * d1),
b1 = (w1 * w1 - w0 * w0 - rho4 * d2) / (2 * w1 * rho2 * d1),
r0 = Math.log(Math.sqrt(b0 * b0 + 1) - b0),
r1 = Math.log(Math.sqrt(b1 * b1 + 1) - b1);
S = (r1 - r0) / rho;
i = function(t) {
var s = t * S,
coshr0 = cosh(r0),
u = w0 / (rho2 * d1) * (coshr0 * tanh(rho * s + r0) - sinh(r0));
return [
ux0 + u * dx,
uy0 + u * dy,
w0 * coshr0 / cosh(rho * s + r0)
];
}
}
i.duration = S * 1000;
return i;
};
function hsl(a, b) {
a = d3Color.hsl(a);
b = d3Color.hsl(b);
var ah = isNaN(a.h) ? b.h : a.h,
as = isNaN(a.s) ? b.s : a.s,
al = a.l,
bh = isNaN(b.h) ? 0 : deltaHue(b.h, ah),
bs = isNaN(b.s) ? 0 : b.s - as,
bl = b.l - al;
return function(t) {
a.h = ah + bh * t;
a.s = as + bs * t;
a.l = al + bl * t;
return a + "";
};
};
function hslLong(a, b) {
a = d3Color.hsl(a);
b = d3Color.hsl(b);
var ah = isNaN(a.h) ? b.h : a.h,
as = isNaN(a.s) ? b.s : a.s,
al = a.l,
bh = isNaN(b.h) ? 0 : b.h - ah,
bs = isNaN(b.s) ? 0 : b.s - as,
bl = b.l - al;
return function(t) {
a.h = ah + bh * t;
a.s = as + bs * t;
a.l = al + bl * t;
return a + "";
};
};
function lab(a, b) {
a = d3Color.lab(a);
b = d3Color.lab(b);
var al = a.l,
aa = a.a,
ab = a.b,
bl = b.l - al,
ba = b.a - aa,
bb = b.b - ab;
return function(t) {
a.l = al + bl * t;
a.a = aa + ba * t;
a.b = ab + bb * t;
return a + "";
};
};
function hcl(a, b) {
a = d3Color.hcl(a);
b = d3Color.hcl(b);
var ah = isNaN(a.h) ? b.h : a.h,
ac = isNaN(a.c) ? b.c : a.c,
al = a.l,
bh = isNaN(b.h) ? 0 : deltaHue(b.h, ah),
bc = isNaN(b.c) ? 0 : b.c - ac,
bl = b.l - al;
return function(t) {
a.h = ah + bh * t;
a.c = ac + bc * t;
a.l = al + bl * t;
return a + "";
};
};
function hclLong(a, b) {
a = d3Color.hcl(a);
b = d3Color.hcl(b);
var ah = isNaN(a.h) ? b.h : a.h,
ac = isNaN(a.c) ? b.c : a.c,
al = a.l,
bh = isNaN(b.h) ? 0 : b.h - ah,
bc = isNaN(b.c) ? 0 : b.c - ac,
bl = b.l - al;
return function(t) {
a.h = ah + bh * t;
a.c = ac + bc * t;
a.l = al + bl * t;
return a + "";
};
};
var cubehelix = cubehelixGamma(1);
var cubehelixLong = cubehelixGammaLong(1);
var version = "0.2.0";
exports.version = version;
exports.cubehelix = cubehelix;
exports.cubehelixLong = cubehelixLong;
exports.cubehelixGamma = cubehelixGamma;
exports.cubehelixGammaLong = cubehelixGammaLong;
exports.array = array;
exports.number = number;
exports.object = object;
exports.round = round;
exports.string = string;
exports.transform = transform;
exports.values = values;
exports.value = value;
exports.zoom = zoom;
exports.rgb = rgb;
exports.hsl = hsl;
exports.hslLong = hslLong;
exports.lab = lab;
exports.hcl = hcl;
exports.hclLong = hclLong;
}));
/***/ },
/* 5 */
/***/ function(module, exports, __webpack_require__) {
(function (global, factory) {
true ? factory(exports) :
typeof define === 'function' && define.amd ? define('d3-color', ['exports'], factory) :
factory((global.d3_color = {}));
}(this, function (exports) { 'use strict';
function Color() {};
var reHex3 = /^#([0-9a-f]{3})$/;
var reHex6 = /^#([0-9a-f]{6})$/;
var reRgbInteger = /^rgb\(\s*([-+]?\d+)\s*,\s*([-+]?\d+)\s*,\s*([-+]?\d+)\s*\)$/;
var reRgbPercent = /^rgb\(\s*([-+]?\d+(?:\.\d+)?)%\s*,\s*([-+]?\d+(?:\.\d+)?)%\s*,\s*([-+]?\d+(?:\.\d+)?)%\s*\)$/;
var reHslPercent = /^hsl\(\s*([-+]?\d+(?:\.\d+)?)\s*,\s*([-+]?\d+(?:\.\d+)?)%\s*,\s*([-+]?\d+(?:\.\d+)?)%\s*\)$/;
color.prototype = Color.prototype = {
displayable: function() {
return this.rgb().displayable();
},
toString: function() {
return this.rgb() + "";
}
};
function color(format) {
var m;
format = (format + "").trim().toLowerCase();
return (m = reHex3.exec(format)) ? (m = parseInt(m[1], 16), rgb((m >> 8 & 0xf) | (m >> 4 & 0x0f0), (m >> 4 & 0xf) | (m & 0xf0), ((m & 0xf) << 4) | (m & 0xf))) // #f00
: (m = reHex6.exec(format)) ? rgbn(parseInt(m[1], 16)) // #ff0000
: (m = reRgbInteger.exec(format)) ? rgb(m[1], m[2], m[3]) // rgb(255,0,0)
: (m = reRgbPercent.exec(format)) ? rgb(m[1] * 255 / 100, m[2] * 255 / 100, m[3] * 255 / 100) // rgb(100%,0%,0%)
: (m = reHslPercent.exec(format)) ? hsl(m[1], m[2] / 100, m[3] / 100) // hsl(120,50%,50%)
: named.hasOwnProperty(format) ? rgbn(named[format])
: null;
};
function rgbn(n) {
return rgb(n >> 16 & 0xff, n >> 8 & 0xff, n & 0xff);
}
var named = {
aliceblue: 0xf0f8ff,
antiquewhite: 0xfaebd7,
aqua: 0x00ffff,
aquamarine: 0x7fffd4,
azure: 0xf0ffff,
beige: 0xf5f5dc,
bisque: 0xffe4c4,
black: 0x000000,
blanchedalmond: 0xffebcd,
blue: 0x0000ff,
blueviolet: 0x8a2be2,
brown: 0xa52a2a,
burlywood: 0xdeb887,
cadetblue: 0x5f9ea0,
chartreuse: 0x7fff00,
chocolate: 0xd2691e,
coral: 0xff7f50,
cornflowerblue: 0x6495ed,
cornsilk: 0xfff8dc,
crimson: 0xdc143c,
cyan: 0x00ffff,
darkblue: 0x00008b,
darkcyan: 0x008b8b,
darkgoldenrod: 0xb8860b,
darkgray: 0xa9a9a9,
darkgreen: 0x006400,
darkgrey: 0xa9a9a9,
darkkhaki: 0xbdb76b,
darkmagenta: 0x8b008b,
darkolivegreen: 0x556b2f,
darkorange: 0xff8c00,
darkorchid: 0x9932cc,
darkred: 0x8b0000,
darksalmon: 0xe9967a,
darkseagreen: 0x8fbc8f,
darkslateblue: 0x483d8b,
darkslategray: 0x2f4f4f,
darkslategrey: 0x2f4f4f,
darkturquoise: 0x00ced1,
darkviolet: 0x9400d3,
deeppink: 0xff1493,
deepskyblue: 0x00bfff,
dimgray: 0x696969,
dimgrey: 0x696969,
dodgerblue: 0x1e90ff,
firebrick: 0xb22222,
floralwhite: 0xfffaf0,
forestgreen: 0x228b22,
fuchsia: 0xff00ff,
gainsboro: 0xdcdcdc,
ghostwhite: 0xf8f8ff,
gold: 0xffd700,
goldenrod: 0xdaa520,
gray: 0x808080,
green: 0x008000,
greenyellow: 0xadff2f,
grey: 0x808080,
honeydew: 0xf0fff0,
hotpink: 0xff69b4,
indianred: 0xcd5c5c,
indigo: 0x4b0082,
ivory: 0xfffff0,
khaki: 0xf0e68c,
lavender: 0xe6e6fa,
lavenderblush: 0xfff0f5,
lawngreen: 0x7cfc00,
lemonchiffon: 0xfffacd,
lightblue: 0xadd8e6,
lightcoral: 0xf08080,
lightcyan: 0xe0ffff,
lightgoldenrodyellow: 0xfafad2,
lightgray: 0xd3d3d3,
lightgreen: 0x90ee90,
lightgrey: 0xd3d3d3,
lightpink: 0xffb6c1,
lightsalmon: 0xffa07a,
lightseagreen: 0x20b2aa,
lightskyblue: 0x87cefa,
lightslategray: 0x778899,
lightslategrey: 0x778899,
lightsteelblue: 0xb0c4de,
lightyellow: 0xffffe0,
lime: 0x00ff00,
limegreen: 0x32cd32,
linen: 0xfaf0e6,
magenta: 0xff00ff,
maroon: 0x800000,
mediumaquamarine: 0x66cdaa,
mediumblue: 0x0000cd,
mediumorchid: 0xba55d3,
mediumpurple: 0x9370db,
mediumseagreen: 0x3cb371,
mediumslateblue: 0x7b68ee,
mediumspringgreen: 0x00fa9a,
mediumturquoise: 0x48d1cc,
mediumvioletred: 0xc71585,
midnightblue: 0x191970,
mintcream: 0xf5fffa,
mistyrose: 0xffe4e1,
moccasin: 0xffe4b5,
navajowhite: 0xffdead,
navy: 0x000080,
oldlace: 0xfdf5e6,
olive: 0x808000,
olivedrab: 0x6b8e23,
orange: 0xffa500,
orangered: 0xff4500,
orchid: 0xda70d6,
palegoldenrod: 0xeee8aa,
palegreen: 0x98fb98,
paleturquoise: 0xafeeee,
palevioletred: 0xdb7093,
papayawhip: 0xffefd5,
peachpuff: 0xffdab9,
peru: 0xcd853f,
pink: 0xffc0cb,
plum: 0xdda0dd,
powderblue: 0xb0e0e6,
purple: 0x800080,
rebeccapurple: 0x663399,
red: 0xff0000,
rosybrown: 0xbc8f8f,
royalblue: 0x4169e1,
saddlebrown: 0x8b4513,
salmon: 0xfa8072,
sandybrown: 0xf4a460,
seagreen: 0x2e8b57,
seashell: 0xfff5ee,
sienna: 0xa0522d,
silver: 0xc0c0c0,
skyblue: 0x87ceeb,
slateblue: 0x6a5acd,
slategray: 0x708090,
slategrey: 0x708090,
snow: 0xfffafa,
springgreen: 0x00ff7f,
steelblue: 0x4682b4,
tan: 0xd2b48c,
teal: 0x008080,
thistle: 0xd8bfd8,
tomato: 0xff6347,
turquoise: 0x40e0d0,
violet: 0xee82ee,
wheat: 0xf5deb3,
white: 0xffffff,
whitesmoke: 0xf5f5f5,
yellow: 0xffff00,
yellowgreen: 0x9acd32
};
var darker = .7;
var brighter = 1 / darker;
function rgb(r, g, b) {
if (arguments.length === 1) {
if (!(r instanceof Color)) r = color(r);
if (r) {
r = r.rgb();
b = r.b;
g = r.g;
r = r.r;
} else {
r = g = b = NaN;
}
}
return new Rgb(r, g, b);
};
function Rgb(r, g, b) {
this.r = +r;
this.g = +g;
this.b = +b;
};
var prototype = rgb.prototype = Rgb.prototype = new Color;
prototype.brighter = function(k) {
k = k == null ? brighter : Math.pow(brighter, k);
return new Rgb(this.r * k, this.g * k, this.b * k);
};
prototype.darker = function(k) {
k = k == null ? darker : Math.pow(darker, k);
return new Rgb(this.r * k, this.g * k, this.b * k);
};
prototype.rgb = function() {
return this;
};
prototype.displayable = function() {
return (0 <= this.r && this.r <= 255)
&& (0 <= this.g && this.g <= 255)
&& (0 <= this.b && this.b <= 255);
};
prototype.toString = function() {
var r = Math.round(this.r),
g = Math.round(this.g),
b = Math.round(this.b);
return "#"
+ (isNaN(r) || r <= 0 ? "00" : r < 16 ? "0" + r.toString(16) : r >= 255 ? "ff" : r.toString(16))
+ (isNaN(g) || g <= 0 ? "00" : g < 16 ? "0" + g.toString(16) : g >= 255 ? "ff" : g.toString(16))
+ (isNaN(b) || b <= 0 ? "00" : b < 16 ? "0" + b.toString(16) : b >= 255 ? "ff" : b.toString(16));
};
function hsl(h, s, l) {
if (arguments.length === 1) {
if (h instanceof Hsl) {
l = h.l;
s = h.s;
h = h.h;
} else {
if (!(h instanceof Color)) h = color(h);
if (h) {
if (h instanceof Hsl) return h;
h = h.rgb();
var r = h.r / 255,
g = h.g / 255,
b = h.b / 255,
min = Math.min(r, g, b),
max = Math.max(r, g, b),
range = max - min;
l = (max + min) / 2;
if (range) {
s = l < .5 ? range / (max + min) : range / (2 - max - min);
if (r === max) h = (g - b) / range + (g < b) * 6;
else if (g === max) h = (b - r) / range + 2;
else h = (r - g) / range + 4;
h *= 60;
} else {
h = NaN;
s = l > 0 && l < 1 ? 0 : h;
}
} else {
h = s = l = NaN;
}
}
}
return new Hsl(h, s, l);
};
function Hsl(h, s, l) {
this.h = +h;
this.s = +s;
this.l = +l;
};
var prototype$1 = hsl.prototype = Hsl.prototype = new Color;
prototype$1.brighter = function(k) {
k = k == null ? brighter : Math.pow(brighter, k);
return new Hsl(this.h, this.s, this.l * k);
};
prototype$1.darker = function(k) {
k = k == null ? darker : Math.pow(darker, k);
return new Hsl(this.h, this.s, this.l * k);
};
prototype$1.rgb = function() {
var h = this.h % 360 + (this.h < 0) * 360,
s = isNaN(h) || isNaN(this.s) ? 0 : this.s,
l = this.l,
m2 = l + (l < .5 ? l : 1 - l) * s,
m1 = 2 * l - m2;
return new Rgb(
hsl2rgb(h >= 240 ? h - 240 : h + 120, m1, m2),
hsl2rgb(h, m1, m2),
hsl2rgb(h < 120 ? h + 240 : h - 120, m1, m2)
);
};
prototype$1.displayable = function() {
return (0 <= this.s && this.s <= 1 || isNaN(this.s))
&& (0 <= this.l && this.l <= 1);
};
/* From FvD 13.37, CSS Color Module Level 3 */
function hsl2rgb(h, m1, m2) {
return (h < 60 ? m1 + (m2 - m1) * h / 60
: h < 180 ? m2
: h < 240 ? m1 + (m2 - m1) * (240 - h) / 60
: m1) * 255;
}
var deg2rad = Math.PI / 180;
var rad2deg = 180 / Math.PI;
function hcl(h, c, l) {
if (arguments.length === 1) {
if (h instanceof Hcl) {
l = h.l;
c = h.c;
h = h.h;
} else {
if (!(h instanceof Lab)) h = lab(h);
l = h.l;
c = Math.sqrt(h.a * h.a + h.b * h.b);
h = Math.atan2(h.b, h.a) * rad2deg;
if (h < 0) h += 360;
}
}
return new Hcl(h, c, l);
};
function Hcl(h, c, l) {
this.h = +h;
this.c = +c;
this.l = +l;
};
var prototype$3 = hcl.prototype = Hcl.prototype = new Color;
prototype$3.brighter = function(k) {
return new Hcl(this.h, this.c, this.l + Kn * (k == null ? 1 : k));
};
prototype$3.darker = function(k) {
return new Hcl(this.h, this.c, this.l - Kn * (k == null ? 1 : k));
};
prototype$3.rgb = function() {
return lab(this).rgb();
};
var Kn = 18;
var Xn = 0.950470;
var Yn = 1;
var Zn = 1.088830;
var t0 = 4 / 29;
var t1 = 6 / 29;
var t2 = 3 * t1 * t1;
var t3 = t1 * t1 * t1;
function lab(l, a, b) {
if (arguments.length === 1) {
if (l instanceof Lab) {
b = l.b;
a = l.a;
l = l.l;
} else if (l instanceof Hcl) {
var h = l.h * deg2rad;
b = Math.sin(h) * l.c;
a = Math.cos(h) * l.c;
l = l.l;
} else {
if (!(l instanceof Rgb)) l = rgb(l);
var r = rgb2xyz(l.r),
g = rgb2xyz(l.g),
b = rgb2xyz(l.b),
x = xyz2lab((0.4124564 * r + 0.3575761 * g + 0.1804375 * b) / Xn),
y = xyz2lab((0.2126729 * r + 0.7151522 * g + 0.0721750 * b) / Yn),
z = xyz2lab((0.0193339 * r + 0.1191920 * g + 0.9503041 * b) / Zn);
b = 200 * (y - z);
a = 500 * (x - y);
l = 116 * y - 16;
}
}
return new Lab(l, a, b);
};
function Lab(l, a, b) {
this.l = +l;
this.a = +a;
this.b = +b;
};
var prototype$2 = lab.prototype = Lab.prototype = new Color;
prototype$2.brighter = function(k) {
return new Lab(this.l + Kn * (k == null ? 1 : k), this.a, this.b);
};
prototype$2.darker = function(k) {
return new Lab(this.l - Kn * (k == null ? 1 : k), this.a, this.b);
};
prototype$2.rgb = function() {
var y = (this.l + 16) / 116,
x = isNaN(this.a) ? y : y + this.a / 500,
z = isNaN(this.b) ? y : y - this.b / 200;
y = Yn * lab2xyz(y);
x = Xn * lab2xyz(x);
z = Zn * lab2xyz(z);
return new Rgb(
xyz2rgb( 3.2404542 * x - 1.5371385 * y - 0.4985314 * z), // D65 -> sRGB
xyz2rgb(-0.9692660 * x + 1.8760108 * y + 0.0415560 * z),
xyz2rgb( 0.0556434 * x - 0.2040259 * y + 1.0572252 * z)
);
};
function xyz2lab(t) {
return t > t3 ? Math.pow(t, 1 / 3) : t / t2 + t0;
}
function lab2xyz(t) {
return t > t1 ? t * t * t : t2 * (t - t0);
}
function xyz2rgb(x) {
return 255 * (x <= 0.0031308 ? 12.92 * x : 1.055 * Math.pow(x, 1 / 2.4) - 0.055);
}
function rgb2xyz(x) {
return (x /= 255) <= 0.04045 ? x / 12.92 : Math.pow((x + 0.055) / 1.055, 2.4);
}
var A = -0.14861;
var B = +1.78277;
var C = -0.29227;
var D = -0.90649;
var E = +1.97294;
var ED = E * D;
var EB = E * B;
var BC_DA = B * C - D * A;
function cubehelix(h, s, l) {
if (arguments.length === 1) {
if (h instanceof Cubehelix) {
l = h.l;
s = h.s;
h = h.h;
} else {
if (!(h instanceof Rgb)) h = rgb(h);
var r = h.r / 255, g = h.g / 255, b = h.b / 255;
l = (BC_DA * b + ED * r - EB * g) / (BC_DA + ED - EB);
var bl = b - l, k = (E * (g - l) - C * bl) / D;
s = Math.sqrt(k * k + bl * bl) / (E * l * (1 - l)); // NaN if l=0 or l=1
h = s ? Math.atan2(k, bl) * rad2deg - 120 : NaN;
if (h < 0) h += 360;
}
}
return new Cubehelix(h, s, l);
};
function Cubehelix(h, s, l) {
this.h = +h;
this.s = +s;
this.l = +l;
};
var prototype$4 = cubehelix.prototype = Cubehelix.prototype = new Color;
prototype$4.brighter = function(k) {
k = k == null ? brighter : Math.pow(brighter, k);
return new Cubehelix(this.h, this.s, this.l * k);
};
prototype$4.darker = function(k) {
k = k == null ? darker : Math.pow(darker, k);
return new Cubehelix(this.h, this.s, this.l * k);
};
prototype$4.rgb = function() {
var h = isNaN(this.h) ? 0 : (this.h + 120) * deg2rad,
l = +this.l,
a = isNaN(this.s) ? 0 : this.s * l * (1 - l),
cosh = Math.cos(h),
sinh = Math.sin(h);
return new Rgb(
255 * (l + a * (A * cosh + B * sinh)),
255 * (l + a * (C * cosh + D * sinh)),
255 * (l + a * (E * cosh))
);
};
var version = "0.3.1";
exports.version = version;
exports.color = color;
exports.rgb = rgb;
exports.hsl = hsl;
exports.lab = lab;
exports.hcl = hcl;
exports.cubehelix = cubehelix;
}));
/***/ },
/* 6 */
/***/ function(module, exports, __webpack_require__) {
(function (global, factory) {
true ? factory(exports) :
typeof define === 'function' && define.amd ? define('d3-timer', ['exports'], factory) :
factory((global.d3_timer = {}));
}(this, function (exports) { 'use strict';
var frame = 0;
var timeout = 0;
var taskHead;
var taskTail;
var taskId = 0;
var taskById = {};
var setFrame = typeof window !== "undefined"
&& (window.requestAnimationFrame
|| window.msRequestAnimationFrame
|| window.mozRequestAnimationFrame
|| window.webkitRequestAnimationFrame
|| window.oRequestAnimationFrame)
|| function(callback) { return setTimeout(callback, 17); };
function Timer(callback, delay, time) {
this.id = ++taskId;
this.restart(callback, delay, time);
}
Timer.prototype = timer.prototype = {
restart: function(callback, delay, time) {
if (typeof callback !== "function") throw new TypeError("callback is not a function");
time = (time == null ? Date.now() : +time) + (delay == null ? 0 : +delay);
var i = this.id, t = taskById[i];
if (t) {
t.callback = callback, t.time = time;
} else {
t = {next: null, callback: callback, time: time};
if (taskTail) taskTail.next = t; else taskHead = t;
taskById[i] = taskTail = t;
}
sleep();
},
stop: function() {
var i = this.id, t = taskById[i];
if (t) {
t.callback = null, t.time = Infinity;
delete taskById[i];
sleep();
}
}
};
function timer(callback, delay, time) {
return new Timer(callback, delay, time);
};
function timerFlush(time) {
time = time == null ? Date.now() : +time;
++frame; // Pretend we’ve set an alarm, if we haven’t already.
try {
var t = taskHead, c;
while (t) {
if (time >= t.time) c = t.callback, c(time - t.time, time);
t = t.next;
}
} finally {
--frame;
}
};
function wake() {
frame = timeout = 0;
try {
timerFlush();
} finally {
var t0, t1 = taskHead, time = Infinity;
while (t1) {
if (t1.callback) {
if (time > t1.time) time = t1.time;
t1 = (t0 = t1).next;
} else {
t1 = t0 ? t0.next = t1.next : taskHead = t1.next;
}
}
taskTail = t0;
sleep(time);
}
}
function sleep(time) {
if (frame) return; // Soonest alarm already set, or will be.
if (timeout) timeout = clearTimeout(timeout);
var delay = time - Date.now();
if (delay > 24) { if (time < Infinity) timeout = setTimeout(wake, delay); }
else frame = 1, setFrame(wake);
}
var version = "0.0.6";
exports.version = version;
exports.timer = timer;
exports.timerFlush = timerFlush;
}));
/***/ },
/* 7 */
/***/ function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
var _lodash = __webpack_require__(8);
var _lodash2 = _interopRequireDefault(_lodash);
var _d3Interpolate = __webpack_require__(4);
var _d3Interpolate2 = _interopRequireDefault(_d3Interpolate);
var isInterpolatable = function isInterpolatable(obj) {
// d3 turns null into 0 and undefined into NaN, which we don't want.
if (obj !== null) {
switch (typeof obj) {
case "undefined":
return false;
case "number":
// The standard `isNaN` is fine in this case since we already know the
// type is number.
return !isNaN(obj) && _lodash2["default"].isFinite(obj);
case "string":
// d3 might not *actually* be able to interpolate the string, but it
// won't cause any issues to let it try.
return true;
case "boolean":
// d3 turns Booleans into integers, which we don't want. Sure, we could
// interpolate from 0 -> 1, but we'd be sending a non-Boolean to
// something expecting a Boolean.
return false;
case "object":
// Don't try to interpolate class instances (except Date or Array).
return _lodash2["default"].isDate(obj) || _lodash2["default"].isArray(obj) || _lodash2["default"].isPlainObject(obj);
case "function":
// Careful! There may be extra properties on function objects that the
// component expects to access - for instance, it may be a `d3.scale()`
// function, which has its own methods attached. We don't know if the
// component is only going to call the function (in which case it's
// safely interpolatable) or if it's going to access special properties
// (in which case our function generated from `interpolateFunction` will
// most likely cause an error. We could check for enumerable properties
// on the function object here to see if it's a "plain" function, but
// let's just require that components prevent such function props from
// being animated in the first place.
return true;
}
}
return false;
};
exports.isInterpolatable = isInterpolatable;
/**
* Interpol