public class AddAnimation implements Runnable{
	private Field field;
	private SpiderSolitia st;
	private FieldCard [] fc;
	private int[] dx;
	private int[] dy;
	public AddAnimation(SpiderSolitia st,Field field,FieldCard [] fc){
		this.field = field;
		this.st = st;
		this.fc = fc;
		dx = new int[10];
		dy = new int[10];
	}
	public void run(){
		int cnt = 0;
		int dcnt = 1;
		for(int i = 0;i < 10;i++){
			dx[i] = 510 - st.getXX(i);  
			dy[i] = 475 - (50 + (field.getCardRow(i).getSize() * 12));
		}
		field.getCardRow(cnt).addCard(fc[cnt]);
		st.musicPlay();
		while(cnt <= 9){
			try{
				Thread.sleep(10);
				int set_x = 510 - dx[cnt] * dcnt / 20;
				int set_y = 475 - dy[cnt] * dcnt / 20;
				fc[cnt].setFrontstate(true);
				fc[cnt].setIndex_x(set_x);
				fc[cnt].setIndex_y(set_y);
				dcnt = dcnt + 1;
				if(dcnt > 20){
					cnt = cnt + 1;
					if(cnt != 10){
						field.getCardRow(cnt).addCard(fc[cnt]);
						st.musicPlay();
					}
					dcnt = 1;
				}
				st.repaint();
			}catch(InterruptedException e){
			}
		}
		st.addThreadStop();
	}
}
