slow animation down a bit

This commit is contained in:
David Kaltschmidt
2015-09-08 14:00:52 +02:00
parent c0b0e5f807
commit 8dbb13a972
2 changed files with 6 additions and 3 deletions

View File

@@ -10,11 +10,13 @@ const line = d3.svg.line()
.x(function(d) { return d.x; })
.y(function(d) { return d.y; });
const animConfig = [80, 20]; // stiffness, bounce
const flattenPoints = function(points) {
const flattened = {};
points.forEach(function(point, i) {
flattened['x' + i] = {val: point.x};
flattened['y' + i] = {val: point.y};
flattened['x' + i] = {val: point.x, config: animConfig};
flattened['y' + i] = {val: point.y, config: animConfig};
});
return flattened;
};

View File

@@ -21,6 +21,7 @@ const Node = React.createClass({
const onMouseLeave = this.handleMouseLeave;
const classNames = ['node'];
const ellipsis = this.ellipsis;
const animConfig = [80, 20]; // stiffness, bounce
if (this.props.highlighted) {
classNames.push('highlighted');
@@ -31,7 +32,7 @@ const Node = React.createClass({
}
return (
<Spring endValue={{x: {val: this.props.dx}, y: {val: this.props.dy}}}>
<Spring endValue={{x: {val: this.props.dx, config: animConfig}, y: {val: this.props.dy, config: animConfig}}}>
{function(interpolated) {
const transform = 'translate(' + interpolated.x.val + ',' + interpolated.y.val + ')';
return (