Animating Area path with React Spring #1317
-
I'm trying to animate I'm not using I assumed I would be able to put my path value into a
This works pretty well if the
Which causes the graph not to animate. Any tips on how to animate a line graph? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hey @creativiii , yeah this wasn't as straight forward as I expected when implementing it for The solution I used in Hope that helps! Also curious what customization you'd like in your graphs that |
Beta Was this translation helpful? Give feedback.
Hey @creativiii , yeah this wasn't as straight forward as I expected when implementing it for
@visx/xychart
and I hit the samearity
issue you mention. I think overallreact-spring
default interpolation won't work when you have varying numbers of points.The solution I used in
xychart
was to use thed3-interpolate-path
as the interpolator and usereact-spring
to tween from0 -> 1
. If you are specifically interested in areas/closed paths, you might want to check outflubber
which I think is by far the best interpolator, but it assumes closed paths (which is perfect for area but fails for lines).Hope that helps!
Also curious what customization you'd like in your graphs that
xychart
doesn't…