g6/packages/site/docs/manual/tutorial/animation.en.md
2023-02-02 10:31:36 +08:00

1.3 KiB

title order
Animation* 6

The animation mechanism is too complicated to understand by beginners and out of the scope of the tutorial. In this chapter, we only introduce the animation in G6 briefly. For more information, please refer to Basic Animation.

There are two levels of animation in G6:

  • GLobal animation: Transform the graph animatively when the changes are global;
  • Item animation: The animation on a node or an edge.

Global Animation

The global animation is controlled by Graph instance. It takes effect when some global changes happen, such as:

  • graph.updateLayout(cfg)

Configure animate: true when instantiating a graph to achieve it.

Example

const graph = new G6.Graph({
  // ...                      // Other configurations
  animate: true, // Boolean, whether to activate the animation when global changes happen
});

Item Animation

G6 allows user to customize animation for item when register a type of custom item.
img

img

For more cases, please refer to Animation Case.