Rotating shapes?

Does anyone know how to make moving shapes in Adobe Premiere Pro?
What I'm trying to do is making a square and have it rotate slowly e.g 90 degrees but stay in the same place (if that makes sense? lol)
Thanks.

Welcome to the forums.
This is easily accomplished with the PPro Titler. Create a title with a single square in the middle. Put that title on the timeline and click on it, then look in the Effect Controls Panel and keyframe the rotation parameter.
You will also find links to many free tutorials in the PremiereProPedia that will quickly show you how things are done in Premiere Pro.
Cheers
Eddie

Similar Messages

  • Problem in moving Rotated Shape object

    Hi All,
    I want to move the rotated shape object based on the mouse movement
    m able to move the object which is not rotated, but m facing the problem when i move the rotated object its moving position is not correct . I am expecting to maintain both shape objects movement is same, i mean if i did mouse movement to right rotated object moves upwards and normal object moves towards right insted of moving both r moving towards to right.
    Pls help me
    the following code is m using to moving the object
    The one which in red color is not rotated and the one which is in black color has rotated.
    import java.awt.Color;
    import java.awt.Graphics;
    import java.awt.Graphics2D;
    import java.awt.RenderingHints;
    import java.awt.Shape;
    import java.awt.event.MouseEvent;
    import java.awt.event.MouseListener;
    import java.awt.event.MouseMotionListener;
    import java.awt.geom.AffineTransform;
    import java.awt.geom.Point2D;
    import java.awt.geom.Rectangle2D;
    import javax.swing.JFrame;
    import javax.swing.JPanel;
    import com.clinapps.LDPConstants;
    public class MoveRotatedObj extends JFrame
         public MoveRotatedObj()
              JPanel pane = new Dorairaj();
              add(pane);
         public static void main(String[] args)
              MoveRotatedObj f = new MoveRotatedObj();
              f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
              f.setSize(400, 400);
              f.setLocation(200, 200);
              f.setVisible(true);
         static class Dorairaj extends JPanel
              implements
                   MouseListener,
                   MouseMotionListener
              Shape o = null;
              Rectangle2D rect = new Rectangle2D.Double(
                   10, 10, 100, 100);
              Graphics2D g2 = null;
              boolean flag = true;
              int x=10,y=10,x1, y1, x2, y2;
              AffineTransform af = new AffineTransform();
              AffineTransform originalAt = new AffineTransform();
              int origin = 0;
              public Dorairaj()
                   addMouseListener(this);
                   addMouseMotionListener(this);
              protected void paintComponent(Graphics g)
                   super.paintComponent(g);
                   g2 = (Graphics2D) g;
                   g2.draw(new Rectangle2D.Double(0,0,500,500));
                   g2.translate(origin, origin);
                   g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
                        RenderingHints.VALUE_ANTIALIAS_ON);
                   rect = new Rectangle2D.Double(
                        x, y, 150, 100);
                   g2.setColor(Color.RED);
                   g2.draw(rect);
                   g2.setColor(Color.black);
                   originalAt = g2.getTransform();
                   g2.rotate(Math.toRadians(270), 200, 200);               
                   g2.draw(rect);
                   g2.setTransform(originalAt);
              * Invoked when a mouse button has been pressed on a component.
              public void mousePressed(MouseEvent e)
                   e.translatePoint(-origin, -origin);
                   x1 = e.getX();
                   y1 = e.getY();
              public void mouseDragged(MouseEvent e)
                   x2 = e.getX();
                   y2 = e.getY();
                   x = x + x2 - x1;
                   y = y + y2 - y1;
                   x1 = x2;
                   y1 = y2;
                   repaint();
              public void mouseMoved(MouseEvent e)
              * Invoked when the mouse button has been clicked (pressed and released)
              * on a component.
              public void mouseClicked(MouseEvent e)
                   repaint();
              * Invoked when a mouse button has been released on a component.
              public void mouseReleased(MouseEvent e)
              * Invoked when the mouse enters a component.
              public void mouseEntered(MouseEvent e)
              * Invoked when the mouse exits a component.
              public void mouseExited(MouseEvent e)
    Edited by: DoraiRaj on Sep 16, 2009 12:51 PM
    Edited by: DoraiRaj on Sep 16, 2009 1:00 PM
    Edited by: DoraiRaj on Sep 16, 2009 1:07 PM

    Thanks for replay and suggestion morgalr,
    I mean MoveRotatedObj1 is MoveRotatedObj only jsut m maintaing a copy on my system like MoveRotatedObj1.
    finally i solved my problem like this ,
    Is this correct approach m followinig or not pls let me know .
    import java.awt.Color;
    import java.awt.Graphics;
    import java.awt.Graphics2D;
    import java.awt.RenderingHints;
    import java.awt.Shape;
    import java.awt.event.MouseEvent;
    import java.awt.event.MouseListener;
    import java.awt.event.MouseMotionListener;
    import java.awt.geom.AffineTransform;
    import java.awt.geom.Point2D;
    import java.awt.geom.Rectangle2D;
    import javax.swing.JFrame;
    import javax.swing.JPanel;
    import com.clinapps.LDPConstants;
    public class MoveRotatedObj extends JFrame
    public MoveRotatedObj()
      JPanel pane = new Dorairaj();
      add(pane);
    public static void main(String[] args)
      MoveRotatedObj f = new MoveRotatedObj();
      f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
      f.setSize(400, 400);
      f.setLocation(200, 200);
      f.setVisible(true);
    static class Dorairaj extends JPanel
      implements
       MouseListener,
       MouseMotionListener
      Shape o = null;
      Rectangle2D rect = new Rectangle2D.Double(
       10, 10, 100, 100);
      Rectangle2D rect1 = new Rectangle2D.Double(
       10, 10, 100, 100);
      Graphics2D g2 = null;
      boolean flag = true;
      double lx, ly;
      int x = 10, y = 10, x1, y1, x2, y2;
      int l = 20, m = 20;
      int angle = 270;
      AffineTransform af = new AffineTransform();
      AffineTransform originalAt = new AffineTransform();
      int origin = 0;
      public Dorairaj()
       addMouseListener(this);
       addMouseMotionListener(this);
      protected void paintComponent(Graphics g)
       super.paintComponent(g);
       g2 = (Graphics2D) g;
       g2.draw(new Rectangle2D.Double(
        0, 0, 500, 500));
       g2.translate(origin, origin);
       g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
        RenderingHints.VALUE_ANTIALIAS_ON);
       rect = new Rectangle2D.Double(
        x, y, 150, 100);
       g2.setColor(Color.RED);
       g2.draw(rect);
       rect1 = new Rectangle2D.Double(
        l, m, 150, 100);
       g2.setColor(Color.black);
       originalAt = g2.getTransform();
       g2.rotate(Math.toRadians(angle), 200, 200);
       g2.draw(rect1);
       g2.setTransform(originalAt);
      public void mousePressed(MouseEvent e)
       e.translatePoint(-origin, -origin);
       x1 = e.getX();
       y1 = e.getY();
      public void mouseDragged(MouseEvent e)
       boolean left, right, up, bottm;
       int dx, dy;
       left = right = up = bottm = false;
       x2 = e.getX();
       y2 = e.getY();
       dx = x2 - x1;
       dy = y2 - y1;
       x = x + dx;
       y = y + dy;
       up = dy < 0;
       bottm = dy > 0;
       left = dx < 0;
       right = dx > 0;
       if (left || right)
        // b += dx;
        m += dx;
       if (up || bottm)
        // a -= dy;
        l -= dy;
       x1 = x2;
       y1 = y2;
       repaint();
      public void mouseMoved(MouseEvent e)
      public void mouseClicked(MouseEvent e)
       repaint();
      public void mouseReleased(MouseEvent e)
      public void mouseEntered(MouseEvent e)
      public void mouseExited(MouseEvent e)
    }

  • The move tool does not rotate shapes ...

    Hi,
    Everyday brings something new.
    The move tool decided not to rotate shapes anymore.
    I restarted, etc. You know the drill.
    JPDaviau

    Ha !
    I cant beleive it!
    Copy 200 times: "Turn on the bounding box. Turn on the bounding box.Turn on the bounding box.Turn on the bounding box.Turn on the bounding box.Turn on the bounding box.Turn on the bounding box.Turn on the bounding box. ..."
    Thanks

  • How do I rotate shapes in pages

    If I add a shape from the shapes tool bar is there a way to rotate it ?
    Many Thanks

    Inspector > Metrics > Rotate
    or command click on the corner and drag it round.
    Peter

  • Example -- double-click to rotate shape 36 degrees

    This is my first attempt to cause Visio to handle double-click on a shape.
    I need to rotate the shape 36 degrees each time it's double-clicked.
    Here's what I have right now:
    Enable developer tab in ribbon
    Select shape
    in developer tab, click "Show ShapeSheet"
    In ShapeSheet, enable "Events" box to show
    For "EventDblClick", enter the formula to handle double-clicks
    Formula I'm trying:
    =SETF(GetRef(Angle),MODULUS(GetVal(Angle)+36,360))
    Result when I double-click:
    "Shape protection, container, and/or layer properties prevent complete execution of this command."
    However, I couldn't find any protection being applied to this shape.  Ideas or suggestions?  Pointers to existing solutions and walkthroughs welcome. 
    My goal: Create a specific shape which rotates by 36 degrees on each double-click, and export it as a stencil.
    10 years Windows storage drivers | Microsoft Patent Attorney | LCA - Patents | Microsoft (not giving legal advice)

    I eventually discovered the problem.  It was a mistake of a someone new to this.  Here's the correct formula, which works quite well:
    =SETF(GetRef(Angle),ANG360(GetVal(Angle)+RAD(36)))
    In a nutshell, I was confused because the display in the datasheet showed the value in degrees, even though it appears to have required the value in radians.
    Live and learn!
    10 years Windows storage drivers | Microsoft Patent Attorney | LCA - Patents | Microsoft (not giving legal advice)

  • Flex Help - Creating Resizable, Draggable, Rotatable Shapes

    Hello,
    Hopefully some feedback from this forum can guide me into
    creating what I hope to accomplish.
    What I want to do is have the user be able to draw shapes
    onto a canvas/panel. The shaeps are standard squares, rectangles,
    circles, etc. .... This is the easy part.
    Once the shapes are drawn, I would like for the user to be
    able to click on a shape, and have 4 squares show up at each corner
    of the shape. When a user clicks on one of the squares and drags
    the mouse, the object expands in size. Furthermore, I would like to
    provide the functionality so that the user may rotate the shape.
    I have currently completed the user being able to draw
    shapes, as well as drag them anywhere on the application. I have
    used sprites for this. Can someone please guide me on how to
    incorporate the other functionality such as the user being able to
    resize the shape by selecting a tiny square at one of the corners
    of the object. Thanks

    As cxf02 mentioned in a separate thread:
    http://code.google.com/p/flex-object-handles/downloads/list
    http://www.rogue-development.com/objectHandles.html
    Your work is done :)

  • Rotating shapes created in Director

    Hello everyone:
    I am creating square using the rectangle shape tool in
    director...is there a way to rotate and change the anchor point for
    the shape? The same way I can do with the images I import.
    Rafael.

    You can change the regPoint of a number of things (text,
    flash, vectorShapes, movies are some off the top of my head), but
    not the QuickDraw shapes.
    If you use Flash you can set the regPoint via lingo (or in
    the property inspector window). You can also do this with vector
    shapes in Director. You can also set the rotation of the sprite via
    lingo or in PI.
    Pixelation...never good :)

  • Problems rotating shape with anchors

    Hey everyone,
    Just learning Java and I'm trying to rotate an oval around in a circle on a fixed point. The problem that comes up is that when the angle changes, the oval moves it's center. I can't get an anchor in place and rotate around it.
    I've looked everywhere for possible fixes and none seem to be working. I think at least I need an AffineTransform. My code (snippet) is below. Any help is greatly appreciated.
    public void paint(Graphics g)
    super.paintComponent(g);
    Graphics2D g2 = (Graphics2D) g;
    AffineTransform rotator = new AffineTransform();
    rotator.rotate(Math.toRadians(45),37,45);
    g2.setPaint(Color.red);
    g2.setTransform(rotator);
    g2.fillOval(0,0,100,150);
    Any ideas why it's not anchoring?

    Blah, db beat me to the punch.{color:#000080}Yay! First time I ever did that, and today's a bad day... got 9.71 kbps (yes that's bits, not Bytes) average over the last 2 hrs or so...
    <aside>^happy I guessed right, too^</aside>
    db{color}

  • Rotate dragged shape on button click

    Hi guys,
    I need help here. I want to do a drawing application where user can resize and rotate a shape. I have created a shape which I can drag around but how to make it rotate upon clicking on button?? Let say when I select the shape and click on 'rotate' button my shape will be rotate by 90 degree. After that the rotated shape can still be drag. Any help would be appreciated.

    Hi Darryl.Burke,
    Thanks for your reply, yes I use AffineTransform methods to rotate the shape. Is there any different with other rotation method?? Ok when I use setToRotation, the shape indeed rotate to the correct position but when I click the shape return back to its original and other weird things happen. Below is the code. Can you please point out the part that I done it wrong please. Thanks.
    import java.awt.*;
    import java.awt.event.*;
    import java.awt.geom.*;
    import javax.swing.*;
    import java.util.Vector;
    import javax.swing.border.CompoundBorder;
    import java.io.*;
    public class RotateShape
         private static void createAndShowGUI() {
            //Create and set up the window.
           JFrame.setDefaultLookAndFeelDecorated(true);      
           Viewer frame = new Viewer();
           frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
           frame.setVisible(true);
        public static void main(String[] args)
             javax.swing.SwingUtilities.invokeLater(new Runnable() {
              public void run() {
                   createAndShowGUI();
    class Viewer extends JFrame implements ActionListener
         JMenuBar menuBar;
         drawRect buildDesign;
        public Viewer()
           Toolkit kit = Toolkit.getDefaultToolkit();
            Dimension screenSize = kit.getScreenSize();
            int screenHeight = screenSize.height;
            int screenWidth = screenSize.width;
            // center frame in screen
              setSize(700, 600);
              setLocation(screenWidth / 4, screenHeight / 4);
              setResizable(false);
            buildDesign = new drawRect();
            buildDesign.setBorder(BorderFactory.createEmptyBorder(0, 2, 3, 3));
            JTabbedPane tabbed = new JTabbedPane();
            tabbed.addTab("Design", buildDesign);
            //tabbed.addTab("Viewer", buildViewer());
            tabbed.setBorder(new CompoundBorder(BorderFactory.createEmptyBorder(6, 6, 6, 6),
                                                tabbed.getBorder()));
            //------------------------End of Tabbed Pane----------------------------------------------------//
          JPanel pane = new JPanel();
          Button rectButton = new Button("Rect");
          rectButton.addActionListener(this);
          pane.add(rectButton);
          Button deleteButton = new Button("Delete");
          deleteButton.addActionListener(this);
          pane.add(deleteButton);
          Button rotateButton = new Button("Rotate");
          rotateButton.addActionListener(this);
          pane.add(rotateButton);
          JScrollPane scroller = new JScrollPane(pane);
          scroller.setOpaque(false);
          scroller.getViewport().setOpaque(false);
          scroller.setBorder(new CompoundBorder(BorderFactory.createEmptyBorder(6, 6, 6, 6),
                                                  scroller.getBorder()));
               //------------------------End of Build Item list----------------------------------------------//
          JPanel content = new JPanel(new BorderLayout());
          content.setOpaque(false);
          content.add(tabbed, BorderLayout.CENTER);
          content.add(scroller, BorderLayout.WEST);
          add (content, BorderLayout.CENTER);
          //------------------------End of add content----------------------------------------------//
              public void actionPerformed(ActionEvent evt) {
               // Respond to a command from one of the window's menu.
          String command = evt.getActionCommand();
          if (command.equals("Rect"))
             buildDesign.addShape(new RectShape());
          else if (command.equals("Delete"))
             buildDesign.delete();
          else if (command.equals("Rotate"))
             buildDesign.rotate();
    class drawRect extends JPanel implements ActionListener, MouseListener, MouseMotionListener
             Image offScreenCanvas = null;   // off-screen image used for double buffering
                 Graphics offScreenGraphics;     // graphics context for drawing to offScreenCanvas
                 Vector shapes = new Vector();   // holds a list of the shapes that are displayed on the canvas
                 Color currentColor = Color.black; // current color; when a shape is created, this is its color
                 float alpha;
            drawRect() {
            // Constructor: set background color to white set up listeners to respond to mouse actions
          setBackground(Color.white);
          addMouseListener(this);
          addMouseMotionListener(this);
       synchronized public void paintComponent(Graphics g) {
            Graphics2D g2 = (Graphics2D) g;
            // In the paint method, everything is drawn to an off-screen canvas, and then
            // that canvas is copied onto the screen.
          g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
          g2.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY);
          makeOffScreenCanvas();
          g2.drawImage(offScreenCanvas,0,0,this); 
          AlphaComposite composite = AlphaComposite.getInstance(AlphaComposite.SRC_OUT,alpha);
              g2.setComposite(composite);
          g2.setColor(Color.GRAY);
          drawGrid(g, 20); 
       public void update(Graphics g) {
            // Update method is called when canvas is to be redrawn.
            // Just call the paint method.
          super.paintComponent(g);
       void makeOffScreenCanvas() {
             // Erase the off-screen canvas and redraw all the shapes in the list.
             // (First, if canvas has not yet been created, then create it.)
          if (offScreenCanvas == null) {
             offScreenCanvas = createImage(getSize().width,getSize().height);
             offScreenGraphics = offScreenCanvas.getGraphics();
          offScreenGraphics.setColor(getBackground());
          offScreenGraphics.fillRect(0,0,getSize().width,getSize().height);
          int top = shapes.size();
          for (int i = 0; i < top; i++) {
             Shape s = (Shape)shapes.elementAt(i);
             s.draw(offScreenGraphics);
            private void drawGrid(Graphics g, int gridSpace) {
          Insets insets = getInsets();
          int firstX = insets.left;
          int firstY = insets.top;
          int lastX = getWidth() - insets.right;
          int lastY = getHeight() - insets.bottom;
          //Draw vertical lines.
          int x = firstX;
          while (x < lastX) {
            g.drawLine(x, firstY, x, lastY);
            x += gridSpace;
          //Draw horizontal lines.
          int y = firstY;
          while (y < lastY) {
            g.drawLine(firstX, y, lastX, y);
            y += gridSpace;
        public void actionPerformed(ActionEvent evt)
         synchronized void addShape(Shape shape) {
              // Add the shape to the canvas, and set its size/position and color.
              // The shape is added at the top-left corner, with size 50-by-30.
              // Then redraw the canvas to show the newly added shape.
          shape.setColor(Color.red);
          shape.setColor(currentColor);
           shape.reshape(3,3,70,10);
          shapes.addElement(shape);
          repaint();
         void clear() {
             // remove all shapes
           shapes.setSize(0);
           repaint();
        void delete() {
             // remove selected shapes
                  shapes.removeElement(selectedShape);
                   repaint();
       void rotate() {     
                     //shapes.addElement(selectedShape);
                  selectedShape.setToRotate(true);
                  //shapes.removeElement(selectedShape);
                   repaint();
       Shape selectedShape = null;
       Shape shapeBeingDragged = null;  // This is null unless a shape is being dragged.
                                        // A non-null value is used as a signal that dragging
                                        // is in progress, as well as indicating which shape
                                        // is being dragged.
       int prevDragX;  // During dragging, these record the x and y coordinates of the
       int prevDragY;  //    previous position of the mouse.
        Shape clickedShape(int x, int y) {
             // Find the frontmost shape at coordinates (x,y); return null if there is none.
          for ( int i = shapes.size() - 1; i >= 0; i-- ) {  // check shapes from front to back
             Shape s = (Shape)shapes.elementAt(i);
             if (s.containsPoint(x,y))
                  s.tickSelected(true);
                  selectedShape = s;
                return s;
                else
                s.tickSelected(false);
                repaint();
          return null;
       synchronized public void mousePressed(MouseEvent evt) {
             // User has pressed the mouse.  Find the shape that the user has clicked on, if
             // any.  If there is a shape at the position when the mouse was clicked, then
             // start dragging it.  If the user was holding down the shift key, then bring
             // the dragged shape to the front, in front of all the other shapes.
          int x = evt.getX();  // x-coordinate of point where mouse was clicked
          int y = evt.getY();  // y-coordinate of point                                  
             shapeBeingDragged = clickedShape(x,y);
             if (shapeBeingDragged != null) {
                prevDragX = x;
                prevDragY = y;
                if (evt.isShiftDown()) {                 // Bring the shape to the front by moving it to
                   shapes.removeElement(shapeBeingDragged);  //       the end of the list of shapes.
                   shapes.addElement(shapeBeingDragged);
                   repaint();  // repaint canvas to show shape in front of other shapes
       synchronized public void mouseDragged(MouseEvent evt) {
              // User has moved the mouse.  Move the dragged shape by the same amount.
          int x = evt.getX();
          int y = evt.getY();
          if (shapeBeingDragged != null) {
             shapeBeingDragged.moveBy(x - prevDragX, y - prevDragY);
             prevDragX = x;
             prevDragY = y;
             repaint();      // redraw canvas to show shape in new position
       synchronized public void mouseReleased(MouseEvent evt) {
              // User has released the mouse.  Move the dragged shape, then set
              // shapeBeingDragged to null to indicate that dragging is over.
              // If the shape lies completely outside the canvas, remove it
              // from the list of shapes (since there is no way to ever move
              // it back onscreen).
          int x = evt.getX();
          int y = evt.getY();
          if (shapeBeingDragged != null) {
             shapeBeingDragged.moveBy(x - prevDragX, y - prevDragY);
             if ( shapeBeingDragged.left >= getSize().width || shapeBeingDragged.top >= getSize().height ||
                     shapeBeingDragged.left + shapeBeingDragged.width < 0 ||
                     shapeBeingDragged.top + shapeBeingDragged.height < 0 ) {  // shape is off-screen
                shapes.removeElement(shapeBeingDragged);  // remove shape from list of shapes
             shapeBeingDragged = null;
             repaint();
       public void mouseEntered(MouseEvent evt) { }   // Other methods required for MouseListener and
       public void mouseExited(MouseEvent evt) { }    //              MouseMotionListener interfaces.
       public void mouseMoved(MouseEvent evt) { }
       public void mouseClicked(MouseEvent evt) { }
       abstract class Shape implements Serializable{
          // A class representing shapes that can be displayed on a ShapeCanvas.
          // The subclasses of this class represent particular types of shapes.
          // When a shape is first constucted, it has height and width zero
          // and a default color of white.
       int left, top;      // Position of top left corner of rectangle that bounds this shape.
       int width, height;  // Size of the bounding rectangle.
       Color color = Color.white;  // Color of this shape.
       boolean isSelected;
       boolean isRotate;
       AffineTransform t;
       AffineTransform origTransform;
       void reshape(int left, int top, int width, int height) {
             // Set the position and size of this shape.
          this.left = left;
          this.top = top;
          this.width = width;
          this.height = height;
       void moveTo(int x, int y) {
              // Move upper left corner to the point (x,y)
          this.left = x;
          this.top = y;
       void moveBy(int dx, int dy) {
              // Move the shape by dx pixels horizontally and dy pixels veritcally
              // (by changing the position of the top-left corner of the shape).
          left += dx;
          top += dy;
       void setColor(Color color) {
              // Set the color of this shape
          this.color = color;
       void tickSelected (boolean draw) {
                 // If true, a red outline is drawn around this shape.
             isSelected = draw;
       void setToRotate (boolean draw) {
                 // If true, the shape will rotate 90 deg
             isRotate = draw;
       boolean containsPoint(int x, int y) {
             // Check whether the shape contains the point (x,y).
             // By default, this just checks whether (x,y) is inside the
             // rectangle that bounds the shape.  This method should be
             // overridden by a subclass if the default behaviour is not
             // appropriate for the subclass.
          if (x >= left && x < left+width && y >= top && y < top+height)
             return true;
          else
                      return false;
       abstract void draw(Graphics g); 
             // Draw the shape in the graphics context g.
             // This must be overriden in any concrete subclass.
         }  // end of class Shape
    class RectShape extends Shape {
          // This class represents rectangle shapes.
       void draw(Graphics g) {
            Graphics2D g2 = (Graphics2D) g;
            Rectangle2D wall = new Rectangle2D.Double(left,top,width,height);
            Rectangle2D border = new Rectangle2D.Double(left-2,top-2,width+3,height+3);
            origTransform = g2.getTransform();
            if ((isRotate) && (isSelected))
                   t = new AffineTransform();
                      t.setToRotation ((Math.toRadians (90)),(left+width/2) , (top+height/2) );
                      g2.transform(t);
                      g2.setColor(color);
                   g2.fill(wall);
                   g2.setColor(Color.red);
                    g2.draw(border);
                    g2.setTransform( origTransform );
                    return;
            else
                 g2.setColor(color);
              g2.fill(wall);
            if ((isSelected)&& !(isRotate))
                         g2.setColor(Color.red);
                         g2.draw(border);
                              else
                                   g2.setColor(Color.black);
                                   g2.draw(wall);
    }

  • How to rotate an ellipse

    How would I change this code (shamelessly taken from one of DrLaszloJamf's posts) to rotate the ellipse around its center, I need an image with several ellipses at several different angles.
    import java.awt.*;
    import java.awt.image.*;
    import javax.swing.*;
    import java.io.*;
    import javax.imageio.ImageIO;
    public class BW
    public static void main(String[] args) throws IOException
    byte[] two = {0, (byte)0xff};
    ColorModel cm = new IndexColorModel(1, 2, two, two, two);
    WritableRaster raster = cm.createCompatibleWritableRaster(650, 100);
    BufferedImage image = new BufferedImage(cm, raster, false, null);
    Graphics2D g = image.createGraphics();
    g.setColor(Color.WHITE);
    g.fillArc(200, 10, 60, 30, 45, 360);
    g.dispose();
    ImageIO.write(image,"png",(new File("output.png")));

    You need to use java.awt.geom.AffineTransform, either directly or through the transform that the Graphics2D
    object has.
    Here is a simple example that animates using rotation.
    import java.awt.*;
    import java.awt.event.*;
    import java.awt.geom.*;
    import javax.swing.*;
    public class RotatingShape extends JPanel {
         private Shape shape;
         private double angle;
         private Timer timer = new Timer(500, new ActionListener(){
              public void actionPerformed(ActionEvent evt) {
                   angle += Math.PI/50;
                   repaint();
         //rotates shape around its origin, which is placed in center of component
         public RotatingShape(Shape shape) {
              this.shape = shape;
              timer.start();
         protected void paintComponent(Graphics g) {
              super.paintComponent(g);
              Insets insets = getInsets();
              int w = getWidth() - insets.left - insets.right;
              int h = getHeight() -insets.top  - insets.bottom;
              Graphics2D g2 = (Graphics2D) g.create(insets.left, insets.top, w, h);
              g2.setColor(getForeground());
              g2.translate(w/2.0, h/2.0);
              g2.rotate(angle);
              g2.setStroke(new BasicStroke(3));
              g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
              g2.draw(shape);
         public static void main(String[] args) {
              Shape shape = new Ellipse2D.Float(-100, -200, 200, 400);
              JComponent comp = new RotatingShape(shape);
              comp.setBackground(Color.BLACK);
              comp.setForeground(Color.GREEN);
              comp.setPreferredSize(new Dimension(450, 450));
              JFrame f = new JFrame("RotatingShape");
              f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
              f.getContentPane().add(comp);
              f.pack();
              f.setLocationRelativeTo(null);
              f.setVisible(true);
    }

  • Rotating in CS5 Flash without Skew

    Hi,
    I'm a Flash newbie.  I'm trying to rotate a symbol while keeping the shape and proportions locked, but even when using Free Transform, my shapes skew (from rectangles to rhombuses to squares).  I'd like to keep the lines straight and parallel.  Locking the height and width with the link tool doesn't seem to make a difference.  Does anyone know how to rotate shapes without the automatic re-proportioning?
    Thanks!

    Not sure if it's relevant, but I realized that perhaps I should have clarified that I'm attempting to do this with a symbol.  When I use the Free Transform rotation tool, I still get automatic skewing-- this is the issue I'm trying to prevent.  Even when I simply rotate 360 degrees, my shape changes...

  • Rotating

    I was wondering how to rotate words and images/objects. I have been trying to do it for a while now. No luck. Please help.
    iBook G4   Mac OS X (10.4.4)   My.Computer.Ownz.

    Purple—
    If your text is in a text box, all you have to do is
    put your cursor over any of the corners of the text
    box when it's highlighted and hold down the command
    (apple) key. Your cursor will turn into a curved
    arrow icon, and you can rotate all you want. The same
    goes for rotating shapes. Hope that helps!
    Damian
    Thanks Mr. Fizx. I marked you as solver! You were a big help. The first replier was too but Damian's is easier.
    PowerBook G4   Mac OS X (10.4.4)   My.Computer.Ownz.

  • Need a Matrix Package or How to do in java?

    Hello,
    I have a project to do that consists of Translating, Scaling and Rotating shapes such as, circles, squares, triangles, pentagons, etc.... I have to translate.... in two dimention using 3 * 3 matrix.
    How do I accomplish this in java?
    is there something in the MAth Lib, or will I need to download a package and if so whats the best one?
    using java 1.4
    thanks,
    CHad burger
    Message was edited by:
    reilley35

    i think he does want us to do it from scratch, but he
    did say we can use built in methods.Leaves you a bit up in the air then! I'm sure that Google will find teh theory for you. You just have to generate the equivalent of an AffenineTransformation class.
    >
    I dont think I can use what the other poster has.
    I think my prof. wants us to actually do the matrix
    stuff. Is this possible? possible being easy for a
    beginner. Asked my java teacher from a couple of
    semesters ago and he said its better to use another
    language for that.Seem short sighted of your prof. Java is as good as anything for doing this.
    >
    everything is pretty much hard coded in the app.
    Would seeing my APP help.Not really! Once you get underway then post any problems you get.

  • Error when publishing 3D to GIF

    Symptoms:
              When the scene contains any 3D rotated object, it doesn't render correctly when publishing to GIF format.
    Version:          Flash CS4
    Steps to reproduce:
    1- Create a new empty AS3.0 scene. Set the publish settings to generate a GIF animated image, set its "animate" option.
    2- Add some empty frames. You don't need to set any interpolation between them.
    3- On frame 1, draw any simple shape, select it (Ctrl-A) and turn it into a MovieClip (F8).
    4- Publish, then play GIF file, just to checkout that generated GIF is OK.
    5- On frame 1, select your shape, then select the 3D rotation tool. Rotate shape around any axis, any amount.
    6- Publish again. Checkout GIF file... ERROR!! Shape position is wrong - it always goes to (0,0).
    Can you reproduce it, or is it a problem with my installation?
    Thanks.
    EDIT: This thread tells about the bug. However, the suggested workaround (using export instead of publish) is not a final solution for me. As far as I know, exporting generates a much lower quality image. For example, it will always use pattern in resulting gif image, even if not desired. Am I wrong?

    This problem used to occur with Publishing from Rh but I have not seen it for a long time, either myself or in posts.
    Maybe Item 5 at http://www.grainge.org/pages/snippets/snippets.htm#webhelp will help.
    See www.grainge.org for RoboHelp and Authoring tips
    @petergrainge

  • OpenGL Help!

    I am trying to create an OpenGL program that has rotating shapes. However it is not working. I don't get any errors instead the view is just completely black here is my code:
    //Clear the screen and depth buffer
    glClear(GLCOLOR_BUFFERBIT | GLDEPTH_BUFFERBIT);
    glLoadIdentity(); //Reset the current modelview matrix
    glTranslatef(-1.5f, 0.0f, -6.0f);
    //Rotate the triangle on the Y axis
    glRotatef(rtri, 0.0f, 1.0f, 0.0f);
    glBegin(GL_TRIANGLES); //Draw the triangle
    glColor3f( 1.0f, 0.0f, 0.0f ); // Set color to red
    glVertex3f( 0.0f, 1.0f, 0.0f ); // Top of front
    glColor3f( 0.0f, 1.0f, 0.0f ); // Set color to green
    glVertex3f( -1.0f, -1.0f, 1.0f ); // Bottom left of front
    glColor3f( 0.0f, 0.0f, 1.0f ); // Set color to blue
    glVertex3f( 1.0f, -1.0f, 1.0f ); // Bottom right of front
    glColor3f( 1.0f, 0.0f, 0.0f ); // Red
    glVertex3f( 0.0f, 1.0f, 0.0f ); // Top of right side
    glColor3f( 0.0f, 0.0f, 1.0f ); // Blue
    glVertex3f( 1.0f, -1.0f, 1.0f ); // Left of right side
    glColor3f( 0.0f, 1.0f, 0.0f ); // Green
    glVertex3f( 1.0f, -1.0f, -1.0f ); // Right of right side
    glColor3f( 1.0f, 0.0f, 0.0f ); // Red
    glVertex3f( 0.0f, 1.0f, 0.0f ); // Top of back side
    glColor3f( 0.0f, 1.0f, 0.0f ); // Green
    glVertex3f( 1.0f, -1.0f, -1.0f ); // Left of back side
    glColor3f( 0.0f, 0.0f, 1.0f ); // Blue
    glVertex3f( -1.0f, -1.0f, -1.0f ); // Right of back side
    glColor3f( 1.0f, 0.0f, 0.0f ); // Red
    glVertex3f( 0.0f, 1.0f, 0.0f ); // Top of left side
    glColor3f( 0.0f, 0.0f, 1.0f ); // Blue
    glVertex3f( -1.0f, -1.0f, -1.0f ); // Left of left side
    glColor3f( 0.0f, 1.0f, 0.0f ); // Green
    glVertex3f( -1.0f, -1.0f, 1.0f ); // Right of left side
    glEnd(); // Done with triangle
    glLoadIdentity(); // Reset current modelview matrix
    glTranslatef( 1.5f, 0.0f, -7.0f ); // Move right and into screen
    // Rotate quad on all axes
    glRotatef( rquad, 1.0f, 1.0f, 1.0f );
    glBegin( GL_QUADS ); // Draw quads
    glColor3f( 0.0f, 1.0f, 0.0f ); // Green
    glVertex3f( 1.0f, 1.0f, -1.0f ); // Top right of top side
    glVertex3f( -1.0f, 1.0f, -1.0f ); // Top left of top side
    glVertex3f( -1.0f, 1.0f, 1.0f ); // Bottom left of top side
    glVertex3f( 1.0f, 1.0f, 1.0f ); // Bottom right of top side
    glColor3f( 1.0f, 0.5f, 0.0f ); // Orange
    glVertex3f( 1.0f, -1.0f, 1.0f ); // Top right of bottom side
    glVertex3f( -1.0f, -1.0f, 1.0f ); // Top left of bottom side
    glVertex3f( -1.0f, -1.0f, -1.0f ); // Bottom left of bottom side
    glVertex3f( 1.0f, -1.0f, -1.0f ); // Bottom right of bottom side
    glColor3f( 1.0f, 0.0f, 0.0f ); // Red
    glVertex3f( 1.0f, 1.0f, 1.0f ); // Top right of front side
    glVertex3f( -1.0f, 1.0f, 1.0f ); // Top left of front side
    glVertex3f( -1.0f, -1.0f, 1.0f ); // Bottom left of front side
    glVertex3f( 1.0f, -1.0f, 1.0f ); // Bottom right of front side
    glColor3f( 1.0f, 1.0f, 0.0f ); // Yellow
    glVertex3f( 1.0f, -1.0f, -1.0f ); // Bottom left of back side
    glVertex3f( -1.0f, -1.0f, -1.0f ); // Bottom right of back side
    glVertex3f( -1.0f, 1.0f, -1.0f ); // Top right of back side
    glVertex3f( 1.0f, 1.0f, -1.0f ); // Top left of back side
    glColor3f( 0.0f, 0.0f, 1.0f ); // Blue
    glVertex3f( -1.0f, 1.0f, 1.0f ); // Top right of left side
    glVertex3f( -1.0f, 1.0f, -1.0f ); // Top left of left side
    glVertex3f( -1.0f, -1.0f, -1.0f ); // Bottom left of left side
    glVertex3f( -1.0f, -1.0f, 1.0f ); // Bottom right of left side
    glColor3f( 1.0f, 0.0f, 1.0f ); // Violet
    glVertex3f( 1.0f, 1.0f, -1.0f ); // Top right of right side
    glVertex3f( 1.0f, 1.0f, 1.0f ); // Top left of right side
    glVertex3f( 1.0f, -1.0f, 1.0f ); // Bottom left of right side
    glVertex3f( 1.0f, -1.0f, -1.0f ); // Bottom right of right side
    glEnd(); // Quads
    [ [ self openGLContext ] flushBuffer ];
    rtri += 0.2f; // Increase the rotation variable for the triangle
    rquad -= 0.15f; // Decrease the rotation variable for the quad
    glFlush();
    rtri is declared as a GLfloat
    rquad is also declared as a GLfloat
    Does anyone know why this code is not working?

    Blakeasd wrote:
    ... instead the view is just completely black ...
    Where did you put your lights?

Maybe you are looking for

  • PDF form from Excel spreadsheet/table

    I am developing a process where folks enter data (all text) to a central spreadsheet, and someone uses Acrobat X to generate a form. The form needs checkboxes (one per table row), and a digital signature above the table. I'm running into a couple of

  • Is it possible to insert text in a picture in Lightroom?

    Is it possible to insert text in a picture in Lightroom?

  • Can the appliance do this?

    I want to be able to lay on my back (I am disabled) and type documents into the iPod Touch using a virtual keyboard. Can the appliance do this? I would also like to use a microphone to record audio onto the hard disk. can it do this? I know the regul

  • How do you play an album from start to finish without mixing the songs?

    I may be old-fashioned, but I want to play my albums from start to finish without having the songs mixed. I have tried almost anything, but it kips jumping randomly from song to song on an album. Extremely annoying if you are listening to a concept a

  • HELP! Hard drive is dying

    Hey folks, I have a hard drive that's not cooperating anymore.. here's what happened I was working in Final Cut Pro. I was taking some video that was rendered for dvd video and trying to use it in a timeline... anyway, the mac froze up bigtime, all I