It is not only a fully functional graph visualization library, but also an explorer of data relationships.
!!!###!!!title=Animations——VisActor/VGraph tutorial documents!!!###!!!!!!###!!!description=Animation is an important part of graph analysis applications. The clever use of animation can greatly improve the efficiency and user experience of the application. vGraph encapsulates commonly used animation effects in graph analysis, which can be directly referenced by users. It also provides a general animation interface for flexible custom animation.The animation interface encapsulated by vGraph `animate(options) => string;` will return an animation id that can be used to stop the animation. The encapsulation configuration consists of the following four parts:- Animation object `target`: a specific node/edge instance;- Animation type `type`: specifies the type of encapsulated animation to be executed;- Custom configuration `custom`: different custom configurations for different animation types;- Common configuration `common`: common configurations such as animation duration and effects.!!!###!!!
Animation
Animation is an important part of graph analysis applications. The clever use of animation can greatly improve the efficiency and user experience of the application. vGraph encapsulates commonly used animation effects in graph analysis, which can be directly referenced by users. It also provides a general animation interface for flexible custom animation.
The animation interface encapsulated by vGraph animate(options) => string; will return an animation id that can be used to stop the animation. The encapsulation configuration consists of the following four parts:
Animation object target: a specific node/edge instance;
Animation type type: specifies the type of encapsulated animation to be executed;
Custom configuration custom: different custom configurations for different animation types;
Common configuration common: common configurations such as animation duration and effects.
Node diffuse animation
The node diffusion animation is often used to highlight one or more nodes. It can be an infinite animation, such as in this case for alarming abnormal nodes. It can also be a finite animation for lightweight node focus.
The node loading animation is commonly used as a user-friendly transition when waiting for a single node's data request. For example, in this case, it's the waiting animation between requesting data to refresh the node and updating the node's state.
The node flash animation is commonly used for lightweight focus on a single node. For example, in this case, the find node function will move the node to the center of the viewport and use a flash animation for lightweight focus. However, it is not recommended to set it as an infinite animation.
The custom configuration content is the style of the node's key shape. These styles will be applied during the flash animation and will be restored to their original state after the animation ends. For graphic style configuration, please refer to rect configuration.
Note: The custom configuration is suitable for infinite animations with simple style adjustments in conjunction with graph.stopAnimate(), which can conveniently and automatically restore the state of the connection line before the animation. If you are executing a single animation and need to retain the animation state until the mouse moves out, it is suitable to use it in combination with setState, as you can refer to this case.
common configuration
common configuration
Type
Description
duration
number
Duration of a single animation (ms), defaults to 400
repeat
boolean | number
Whether to repeat. When configured as a number, it indicates the number of times the animation repeats. Defaults to 2
The dashed line animation can vividly show the direction of data relationships and is suitable for infinite animations with some interactions. For example, in this case, this animation is applied to the entire related data link when hovering over a node.
custom configuration
The custom configuration content is the style of the node's key shape. These styles will be applied during the flash animation and will be restored to their original state after the animation ends. For graphic style configuration, please refer to rect configuration.
custom configuration
Type
Description
strokeStyle
string
The color of the connection line during animation, defaults to #3073FF
The connection line extension animation is suitable for showing the direct association of nodes. It can be a single animation or an infinite animation. For example, in this case, a single animation is applied to all connection lines starting from this node in conjunction with the state mechanism when hovering over the node.
The custom configuration content is the style of the node's key shape. These styles will be applied during the flash animation and will be restored to their original state after the animation ends. For graphic style configuration, please refer to rect configuration.
Note: The custom configuration is suitable for infinite animations with simple style adjustments in conjunction with graph.stopAnimate(), which can conveniently and automatically restore the state of the connection line before the animation. If you are executing a single animation and need to retain the animation state until the mouse moves out, it is suitable to use it in combination with setState, as you can refer to this case.
common configuration
common configuration
Type
Description
duration
number
Duration of a single animation (ms), defaults to 800
repeat
boolean | number
Whether to repeat. When configured as a number, it indicates the number of times the animation repeats. Defaults to 1.
The connection line trail animation is suitable for showing the direction of data relationships. It can be a single animation or an infinite animation, and can be used for displaying the running process of a pipeline, etc. For example, in this case, an infinite animation is defined for the connection line.
The gradient color of the light spot, stop range 0-1, color is the color of the corresponding percentage. The configuration is the same as createLinearGradient.
common configuration
common configuration
Type
Description
duration
number
Duration of a single animation (ms), defaults to 800
repeat
boolean | number
Whether to repeat. When configured as a number, it indicates the number of times the animation repeats. Defaults to 1.