Layout & Animation
When a diagram's layout changes — for example, switching from a vertical to a horizontal hierarchical view — instantly jumping nodes to new coordinates can be visually jarring. Leveraging Flow's high-performance DOM-based rendering, you can easily implement smooth, professional-grade layout animations using native CSS transitions.
Smooth Layout Transition Demo
Switch between layout directions below to see nodes and edges "swim" into their new positions with fluid, dampened motion.
Animated Layout Transition
Implementation Best Practices
- Transient Class Binding: Do not leave
transition: transformenabled permanently. This causes "input lag" when a user manually drags a node, as the node will try to transition to the mouse position rather than following it instantly. - Edge Path Animation: Modern browsers (Chrome/Edge/Safari) support transitioning the
dattribute of SVG<path>elements. As long as the number of path segments remains consistent, the edges will morph smoothly. - Cleanup: Always use a
setTimeoutor transition events to remove the animation class once the layout shift is complete. This restores the snappy, direct response feel for user interactions.