package com.one.vector;

import javax.microedition.lcdui.Canvas;
import java.util.TimerTask;
import com.one.PaintableObject;

public class AnimationTask extends TimerTask
{
	protected VectorImage image;
	protected PaintableObject canvas;
	
	public AnimationTask(VectorImage image, PaintableObject canvas)
	{
		this.image = image;
		this.canvas = canvas;
	}
	
	public void run()
	{
		synchronized(image)
		{
			image.nextFrame();
		}
		
		canvas.repaint();
		canvas.serviceRepaints();
	}
}