d3/d3-interpolate

Add option to modify ρ value in d3.interpolateZoom

fallenartist opened this issue · 6 comments

It would be great if the ρ value responsible for the curvature of the 'flight' path in d3.interpolateZoom function could be modified by users, e.g.:

interpolate.rho(ρ)

var i=d3.interpolateZoom.rho(.25)([ux0, uy0, w0],[ux1, uy1, w1]);

I would imagine the default ρ value would be the current √2.

It would also be good to have a value that produces linear path (e.g. ρ=0), making it a standard non-zoom interpolator.

What I'm not sure about is if the value should only be a constant or also a function, if there should be allowed min & max values, could it accept negative values and if it should be a set function or a get too?

See d3.interpolateRgb.gamma for precedent.

It should be a numeric constant, not a function. There should not be a getter; the method returns a new interpolator with the given rho value. I am ambivalent about whether it should automatically protect against invalid values; generally speaking I would say that’s not necessary.

Thanks. I looked at the d3.interpolateRgb.gamma but I'm afraid it's too advanced a task for a JS n00b like me.

I was also wondering if easing function could be customised similarly to map.flyTo in Mapbox GL? Many thanks.

Can you be more specific about what you are asking for? Easing functions are handled by transition.ease in D3; the suggested zoom duration is exposed by the interpolator. That leaves rho (which this issue already discussed) and a minimum zoom level parameter. So, are you asking for a minimum scale factor parameter?

No, sorry! Somehow I thought the zoom transition algorithm uses a fixed easing that can't be modified. Still learning the ropes!