vasturiano / react-force-graph

React component for 2D, 3D, VR and AR force directed graphs
https://vasturiano.github.io/react-force-graph/example/large-graph/
MIT License
2.23k stars 284 forks source link

Particle direction configuration #546

Open angelzbg opened 2 weeks ago

angelzbg commented 2 weeks ago

Currently there is a prop linkDirectionalParticles which explains that particles travel in the direction source > target.

Is your feature request related to a problem? Please describe. Currently I have a graph, that has reversed source and target ids in order to be displayed similar to a three bottom up while still maintaing graph relations. When I turn the particles on they travel from source to target, but since they are reversed I need them to travel in the opposite direction.

Describe the solution you'd like It would be very nice to have a prop that can make the directional particles travel in reverse target > source.

vasturiano commented 1 week ago

@angelzbg why not just reverse the links? Something like this:

myData.links.forEach(link => {
  const source = link.source;
  link.source = link.target;
  link.target = source;
});