KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > prefuse > action > animate > LocationAnimator


1 package prefuse.action.animate;
2
3 import prefuse.action.ItemAction;
4 import prefuse.visual.VisualItem;
5
6
7 /**
8  * Animator that linearly interpolates between two positions. This
9  * is useful for performing animated transitions.
10  *
11  * @author <a HREF="http://jheer.org">jeffrey heer</a>
12  */

13 public class LocationAnimator extends ItemAction {
14
15     /**
16      * Create a new LocationAnimator that processes all data groups.
17      */

18     public LocationAnimator() {
19         super();
20     }
21     
22     /**
23      * Create a new LocationAnimator that processes the specified group.
24      * @param group the data group to process.
25      */

26     public LocationAnimator(String JavaDoc group) {
27         super(group);
28     }
29
30     /**
31      * @see prefuse.action.ItemAction#process(prefuse.visual.VisualItem, double)
32      */

33     public void process(VisualItem item, double frac) {
34         double sx = item.getStartX();
35         double sy = item.getStartY();
36         item.setX(sx + frac*(item.getEndX()-sx));
37         item.setY(sy + frac*(item.getEndY()-sy));
38     }
39
40 } // end of class LocationAnimator
41
Popular Tags