home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 2000 August: Tool Chest / Dev.CD Aug 00 TC Disk 2.toast / pc / sample code / quicktime / quicktime for java / dsapplet.win / src / ds / actions / rotateaction.java < prev    next >
Encoding:
Java Source  |  2000-06-23  |  2.3 KB  |  65 lines

  1. /*
  2.  *        Biscotti Library
  3.  *
  4.  *        © 1996, Copyright, Apple Computer
  5.  *        All rights reserved
  6.  *
  7.  *        $Workfile:: RotateAction.java                                 $
  8.  *        $Archive:: /Biscotti/QTJavaDemos/Applets/DraggingSpritesApplet/src/ds/actions/RotateActi $
  9.  *
  10.  *        Authors: Bill Stewart
  11.  */
  12. package ds.actions;
  13.  
  14. import quicktime.app.actions.*;
  15. import quicktime.QTException;
  16. import quicktime.qd.*;
  17. import quicktime.std.StdQTException;
  18. import quicktime.std.image.Matrix;
  19. import quicktime.app.display.QTDrawable;
  20. import quicktime.app.image.Transformable;
  21. import java.awt.Dimension;
  22. /**
  23.  * This class provides the capability of moving and bouncing a Transformable
  24.  * object around within the space provided by the QTDrawable space that is
  25.  * the space within which the transformable object is displayed, by the amount specified
  26.  * by the deltaMatrix object.
  27.  */ 
  28. public class RotateAction extends MatrixAction {
  29. //____________________________ CLASS VARIABLES
  30. //____________________________ CLASS METHODS
  31.     /**
  32.      * Constructs a BounceAction object.
  33.      * @param deltaX the amount by which the object is moved in the X dimension
  34.      * @param deltaY the amount by which the object is moved in the Y dimension
  35.      * @param space the space within which the object will be bounced and moved
  36.      * @param scale the amount with which a second is divided into at a rate of one
  37.      * @param period the number of scale ticks that elapse between invocations of the action.
  38.      * @param target the target of the bounce action - the object that is moved
  39.      */
  40.     public RotateAction (int scale, int period, QTDrawable space, Transformable t) throws QTException {
  41.         super (scale, period, space, t);
  42.         doConstraintBoundsTesting = false;
  43.      }
  44.  
  45. //____________________________ INSTANCE VARIABLES
  46.     private float deltaDegree = 1;
  47. //____________________________ INSTANCE METHODS    
  48.     protected void rateDirectionChanged (boolean forwards) throws QTException {
  49.         deltaDegree = -deltaDegree;
  50.     }
  51.     
  52.     protected void transformMatrix (Matrix theMatrix) throws QTException {
  53.         theMatrix.rotate (deltaDegree, theMatrix.getTx(), theMatrix.getTy());
  54.     }
  55. }
  56.  
  57. /*
  58.  * $Log: /Biscotti/QTJavaDemos/Applets/DraggingSpritesApplet/src/ds/actions/RotateAction.java $
  59.  * 
  60.  * 1     5/05/99 3:18p Anant Sonone
  61.  * 
  62.  * 1     16/11/98 6:50 PM Bill Stewart
  63.  * new action
  64.  */
  65.