

import java.util.*;
import java.awt.*;


public class DrawingLine extends Object {

	
    long startTime;
	long currentTime;
	int startX, startY;
	
	int r, g, b;
	int R, G, B;
	Color c;
	boolean dead = false;
	
	Vector linePoints = new Vector(200);
	Color lineColor;
	
	int id;
	
	public DrawingLine(long time, int x, int y, Color c, int id) {
		
		this.id = id;
		
        this.startTime = time;
		this.startX = x;
        this.startY = y;	
		
		this.c = c;
		
		this.r = c.getRed();
		this.g = c.getGreen();
		this.b = c.getBlue();
    }
	
	
	public Color lighterColor(long currentTime) {
		
		this.currentTime = currentTime;
		long differenceTime = currentTime - startTime;
		int t = (int)(0.0003*differenceTime);
		
		r = (int)(r+t);
		if (r > 255) {r = 255;}
		
		g = (int)(g+t);
		if (g > 255) {g = 255;}
		
		b = (int)(b+t);
		if (b > 255) {b = 255;}
		
		if (r==255 & g==255 & b==255) {dead = true;}
		
		lineColor = new Color(r,g,b);
		return lineColor;	
	}
	

	public void paintLine(JoeyGraphics g, Color sentColor, int step) {
		
		int s = linePoints.size();
		
		g.setColor(sentColor);

		if (s>step+1) {
			for (int j=s-1-step; j<s-step; j++) {
				g.drawIdLine(id,
					((DrawingPoint)(linePoints.elementAt(j))).x,
					((DrawingPoint)(linePoints.elementAt(j))).y,
					((DrawingPoint)(linePoints.elementAt(j+step))).x,
					((DrawingPoint)(linePoints.elementAt(j+step))).y);
			}
		}
	}


}



