
import java.awt.*;
import java.util.*;
import java.applet.Applet;


public class Hallo extends Applet 
{
	public void paint(Graphics g) 
  {
    
    int x[]={1,1,1,1,1,1,1,1};
    int y[]={1,1,1,1,1,1,1,1};
    int rgx[]={1,1,1,1,1,1,1,1};
    int rgy[]={1,1,1,1,1,1,1,1};
    Color col;
    int c1,c2,c3;
    
    while (true)
    {
      
    	for (int i=0; (i<8); ++i)
    	{
    		x[i]=x[i]+(i+1)*rgx[i];
    		y[i]=y[i]+(i+3)*rgy[i];
    
    		if (x[i]>750) rgx[i]=-1;
    		if (y[i]>300) rgy[i]=-1;
    		if (x[i]<0) rgx[i]=1;
    		if (y[i]<0) rgy[i]=1;
    	}
    	
    	c1=x[1];
    	c2=x[2];
    	c3=x[3];
    	
      col = new Color(c1,c2,c3);

    	g.setColor(col);
   
    	g.fillPolygon(x,y,8); 
 
      try {Thread.sleep(100);}catch(InterruptedException e){}/*Warten*/
    	
    	g.setColor(Color.black);
    	g.fillRect(0,0,750,300);
    } 
  }
}