| | | | Browse by category |
Question
How do I implement animation during a graph layout with JViews Diagrammer?
Answer
The IlvAnimationRenderer
is designed to display an animation showing how the nodes of the graph have moved during the last rendering step. When this renderer is used with an IlvGraphLayoutRenderer
, the animation shows how the nodes have been placed by the graph layout algorithm.
You can add the IlvAnimationRenderer
to the engine of the IlvDiagrammer
component by using the following code:
IlvSDMEngine engine = diagrammer.getEngine();
IlvAnimationRenderer animationRenderer = new IlvAnimationRenderer(engine.getRenderer());
animationRenderer.setResizingObjects(false);
engine.setRenderer(animationRenderer);
This can also be done in a CSS file as follows:
SDM { ... GraphLayout : "true" ;
Animation : "true";
} Animation { enabled : "true"; animationRate : "20"; animationDelay : "20"; resizingObjects : "false"; } GraphLayout { ... }
Note: The parameter
resizingObjects
can be true or false. However, when composites (IlvSDMCompositeNode
) are used, the parameter must be true.
The webviewer
sample in the distribution demonstrates how you can further customize the animation renderer.