wikiacademia

site

Basic Animation

Node animation in prefuse is accomplished through the use of included layout routines. Actionlists for layout routines are created with Activity.INFINITY passed to the constructor. This means that, unlike the drawing actions, once started this actionlist will run constantly while the program is running
ActionList physics = new ActionList(Activity.INFINITY);
ForceDirectedLayout is one of the included layout routines, it's a simple layout which pushes nodes apart from each other when they come into close contact :
physics.add(new ForceDirectedLayout("graph"));

The RepaintAction is an included action which repaints everything on the screen. It must be placed in any layout routine otherwise the changes to the position of the nodes will not appear on the screen :
physics.add(new RepaintAction());