// (c) Academic Java. All rights reserved.
// See http://academicjava.com/animations/conditions.html for conditions of use

package animations;

import java.awt.*;
import javax.swing.*;
import javax.swing.border.*;
import org.academicjava.animation.*;

public class MitsubishiCanvas extends ACanvas {

	public MitsubishiCanvas(Color c, int width, int height) {
		super(c, width, height);
	}

	public void draw(final int canvasAnimationTime) {
		Thread drawer = new Thread() {
			@Override
			public void run() {
				// 6 ops...
				setAnimationTime(canvasAnimationTime/6);
				APolygon p = new APolygon(
							Color.red,
							new int[]{0, -33, 0, 33, 0, -67, -100, -33, 0, 67, 100, 33},
							new int[]{0, -58, -115, -58, 0, 0, 58, 58, 0, 0, 58, 58});
				add(p);
				p.draw();
				p.scale(-1,1);
				p.setColor(Color.cyan);
				p.scale(1,-1);
				p.setColor(Color.red);
				p.rotate(60);
			}
		};
		drawer.start();
	}

	public static void main(String[] args) {
		MitsubishiCanvas canvas = new MitsubishiCanvas(Color.black, 250, 250);
		JFrame frame = new JFrame("Mitsubishi");
		Container cp = frame.getContentPane();
		cp.add(canvas, BorderLayout.CENTER);

		JPanel jp = new JPanel();
		Border b = new LineBorder(Color.blue,5);
		jp.setBorder(b);
		jp.add(canvas);
		cp.add(jp, BorderLayout.CENTER);

		frame.setResizable(false);
		frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		frame.pack();
		frame.setLocationRelativeTo(null);
		frame.setVisible(true);

		canvas.draw(3000);
	}
}