d3-interpolate icon indicating copy to clipboard operation
d3-interpolate copied to clipboard

Simple zoom-in with interpolateZoom gives negative duration

Open jjhembd opened this issue 4 years ago • 0 comments

If the starting and ending views are centered on the same point, but the ending width is smaller, the .duration property of the returned interpolator is negative. See https://observablehq.com/d/fa1442202b6a7936

Comparing to van Wijk and Nuij, the current code is missing the absolute value on the path length S.

image

Skipping the absolute value does simplify the interpolator (no need to track the k factor). I think it would be enough to take the absolute value when computing the duration.

jjhembd avatar Mar 04 '22 01:03 jjhembd