Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 15 of 15

Thread: Scale and text at the end of the animation

  1. #1
    Junior Member
    Join Date
    Nov 2020
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Scale and text at the end of the animation

    I need sun to have beside rotation effect, scaling also, and simple text THE END at the end of the animation...
    This is what I have so far, hope that you can help me.

    Thanks.

    package polygon;



    import java.io.*;
    import java.awt.*;
    import java.awt.geom.*;
    import java.awt.event.*;
    import javax.swing.*;




    public class Polygon extends JFrame implements Runnable {

    static final int XBORDER = 0;
    static final int YBORDER = 0;
    static final int YTITLE = 30;
    static final int WINDOW_BORDER = 8;
    static final int WINDOW_WIDTH = 2*(WINDOW_BORDER + XBORDER) + 800;
    static final int WINDOW_HEIGHT = YTITLE + WINDOW_BORDER + 2 * YBORDER + 500;

    boolean animateFirstTime = true;
    int xsize = -1;
    int ysize = -1;
    Image image;
    Graphics2D g;

    int polygonMove;
    int polygonRotate;

    static Polygon frame;
    public static void main(String[] args) {
    frame = new Polygon();
    frame.setSize(WINDOW_WIDTH, WINDOW_HEIGHT);
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOS E);
    frame.setVisible(true);
    }

    public Polygon() {
    addMouseListener(new MouseAdapter() {
    public void mousePressed(MouseEvent e) {
    if (e.BUTTON1 == e.getButton()) {
    //left button

    // location of the cursor.
    int xpos = e.getX();
    int ypos = e.getY();

    }
    if (e.BUTTON3 == e.getButton()) {
    //right button
    reset();
    }
    repaint();
    }
    });

    addMouseMotionListener(new MouseMotionAdapter() {
    public void mouseDragged(MouseEvent e) {
    repaint();
    }
    });

    addMouseMotionListener(new MouseMotionAdapter() {
    public void mouseMoved(MouseEvent e) {

    repaint();
    }
    });

    addKeyListener(new KeyAdapter() {

    public void keyPressed(KeyEvent e) {
    if (e.VK_UP == e.getKeyCode()) {

    } else if (e.VK_DOWN == e.getKeyCode()) {

    } else if (e.VK_LEFT == e.getKeyCode()) {

    } else if (e.VK_RIGHT == e.getKeyCode()) {

    }
    repaint();
    }
    });
    init();
    start();
    }
    Thread relaxer;
    ////////////////////////////////////////////////////////////////////////////
    public void init() {
    requestFocus();
    }
    ////////////////////////////////////////////////////////////////////////////
    public void destroy() {
    }

    ////////////////////////////////////////////////////////////////////////////


    ////////////////////////////////////////////////////////////////////////////
    public void paint(Graphics gOld) {
    if (image == null || xsize != getSize().width || ysize != getSize().height) {
    xsize = getSize().width;
    ysize = getSize().height;
    image = createImage(xsize, ysize);
    g = (Graphics2D) image.getGraphics();
    g.setRenderingHint(RenderingHints.KEY_ANTIALIASING ,
    RenderingHints.VALUE_ANTIALIAS_ON);
    }
    //fill background
    g.setColor(Color.cyan);
    g.fillRect(0, 0, xsize, ysize);

    int x[] = {getX(0), getX(getWidth2()), getX(getWidth2()), getX(0), getX(0)};
    int y[] = {getY(0), getY(0), getY(getHeight2()), getY(getHeight2()), getY(0)};
    //fill border
    g.setColor(Color.white);
    g.fillPolygon(x, y, 4);
    // draw border
    g.setColor(Color.red);
    g.drawPolyline(x, y, 5);

    if (animateFirstTime) {
    gOld.drawImage(image, 0, 0, null);
    return;
    }
    Color Fred = new Color (89,20,80);
    g.setColor(Fred);
    g.fillRect(130, 80, 40, 70);

    g.setColor(Color.GRAY);
    g.drawOval(230, 80, 40, 70);

    g.setColor(new Color(30,198,227));
    g.setFont(new Font("Arial",Font.PLAIN,50));
    g.drawString("Hi there!",160,300);

    drawBox(600,200,0,100,15,Color.blue);

    drawBox(600,300,0,4,8,Color.gray);

    drawBox(600,350,0,1,2.5,Color.black);

    drawBox(625,300,0,1,1,Color.cyan);

    drawBox(575,300,0,1,1,Color.cyan);

    drawBox(625,250,0,1,1,Color.cyan);

    drawBox(575,250,0,1,1,Color.cyan);

    drawBox(400,300,0,4,13,Color.gray);

    drawBox(400,350,0,1,2.5,Color.black);

    drawBox(425,300,0,1,1,Color.cyan);

    drawBox(375,300,0,1,1,Color.cyan);

    drawBox(425,250,0,1,1,Color.cyan);

    drawBox(375,250,0,1,1,Color.cyan);

    drawBox(425,200,0,1,1,Color.cyan);

    drawBox(375,200,0,1,1,Color.cyan);

    drawcar(100,100,20,100,65,Color.GREEN);

    drawBox(600,450,0,100,10,Color.lightGray);

    drawBox(375,400,0,100,3,Color.black);

    drawBox(130+polygonMove++,385,0,4,1,Color.red);

    drawBox(130+polygonMove++,365,0,2,1,Color.red);

    drawCircle(100+polygonMove++,400,0,0.8,0.8,Color.D ARK_GRAY);

    drawCircle(160+polygonMove++,400,0,0.8,0.8,Color.D ARK_GRAY);

    drawBox(1130-polygonMove++,368,0,0.8,0.8,Color.cyan);

    drawBox(1130-polygonMove++,385,0,4,1,Color.blue);

    drawBox(1130-polygonMove++,365,0,2,1,Color.blue);

    drawCircle(1100-polygonMove++,400,0,0.8,0.8,Color.DARK_GRAY);

    drawCircle(1160-polygonMove++,400,0,0.8,0.8,Color.DARK_GRAY);

    drawHouse(100,100,0+polygonRotate++,5,5,Color.yell ow);



    drawBox(130+polygonMove++,368,0,0.8,0.8,Color.cyan );

    drawBox(300,321,0,0.5,3,Color.BLACK);


    drawOval(300,275,0,2,4,Color.GREEN);

    drawBox(600-+polygonMove++,365,0,10.8,3,Color.yellow);

    drawBox(560-+polygonMove++,360,0,1,1,Color.cyan);

    drawBox(670-+polygonMove++,360,0,1,1,Color.cyan);

    drawBox(610-+polygonMove++,360,0,1,1,Color.cyan);

    drawBox(513-+polygonMove++,355,0,2,2,Color.cyan);

    drawCircle(700-+polygonMove++,400,0,1,1,Color.DARK_GRAY);

    drawCircle(500-+polygonMove++,400,0,1,1,Color.DARK_GRAY);

    drawBox(1130-polygonMove++,368,0,0.8,0.8,Color.cyan);

    g.setColor(new Color(130,98,117));
    g.setFont(new Font("Arial",Font.PLAIN,50));
    g.drawString("Work day!",270,150);

    Color sunColor = new Color(230,200,0);
    g.setColor(sunColor);

    g.setColor(Color.yellow);
    g.setFont(new Font("Arial",Font.PLAIN,30));
    g.drawString("zooom",50,340);


    gOld.drawImage(image, 0, 0, null);

    }
    ////////////////////////////////////////////////////////////////////////////
    public void drawcar(int xpos,int ypos,double rot,double xscale,double yscale,Color color)
    {
    g.translate(xpos,ypos);
    g.rotate(rot * Math.PI/180.0);
    g.scale( xscale , yscale );

    g.setColor(color);
    drawBox(130,385,0,4,1,Color.red);

    drawBox(130,365,0,2,1,Color.red);

    drawCircle(100,400,0,0.8,0.8,Color.DARK_GRAY);

    drawCircle(160,400,0,0.8,0.8,Color.DARK_GRAY);

    drawBox(130,368,0,0.8,0.8,Color.cyan);

    g.scale( 1.0/xscale,1.0/yscale );
    g.rotate(-rot * Math.PI/180.0);
    g.translate(-xpos,-ypos);
    }
    ////////////////////////////////////////////////////////////////////////////
    public void drawHouse(int xpos,int ypos,double rot,double xscale,double yscale,Color color)
    {
    g.translate(xpos,ypos);
    g.rotate(rot * Math.PI/180.0);
    g.scale( xscale , yscale );

    g.setColor(color);
    int xvals[] = {5,10,5,10,5,0,-5,-10,-5,-10,-5,0};
    int yvals[] = {-5,-5,0,5,5,10,5,5,0,-5,-5,-10};
    g.fillPolygon(xvals,yvals,xvals.length);


    g.scale( 1.0/xscale,1.0/yscale );
    g.rotate(-rot * Math.PI/180.0);
    g.translate(-xpos,-ypos);
    }
    ////////////////////////////////////////////////////////////////////////////
    public void drawBox(int xpos,int ypos,double rot,double xscale,double yscale,Color color)
    {
    g.translate(xpos,ypos);
    g.rotate(rot * Math.PI/180.0);
    g.scale( xscale , yscale );

    g.setColor(color);
    g.fillRect(-10,-10,20,20);

    g.scale( 1.0/xscale,1.0/yscale );
    g.rotate(-rot * Math.PI/180.0);
    g.translate(-xpos,-ypos);
    }

    ////////////////////////////////////////////////////////////////////////////
    // drawCircle(100,100,0,1,1,Color.blue);
    public void drawCircle(int xpos,int ypos,double rot,double xscale,double yscale,Color color)
    {
    g.translate(xpos,ypos);
    g.rotate(rot * Math.PI/180.0);
    g.scale( xscale , yscale );

    g.setColor(color);
    g.fillOval(-10,-10,20,20);

    g.scale( 1.0/xscale,1.0/yscale );
    g.rotate(-rot * Math.PI/180.0);
    g.translate(-xpos,-ypos);
    }

    ////////////////////////////////////////////////////////////////////////////
    // drawCircle(150,100,0,2,1,Color.blue);
    public void drawOval(int xpos,int ypos,double rot,double xscale,double yscale,Color color)
    {
    g.translate(xpos,ypos);
    g.rotate(rot * Math.PI/180.0);
    g.scale( xscale , yscale );

    g.setColor(color);
    g.fillOval(-10,-10,20,20);

    g.scale( 1.0/xscale,1.0/yscale );
    g.rotate(-rot * Math.PI/180.0);
    g.translate(-xpos,-ypos);
    }

    ////////////////////////////////////////////////////////////////////////////
    // needed for implement runnable
    public void run() {
    while (true) {
    animate();
    repaint();


    double seconds = .04; //time that 1 frame takes.
    int miliseconds = (int) (1000.0 * seconds);
    try {
    Thread.sleep(miliseconds);
    } catch (InterruptedException e) {
    }
    }
    }


    /////////////////////////////////////////////////////////////////////////
    public void reset() {

    }
    /////////////////////////////////////////////////////////////////////////
    public void animate() {
    if (animateFirstTime) {
    animateFirstTime = false;
    if (xsize != getSize().width || ysize != getSize().height) {
    xsize = getSize().width;
    ysize = getSize().height;
    }
    reset();
    }

    polygonMove++;
    polygonRotate++;
    }

    ////////////////////////////////////////////////////////////////////////////
    public void start() {
    if (relaxer == null) {
    relaxer = new Thread(this);
    relaxer.start();
    }
    }
    ////////////////////////////////////////////////////////////////////////////
    public void stop() {
    if (relaxer.isAlive()) {
    relaxer.stop();
    }
    relaxer = null;
    }


    /////////////////////////////////////////////////////////////////////////
    public int getX(int x) {
    return (x + XBORDER + WINDOW_BORDER);
    }

    public int getY(int y) {
    return (y + YBORDER + YTITLE );
    }

    public int getYNormal(int y) {
    return (-y + YBORDER + YTITLE + getHeight2());
    }

    public int getWidth2() {
    return (xsize - 2 * (XBORDER + WINDOW_BORDER));
    }

    public int getHeight2() {
    return (ysize - 2 * YBORDER - WINDOW_BORDER - YTITLE);



    }
    }

  2. #2
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    24,111
    Thanks
    53
    Thanked 2,618 Times in 2,568 Posts

    Default Re: Scale and text at the end of the animation

    What have you tried? Where in the posted code are you having problems?
    Note: Polygon is the name of a java class: java.awt.Polygon. A different name would be better and not cause confusion.

    Please edit your post and wrap your code with code tags:

    [code]
    **YOUR CODE GOES HERE**
    [/code]

    to get highlighting and preserve formatting.
    http://www.java-forums.org/misc.php?do=bbcode#code
    If you don't understand my answer, don't ignore it, ask a question.

  3. #3
    Junior Member
    Join Date
    Nov 2020
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Scale and text at the end of the animation

    I'm in a hurry... My bad...Sorry...

    package polygon;
     
     
     
    import java.io.*;
    import java.awt.*;
    import java.awt.geom.*;
    import java.awt.event.*;
    import javax.swing.*;
     
     
     
     
    public class Polygon extends JFrame implements Runnable {
     
        static final int XBORDER = 0;
        static final int YBORDER = 0;
        static final int YTITLE = 30;
        static final int WINDOW_BORDER = 8;
        static final int WINDOW_WIDTH = 2*(WINDOW_BORDER + XBORDER) + 800;
        static final int WINDOW_HEIGHT = YTITLE + WINDOW_BORDER + 2 * YBORDER + 500;
     
        boolean animateFirstTime = true;
        int xsize = -1;
        int ysize = -1;
        Image image;
        Graphics2D g;
     
       int polygonMove;
       int polygonRotate;
     
        static Polygon frame;
        public static void main(String[] args) {
            frame = new Polygon();
            frame.setSize(WINDOW_WIDTH, WINDOW_HEIGHT);
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            frame.setVisible(true);
        }
     
           public Polygon() {
            addMouseListener(new MouseAdapter() {
                public void mousePressed(MouseEvent e) {
                    if (e.BUTTON1 == e.getButton()) {
                        //left button
     
    // location of the cursor.
                        int xpos = e.getX();
                        int ypos = e.getY();
     
                    }
                    if (e.BUTTON3 == e.getButton()) {
                        //right button
                        reset();
                    }
                    repaint();
                }
            });
     
        addMouseMotionListener(new MouseMotionAdapter() {
          public void mouseDragged(MouseEvent e) {
            repaint();
          }
        });
     
        addMouseMotionListener(new MouseMotionAdapter() {
          public void mouseMoved(MouseEvent e) {
     
            repaint();
          }
        });
     
            addKeyListener(new KeyAdapter() {
     
                public void keyPressed(KeyEvent e) {
                    if (e.VK_UP == e.getKeyCode()) {
     
                    } else if (e.VK_DOWN == e.getKeyCode()) {
     
                    } else if (e.VK_LEFT == e.getKeyCode()) {
     
                    } else if (e.VK_RIGHT == e.getKeyCode()) {
     
                    }
                    repaint();
                }
            });
            init();
            start();
        }
        Thread relaxer;
    ////////////////////////////////////////////////////////////////////////////
        public void init() {
            requestFocus();
        }
    ////////////////////////////////////////////////////////////////////////////
        public void destroy() {
        }
     
    ////////////////////////////////////////////////////////////////////////////
     
     
    ////////////////////////////////////////////////////////////////////////////
        public void paint(Graphics gOld) {
            if (image == null || xsize != getSize().width || ysize != getSize().height) {
                xsize = getSize().width;
                ysize = getSize().height;
                image = createImage(xsize, ysize);
                g = (Graphics2D) image.getGraphics();
                g.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
                        RenderingHints.VALUE_ANTIALIAS_ON);
            }
    //fill background
            g.setColor(Color.cyan);
            g.fillRect(0, 0, xsize, ysize);
     
            int x[] = {getX(0), getX(getWidth2()), getX(getWidth2()), getX(0), getX(0)};
            int y[] = {getY(0), getY(0), getY(getHeight2()), getY(getHeight2()), getY(0)};
    //fill border
            g.setColor(Color.white);
            g.fillPolygon(x, y, 4);
    // draw border
            g.setColor(Color.red);
            g.drawPolyline(x, y, 5);
     
            if (animateFirstTime) {
                gOld.drawImage(image, 0, 0, null);
                return;
            }
            Color Fred = new Color (89,20,80);
            g.setColor(Fred);
            g.fillRect(130, 80, 40, 70);
     
            g.setColor(Color.GRAY);
            g.drawOval(230, 80, 40, 70);
     
            g.setColor(new Color(30,198,227));
            g.setFont(new Font("Arial",Font.PLAIN,50));
            g.drawString("Hi there!",160,300);      
     
            drawBox(600,200,0,100,15,Color.blue);
     
            drawBox(600,300,0,4,8,Color.gray);
     
            drawBox(600,350,0,1,2.5,Color.black);
     
             drawBox(625,300,0,1,1,Color.cyan);
     
              drawBox(575,300,0,1,1,Color.cyan);
     
              drawBox(625,250,0,1,1,Color.cyan);
     
              drawBox(575,250,0,1,1,Color.cyan);
     
              drawBox(400,300,0,4,13,Color.gray);
     
            drawBox(400,350,0,1,2.5,Color.black);
     
             drawBox(425,300,0,1,1,Color.cyan);
     
              drawBox(375,300,0,1,1,Color.cyan);
     
              drawBox(425,250,0,1,1,Color.cyan);
     
              drawBox(375,250,0,1,1,Color.cyan);
     
              drawBox(425,200,0,1,1,Color.cyan);
     
              drawBox(375,200,0,1,1,Color.cyan);
     
               drawcar(100,100,20,100,65,Color.GREEN);
     
            drawBox(600,450,0,100,10,Color.lightGray);
     
            drawBox(375,400,0,100,3,Color.black);
     
              drawBox(130+polygonMove++,385,0,4,1,Color.red);
     
              drawBox(130+polygonMove++,365,0,2,1,Color.red);
     
                drawCircle(100+polygonMove++,400,0,0.8,0.8,Color.DARK_GRAY);
     
               drawCircle(160+polygonMove++,400,0,0.8,0.8,Color.DARK_GRAY);
     
               drawBox(1130-polygonMove++,368,0,0.8,0.8,Color.cyan);
     
             drawBox(1130-polygonMove++,385,0,4,1,Color.blue);
     
              drawBox(1130-polygonMove++,365,0,2,1,Color.blue);
     
                drawCircle(1100-polygonMove++,400,0,0.8,0.8,Color.DARK_GRAY);
     
               drawCircle(1160-polygonMove++,400,0,0.8,0.8,Color.DARK_GRAY);
     
            drawHouse(100,100,0+polygonRotate++,5,5,Color.yellow);
     
     
     
               drawBox(130+polygonMove++,368,0,0.8,0.8,Color.cyan);
     
               drawBox(300,321,0,0.5,3,Color.BLACK);
     
     
               drawOval(300,275,0,2,4,Color.GREEN);
     
                drawBox(600-+polygonMove++,365,0,10.8,3,Color.yellow);
     
               drawBox(560-+polygonMove++,360,0,1,1,Color.cyan);
     
               drawBox(670-+polygonMove++,360,0,1,1,Color.cyan);
     
               drawBox(610-+polygonMove++,360,0,1,1,Color.cyan);
     
               drawBox(513-+polygonMove++,355,0,2,2,Color.cyan);
     
               drawCircle(700-+polygonMove++,400,0,1,1,Color.DARK_GRAY);
     
               drawCircle(500-+polygonMove++,400,0,1,1,Color.DARK_GRAY);
     
               drawBox(1130-polygonMove++,368,0,0.8,0.8,Color.cyan);
     
               g.setColor(new Color(130,98,117));
            g.setFont(new Font("Arial",Font.PLAIN,50));
            g.drawString("Work day!",270,150);
     
               Color sunColor = new Color(230,200,0);
            g.setColor(sunColor);
     
                g.setColor(Color.yellow);
            g.setFont(new Font("Arial",Font.PLAIN,30));
            g.drawString("zooom",50,340);            
     
     
            gOld.drawImage(image, 0, 0, null);
     
        }
        ////////////////////////////////////////////////////////////////////////////  
        public void drawcar(int xpos,int ypos,double rot,double xscale,double yscale,Color color)
        {
            g.translate(xpos,ypos);
            g.rotate(rot  * Math.PI/180.0);
            g.scale( xscale , yscale );
     
            g.setColor(color);
     drawBox(130,385,0,4,1,Color.red);
     
              drawBox(130,365,0,2,1,Color.red);
     
                drawCircle(100,400,0,0.8,0.8,Color.DARK_GRAY);
     
               drawCircle(160,400,0,0.8,0.8,Color.DARK_GRAY);
     
                drawBox(130,368,0,0.8,0.8,Color.cyan);
     
            g.scale( 1.0/xscale,1.0/yscale );
            g.rotate(-rot  * Math.PI/180.0);
            g.translate(-xpos,-ypos);
        }
    ////////////////////////////////////////////////////////////////////////////  
        public void drawHouse(int xpos,int ypos,double rot,double xscale,double yscale,Color color)
        {
            g.translate(xpos,ypos);
            g.rotate(rot  * Math.PI/180.0);
            g.scale( xscale , yscale );
     
            g.setColor(color);
            int xvals[] = {5,10,5,10,5,0,-5,-10,-5,-10,-5,0};
            int yvals[] = {-5,-5,0,5,5,10,5,5,0,-5,-5,-10};
            g.fillPolygon(xvals,yvals,xvals.length);
     
     
            g.scale( 1.0/xscale,1.0/yscale );
            g.rotate(-rot  * Math.PI/180.0);
            g.translate(-xpos,-ypos);
        }
          ////////////////////////////////////////////////////////////////////////////  
        public void drawBox(int xpos,int ypos,double rot,double xscale,double yscale,Color color)
        {
            g.translate(xpos,ypos);
            g.rotate(rot  * Math.PI/180.0);
            g.scale( xscale , yscale );
     
            g.setColor(color);
            g.fillRect(-10,-10,20,20);
     
            g.scale( 1.0/xscale,1.0/yscale );
            g.rotate(-rot  * Math.PI/180.0);
            g.translate(-xpos,-ypos);
        }
     
    ////////////////////////////////////////////////////////////////////////////
    //       drawCircle(100,100,0,1,1,Color.blue);    
        public void drawCircle(int xpos,int ypos,double rot,double xscale,double yscale,Color color)
        {
            g.translate(xpos,ypos);
            g.rotate(rot  * Math.PI/180.0);
            g.scale( xscale , yscale );
     
            g.setColor(color);
            g.fillOval(-10,-10,20,20);
     
            g.scale( 1.0/xscale,1.0/yscale );
            g.rotate(-rot  * Math.PI/180.0);
            g.translate(-xpos,-ypos);
        }
     
        ////////////////////////////////////////////////////////////////////////////
    //       drawCircle(150,100,0,2,1,Color.blue);    
        public void drawOval(int xpos,int ypos,double rot,double xscale,double yscale,Color color)
        {
            g.translate(xpos,ypos);
            g.rotate(rot  * Math.PI/180.0);
            g.scale( xscale , yscale );
     
            g.setColor(color);
            g.fillOval(-10,-10,20,20);
     
            g.scale( 1.0/xscale,1.0/yscale );
            g.rotate(-rot  * Math.PI/180.0);
            g.translate(-xpos,-ypos);
        }
     
    ////////////////////////////////////////////////////////////////////////////
    // needed for     implement runnable
        public void run() {
            while (true) {
                animate();
                repaint();
     
     
                double seconds = .04;    //time that 1 frame takes.
                int miliseconds = (int) (1000.0 * seconds);
                try {
                    Thread.sleep(miliseconds);
                } catch (InterruptedException e) {
                }
            }
        }
     
     
    /////////////////////////////////////////////////////////////////////////
        public void reset() {
     
        }
    /////////////////////////////////////////////////////////////////////////
        public void animate() {
            if (animateFirstTime) {
                animateFirstTime = false;
                if (xsize != getSize().width || ysize != getSize().height) {
                    xsize = getSize().width;
                    ysize = getSize().height;
                }
                reset();
            }
     
            polygonMove++;
            polygonRotate++;
     
        }
     
    ////////////////////////////////////////////////////////////////////////////
        public void start() {
            if (relaxer == null) {
                relaxer = new Thread(this);
                relaxer.start();
            }
        }
    ////////////////////////////////////////////////////////////////////////////
        public void stop() {
            if (relaxer.isAlive()) {
                relaxer.stop();
            }
            relaxer = null;
        }
     
     
    /////////////////////////////////////////////////////////////////////////
        public int getX(int x) {
            return (x + XBORDER + WINDOW_BORDER);
        }
     
        public int getY(int y) {
            return (y + YBORDER + YTITLE );
        }
     
        public int getYNormal(int y) {
            return (-y + YBORDER + YTITLE + getHeight2());
        }
     
        public int getWidth2() {
            return (xsize - 2 * (XBORDER + WINDOW_BORDER));
        }
     
        public int getHeight2() {
            return (ysize - 2 * YBORDER - WINDOW_BORDER - YTITLE);
     
     
     
        }
    }


    --- Update ---

    I don't know how to add scale option (for the sun), while it's rotating...

    --- Update ---

    package simpletextanimation;
     
    import java.awt.Color;
    import java.awt.Font;
    import static java.awt.Font.BOLD;
    import static java.awt.Font.ITALIC;
    import java.awt.Graphics;
    import java.awt.Graphics2D;
    import java.util.logging.Level;
    import java.util.logging.Logger;
    import javax.swing.JFrame;
    import javax.swing.JOptionPane;
    import javax.swing.JPanel;
    import static javax.swing.text.StyleConstants.Italic;
     
     
    public class SimpleTextAnimation extends JPanel{  
        int a=40;
        int b=0;
        int c=400;
        int d=300;
     
        int e=160;
     
        int f=50;
        int g=400;
        int h=350;
     
        int i=55;
        int j=100;
        int k=415;
        int l=400;
     
        int m=55;
        int n=150;
        int o=415;
        int p=450;
     
        public void paint(Graphics gp)
        {
            super.paint(gp);
     
     
     
            Graphics2D g2d= (Graphics2D) gp;
            g2d.setColor(Color.RED);
            g2d.setFont(new Font("BOLD", BOLD, 35));
     
            g2d.drawString("T", a, 150);
            g2d.drawString("H", 220, b);
            g2d.drawString("E", c, 150);
     
            g2d.drawString("E", a, 200);
            g2d.drawString("N", 220, f);
            g2d.drawString("D", g, 200);
     
     
     
     
            try {
     
                Thread.sleep(50);
     
                if(a<190 && c>250  && b<150  && f<200 && g>250 )
                {
                a+=5;
                b+=5;           
                c-=5;
                f+=5;
                g-=5;
     
                }
                else
                {
                a=190;
                b=150;
                c=250;
                f=200;
                g=250;
     
     
                }
     
     
            } catch (Exception e) {
            }
     
            repaint();
     
     
     
        }
     
     
        public static void main(String[] args) {
            JFrame jf = new JFrame();
            jf.setSize(500, 500);
            jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            jf.add(new SimpleTextAnimation());
            jf.setLocationRelativeTo(null);
            jf.setVisible(true);
        }
     
     
     
    }


    --- Update ---

    I have text animation, but it won't work when I add it to my main code

  4. #4
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    24,111
    Thanks
    53
    Thanked 2,618 Times in 2,568 Posts

    Default Re: Scale and text at the end of the animation

    Please add some comments to the code describing what it is supposed to do and how it is going to do it?

    For example where does the scale option fit into the code? When and how will it be done?
    What does it mean to "scale" the sun?


    I have text animation, but it won't work
    Where is that code? What does "it won't work" mean?
    If you don't understand my answer, don't ignore it, ask a question.

  5. #5
    Junior Member
    Join Date
    Nov 2020
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Scale and text at the end of the animation

    So, code above is working fine, but I'm having problems when I try to do following:
    1. add scale effect to the sun
    2. add THE END at the end of the animation.

    Hope it's much more clear now.

    Thank you very much.

    --- Update ---

    While the sun rotates, it should change the size from smaller, to bigger...Scale, from small to big.

  6. #6
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    24,111
    Thanks
    53
    Thanked 2,618 Times in 2,568 Posts

    Default Re: Scale and text at the end of the animation

    Please add comments to the code at the points where it is supposed to do what you are asking about.
    If you don't understand my answer, don't ignore it, ask a question.

  7. #7
    Junior Member
    Join Date
    Nov 2020
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Scale and text at the end of the animation

    package polygon;
     
     
     
    import java.io.*;
    import java.awt.*;
    import java.awt.geom.*;
    import java.awt.event.*;
    import javax.swing.*;
     
     
     
     
    public class Polygon extends JFrame implements Runnable {
     
        static final int XBORDER = 0;
        static final int YBORDER = 0;
        static final int YTITLE = 30;
        static final int WINDOW_BORDER = 8;
        static final int WINDOW_WIDTH = 2*(WINDOW_BORDER + XBORDER) + 800;
        static final int WINDOW_HEIGHT = YTITLE + WINDOW_BORDER + 2 * YBORDER + 500;
     
        boolean animateFirstTime = true;
        int xsize = -1;
        int ysize = -1;
        Image image;
        Graphics2D g;
     
       int polygonMove;
       int polygonRotate;
     
        static Polygon frame;
        public static void main(String[] args) {
            frame = new Polygon();
            frame.setSize(WINDOW_WIDTH, WINDOW_HEIGHT);
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            frame.setVisible(true);
        }
     
           public Polygon() {
            addMouseListener(new MouseAdapter() {
                public void mousePressed(MouseEvent e) {
                    if (e.BUTTON1 == e.getButton()) {
                        //left button
     
    // location of the cursor.
                        int xpos = e.getX();
                        int ypos = e.getY();
     
                    }
                    if (e.BUTTON3 == e.getButton()) {
                        //right button
                        reset();
                    }
                    repaint();
                }
            });
     
        addMouseMotionListener(new MouseMotionAdapter() {
          public void mouseDragged(MouseEvent e) {
            repaint();
          }
        });
     
        addMouseMotionListener(new MouseMotionAdapter() {
          public void mouseMoved(MouseEvent e) {
     
            repaint();
          }
        });
     
            addKeyListener(new KeyAdapter() {
     
                public void keyPressed(KeyEvent e) {
                    if (e.VK_UP == e.getKeyCode()) {
     
                    } else if (e.VK_DOWN == e.getKeyCode()) {
     
                    } else if (e.VK_LEFT == e.getKeyCode()) {
     
                    } else if (e.VK_RIGHT == e.getKeyCode()) {
     
                    }
                    repaint();
                }
            });
            init();
            start();
        }
        Thread relaxer;
    ////////////////////////////////////////////////////////////////////////////
        public void init() {
            requestFocus();
        }
    ////////////////////////////////////////////////////////////////////////////
        public void destroy() {
        }
     
    ////////////////////////////////////////////////////////////////////////////
     
     
    ////////////////////////////////////////////////////////////////////////////
        public void paint(Graphics gOld) {
            if (image == null || xsize != getSize().width || ysize != getSize().height) {
                xsize = getSize().width;
                ysize = getSize().height;
                image = createImage(xsize, ysize);
                g = (Graphics2D) image.getGraphics();
                g.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
                        RenderingHints.VALUE_ANTIALIAS_ON);
            }
    //fill background
            g.setColor(Color.cyan);
            g.fillRect(0, 0, xsize, ysize);
     
            int x[] = {getX(0), getX(getWidth2()), getX(getWidth2()), getX(0), getX(0)};
            int y[] = {getY(0), getY(0), getY(getHeight2()), getY(getHeight2()), getY(0)};
    //fill border
            g.setColor(Color.white);
            g.fillPolygon(x, y, 4);
    // draw border
            g.setColor(Color.red);
            g.drawPolyline(x, y, 5);
     
            if (animateFirstTime) {
                gOld.drawImage(image, 0, 0, null);
                return;
            }
            Color Fred = new Color (89,20,80);
            g.setColor(Fred);
            g.fillRect(130, 80, 40, 70);
     
            g.setColor(Color.GRAY);
            g.drawOval(230, 80, 40, 70);
     
            g.setColor(new Color(30,198,227));
            g.setFont(new Font("Arial",Font.PLAIN,50));
            g.drawString("Hi there!",160,300);      
     
            drawBox(600,200,0,100,15,Color.blue);
     
            drawBox(600,300,0,4,8,Color.gray);
     
            drawBox(600,350,0,1,2.5,Color.black);
     
             drawBox(625,300,0,1,1,Color.cyan);
     
              drawBox(575,300,0,1,1,Color.cyan);
     
              drawBox(625,250,0,1,1,Color.cyan);
     
              drawBox(575,250,0,1,1,Color.cyan);
     
              drawBox(400,300,0,4,13,Color.gray);
     
            drawBox(400,350,0,1,2.5,Color.black);
     
             drawBox(425,300,0,1,1,Color.cyan);
     
              drawBox(375,300,0,1,1,Color.cyan);
     
              drawBox(425,250,0,1,1,Color.cyan);
     
              drawBox(375,250,0,1,1,Color.cyan);
     
              drawBox(425,200,0,1,1,Color.cyan);
     
              drawBox(375,200,0,1,1,Color.cyan);
     
               drawcar(100,100,20,100,65,Color.GREEN);
     
            drawBox(600,450,0,100,10,Color.lightGray);
     
            drawBox(375,400,0,100,3,Color.black);
     
              drawBox(130+polygonMove++,385,0,4,1,Color.red);
     
              drawBox(130+polygonMove++,365,0,2,1,Color.red);
     
                drawCircle(100+polygonMove++,400,0,0.8,0.8,Color.DARK_GRAY);
     
               drawCircle(160+polygonMove++,400,0,0.8,0.8,Color.DARK_GRAY);
     
               drawBox(1130-polygonMove++,368,0,0.8,0.8,Color.cyan);
     
             drawBox(1130-polygonMove++,385,0,4,1,Color.blue);
     
              drawBox(1130-polygonMove++,365,0,2,1,Color.blue);
     
                drawCircle(1100-polygonMove++,400,0,0.8,0.8,Color.DARK_GRAY);
     
               drawCircle(1160-polygonMove++,400,0,0.8,0.8,Color.DARK_GRAY);
     
            drawHouse(100,100,0+polygonRotate++,5,5,Color.yellow);
     
     
     
               drawBox(130+polygonMove++,368,0,0.8,0.8,Color.cyan);
     
               drawBox(300,321,0,0.5,3,Color.BLACK);
     
     
               drawOval(300,275,0,2,4,Color.GREEN);
     
                drawBox(600-+polygonMove++,365,0,10.8,3,Color.yellow);
     
               drawBox(560-+polygonMove++,360,0,1,1,Color.cyan);
     
               drawBox(670-+polygonMove++,360,0,1,1,Color.cyan);
     
               drawBox(610-+polygonMove++,360,0,1,1,Color.cyan);
     
               drawBox(513-+polygonMove++,355,0,2,2,Color.cyan);
     
               drawCircle(700-+polygonMove++,400,0,1,1,Color.DARK_GRAY);
     
               drawCircle(500-+polygonMove++,400,0,1,1,Color.DARK_GRAY);
     
               drawBox(1130-polygonMove++,368,0,0.8,0.8,Color.cyan);
     
               g.setColor(new Color(130,98,117));
            g.setFont(new Font("Arial",Font.PLAIN,50));
            g.drawString("Work day!",270,150);
     
               Color sunColor = new Color(230,200,0);
            g.setColor(sunColor);
     
                g.setColor(Color.yellow);
            g.setFont(new Font("Arial",Font.PLAIN,30));
            g.drawString("zooom",50,340);            
     
     
            gOld.drawImage(image, 0, 0, null);
     
        }
        ////////////////////////////////////////////////////////////////////////////  
        public void drawcar(int xpos,int ypos,double rot,double xscale,double yscale,Color color)
        {
            g.translate(xpos,ypos);
            g.rotate(rot  * Math.PI/180.0);
            g.scale( xscale , yscale );
     
            g.setColor(color);
     drawBox(130,385,0,4,1,Color.red);
     
              drawBox(130,365,0,2,1,Color.red);
     
                drawCircle(100,400,0,0.8,0.8,Color.DARK_GRAY);
     
               drawCircle(160,400,0,0.8,0.8,Color.DARK_GRAY);
     
                drawBox(130,368,0,0.8,0.8,Color.cyan);
     
            g.scale( 1.0/xscale,1.0/yscale );
            g.rotate(-rot  * Math.PI/180.0);
            g.translate(-xpos,-ypos);
        }
    ////////////////////////////////////////////////////////////////////////////  
        public void drawHouse(int xpos,int ypos,double rot,double xscale,double yscale,Color color)  //SCALE EFFECT HERE
        {
            g.translate(xpos,ypos);
            g.rotate(rot  * Math.PI/180.0);
            g.scale( xscale , yscale );
     
            g.setColor(color);
            int xvals[] = {5,10,5,10,5,0,-5,-10,-5,-10,-5,0};
            int yvals[] = {-5,-5,0,5,5,10,5,5,0,-5,-5,-10};
            g.fillPolygon(xvals,yvals,xvals.length);
     
     
            g.scale( 1.0/xscale,1.0/yscale );
            g.rotate(-rot  * Math.PI/180.0);
            g.translate(-xpos,-ypos);
        }
          ////////////////////////////////////////////////////////////////////////////  
        public void drawBox(int xpos,int ypos,double rot,double xscale,double yscale,Color color)
        {
            g.translate(xpos,ypos);
            g.rotate(rot  * Math.PI/180.0);
            g.scale( xscale , yscale );
     
            g.setColor(color);
            g.fillRect(-10,-10,20,20);
     
            g.scale( 1.0/xscale,1.0/yscale );
            g.rotate(-rot  * Math.PI/180.0);
            g.translate(-xpos,-ypos);
        }
     
    ////////////////////////////////////////////////////////////////////////////
    //       drawCircle(100,100,0,1,1,Color.blue);    
        public void drawCircle(int xpos,int ypos,double rot,double xscale,double yscale,Color color)
        {
            g.translate(xpos,ypos);
            g.rotate(rot  * Math.PI/180.0);
            g.scale( xscale , yscale );
     
            g.setColor(color);
            g.fillOval(-10,-10,20,20);
     
            g.scale( 1.0/xscale,1.0/yscale );
            g.rotate(-rot  * Math.PI/180.0);
            g.translate(-xpos,-ypos);
        }
     
        ////////////////////////////////////////////////////////////////////////////
    //       drawCircle(150,100,0,2,1,Color.blue);    
        public void drawOval(int xpos,int ypos,double rot,double xscale,double yscale,Color color)
        {
            g.translate(xpos,ypos);
            g.rotate(rot  * Math.PI/180.0);
            g.scale( xscale , yscale );
     
            g.setColor(color);
            g.fillOval(-10,-10,20,20);
     
            g.scale( 1.0/xscale,1.0/yscale );
            g.rotate(-rot  * Math.PI/180.0);
            g.translate(-xpos,-ypos);
        }
     
    ////////////////////////////////////////////////////////////////////////////
    // needed for     implement runnable
        public void run() {
            while (true) {
                animate();
                repaint();
     
     
                double seconds = .04;    //time that 1 frame takes.
                int miliseconds = (int) (1000.0 * seconds);
                try {
                    Thread.sleep(miliseconds);
                } catch (InterruptedException e) {
                }
            }
        }
     
     
    /////////////////////////////////////////////////////////////////////////
        public void reset() {
     
        }
    /////////////////////////////////////////////////////////////////////////
        public void animate() {
            if (animateFirstTime) {
                animateFirstTime = false;
                if (xsize != getSize().width || ysize != getSize().height) {
                    xsize = getSize().width;
                    ysize = getSize().height;
                }
                reset();
            }
     
            polygonMove++;
            polygonRotate++;
     
        }
     
    ////////////////////////////////////////////////////////////////////////////
        public void start() {
            if (relaxer == null) {
                relaxer = new Thread(this);
                relaxer.start();
            }
        }
    ////////////////////////////////////////////////////////////////////////////
        public void stop() {
            if (relaxer.isAlive()) {
                relaxer.stop();
            }
            relaxer = null;
        }
     
     
    /////////////////////////////////////////////////////////////////////////
        public int getX(int x) {
            return (x + XBORDER + WINDOW_BORDER);
        }
     
        public int getY(int y) {
            return (y + YBORDER + YTITLE );
        }
     
        public int getYNormal(int y) {
            return (-y + YBORDER + YTITLE + getHeight2());
        }
     
        public int getWidth2() {
            return (xsize - 2 * (XBORDER + WINDOW_BORDER));
        }
     
        public int getHeight2() {
            return (ysize - 2 * YBORDER - WINDOW_BORDER - YTITLE);
     
     
     
        }
    }


    --- Update ---

     public void drawHouse(int xpos,int ypos,double rot,double xscale,double yscale,Color color)
        {
            g.translate(xpos,ypos);
            g.rotate(rot  * Math.PI/180.0);
            g.scale( xscale , yscale );
     
            g.setColor(color);
            int xvals[] = {5,10,5,10,5,0,-5,-10,-5,-10,-5,0};
            int yvals[] = {-5,-5,0,5,5,10,5,5,0,-5,-5,-10};
            g.fillPolygon(xvals,yvals,xvals.length);
     
     
            g.scale( 1.0/xscale,1.0/yscale );
            g.rotate(-rot  * Math.PI/180.0);
            g.translate(-xpos,-ypos);
        }


    --- Update ---

    Here it is... I hope it's better now...

    --- Update ---

    And the THE END text, at the end of the animation.

  8. #8
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    24,111
    Thanks
    53
    Thanked 2,618 Times in 2,568 Posts

    Default Re: Scale and text at the end of the animation

    Please change the name of the class. The class name should describe what the class is used for. Polygon is the name of a Java SE class.

    Some initial questions that need to be commented in the code:
    What is the purpose of the mouse listener methods?
    What is the purpose of the init(), start, stop and destroy() methods? Why are they there?
    Where is the code for the text animation? Where and when should it be called?
    If you don't understand my answer, don't ignore it, ask a question.

  9. #9
    Junior Member
    Join Date
    Nov 2020
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Scale and text at the end of the animation

    Here is the code for the text animation... It should be called at the end of the animation.

    package simpletextanimation;
     
    import java.awt.Color;
    import java.awt.Font;
    import static java.awt.Font.BOLD;
    import static java.awt.Font.ITALIC;
    import java.awt.Graphics;
    import java.awt.Graphics2D;
    import java.util.logging.Level;
    import java.util.logging.Logger;
    import javax.swing.JFrame;
    import javax.swing.JOptionPane;
    import javax.swing.JPanel;
    import static javax.swing.text.StyleConstants.Italic;
     
     
    public class SimpleTextAnimation extends JPanel{  
        int a=40;
        int b=0;
        int c=400;
        int d=300;
     
        int e=160;
     
        int f=50;
        int g=400;
        int h=350;
     
        int i=55;
        int j=100;
        int k=415;
        int l=400;
     
        int m=55;
        int n=150;
        int o=415;
        int p=450;
     
        public void paint(Graphics gp)
        {
            super.paint(gp);
     
     
     
            Graphics2D g2d= (Graphics2D) gp;
            g2d.setColor(Color.RED);
            g2d.setFont(new Font("BOLD", BOLD, 35));
     
            g2d.drawString("T", a, 150);
            g2d.drawString("H", 220, b);
            g2d.drawString("E", c, 150);
     
            g2d.drawString("E", a, 200);
            g2d.drawString("N", 220, f);
            g2d.drawString("D", g, 200);
     
     
     
     
            try {
     
                Thread.sleep(50);
     
                if(a<190 && c>250  && b<150  && f<200 && g>250 )
                {
                a+=5;
                b+=5;           
                c-=5;
                f+=5;
                g-=5;
     
                }
                else
                {
                a=190;
                b=150;
                c=250;
                f=200;
                g=250;
     
     
                }
     
     
            } catch (Exception e) {
            }
     
            repaint();
     
     
     
        }
     
     
        public static void main(String[] args) {
            JFrame jf = new JFrame();
            jf.setSize(500, 500);
            jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            jf.add(new SimpleTextAnimation());
            jf.setLocationRelativeTo(null);
            jf.setVisible(true);
        }
     
     
     
    }

  10. #10
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    24,111
    Thanks
    53
    Thanked 2,618 Times in 2,568 Posts

    Default Re: Scale and text at the end of the animation

    If you want that text animation code to execute in main class (please rename it from Polygon) then it needs to be with the code in the main class.
    If you don't understand my answer, don't ignore it, ask a question.

  11. #11
    Junior Member
    Join Date
    Nov 2020
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Scale and text at the end of the animation

    I'm trying all day long, but no luck so far...

    Can you please help me with that, you don't have to deal with scaling issue...

    Thank you very much

  12. #12
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    24,111
    Thanks
    53
    Thanked 2,618 Times in 2,568 Posts

    Default Re: Scale and text at the end of the animation

    Start by adding code to the program that just displays the simple text: The End
    at the time and place you want the animated text to be shown.

    When that works, look at merging in the animation code.
    If you don't understand my answer, don't ignore it, ask a question.

  13. #13
    Junior Member
    Join Date
    Nov 2020
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Scale and text at the end of the animation

    Thank you very much for reading this+help, but I can't do this...

    I'm trying, but it just won't even start the animation...

    If someone else can do this, make modifications, it would be great.

    Once again, thanks.

  14. #14
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    24,111
    Thanks
    53
    Thanked 2,618 Times in 2,568 Posts

    Default Re: Scale and text at the end of the animation

    Can you add code to the program that prints a message (The End) on the screen at the end of the animation?
    That code would not be the full animation that you posted code for. First you need to find where and when in the code to start the full animation. The simple printing of a message should show that.

    I am assuming that you can read the code that you posted and understand what it is doing and where that simple code would be added.

    If most of this code has been copied from somewhere else and you do not know what I am talking about, I recommend you spend some time learning java before trying to change someone else's code.
    If you don't understand my answer, don't ignore it, ask a question.

  15. #15
    Junior Member
    Join Date
    Nov 2020
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Scale and text at the end of the animation

    U R absolutely right. I'm gonna do that.

Similar Threads

  1. Grey Scale?
    By maxiffer in forum What's Wrong With My Code?
    Replies: 1
    Last Post: September 30th, 2013, 09:15 PM
  2. How to scale the scrollpane's Vvalue
    By Jacques_ZA in forum What's Wrong With My Code?
    Replies: 0
    Last Post: January 25th, 2013, 02:05 AM
  3. how to get gray scale value from 16- bit grayscale image
    By div111 in forum What's Wrong With My Code?
    Replies: 1
    Last Post: January 16th, 2013, 08:51 AM
  4. [SOLVED] Scale Numbers from 0.0f to 1.0f
    By techwiz24 in forum Java Theory & Questions
    Replies: 1
    Last Post: September 23rd, 2011, 09:50 PM
  5. Blender file with animation, how to import OBJ(w/ animation) into Java?
    By cr80expert5 in forum Object Oriented Programming
    Replies: 0
    Last Post: May 12th, 2011, 03:11 AM