Skip to content

Animating Area path with React Spring #1317

Answered by williaster
leo-petrucci asked this question in Q&A
Discussion options

You must be logged in to vote

Hey @creativiii , yeah this wasn't as straight forward as I expected when implementing it for @visx/xychart and I hit the same arity issue you mention. I think overall react-spring default interpolation won't work when you have varying numbers of points.

The solution I used in xychart was to use the d3-interpolate-path as the interpolator and use react-spring to tween from 0 -> 1. If you are specifically interested in areas/closed paths, you might want to check out flubber 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…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@leo-petrucci
Comment options

Answer selected by leo-petrucci
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants