Skip to content

Animation on node expand/collapse #3202

Closed Answered by geohuz
geohuz asked this question in Q&A
Jul 7, 2023 · 1 comments · 2 replies
Discussion options

You must be logged in to vote

Hi @alexander-azizi-martin sorry for the late reply, there are lots of things involved in the animation, two major parts

  1. state management, I'm not familiar with the xyflow's inner managment lib, I used mobx for the folding states of all the nodes, like folding direction, fold target, show fold icon true/false. And I use @dagrejs/graphlib as utillity to populate the nodes in my store and it helps to find all the edges of a certain node like inEdges outEdges functions etc.
  2. animation, once I have all the node folding related states managed in the store, I use react-spring to animate. Here is the example of the CustomEdge component I used to animate:
import { BaseEdge, getBezierPath, getSim…

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@alexander-azizi-martin
Comment options

@geohuz
Comment options

Answer selected by geohuz
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