package graph.test; import java.util.*; import graph.*; import graph.animation.*; import java.awt.Color; /** * A class which randomly moves and flashes nodes * to test the various animation features in the * package. * * @author Michael Shilman (michaels@eecs.berkeley.edu) * @version $Id$ */ public class TestAnimationAction implements Action { static Random s_rand = new Random(System.currentTimeMillis()); public TestAnimationAction() { } public void init(Graph g) { } public void finish(Graph g) { } public void apply(Graph g) { step(g); } public void step(Graph g) { int randIndex = (int)(s_rand.nextFloat()*g.nodes.size()); Node n = (Node)g.nodes.elementAt(randIndex); //if(s_rand.nextFloat() > .5f) { // n.rep.fill = null; //} //else { Animator.scale(n, n.w*3, n.h*3); Animator.move(n, n.x+300, n.y+300); Animator.flash(n,100); //} } }