#ifndef _ANIM_
#define _ANIM_

#include "boxes.hh"
#include "misc.hh"

#define MAX_ANIM_STEPS 100

struct AnimStyle
{
	Rect start, end;
	MyColor color_from;
	MyColor color_to;
	int twd, tht; // travel width, height
	GC *gc;
	int steps;
	int tick;
	int lwd;
	int flags;
	int trail;

	AnimStyle ();

	int init ();
};

struct ARect: Rect // [A]nimation [Rect]angle - a piece of an animation
{
	ARect *next;
	GC gc;

	ARect (Rect &, GC &);
	~ARect ();
};

struct PRect: Rect // positioning rectangle - for from/to
{
	int start ();
	int end ();
	int ppos ();
	int max ();
	int imp (); // implosion
};

#define ANIM_L  0 // linear
#define ANIM_A  1 // accelerating
#define ANIM_D  2 // deccelerating
#define ANIM_AD 3 // acc./decc.

struct Anim
{
	PRect from, to;
	Rect r, d;
	double t;
	Timer *timer;
	ARect *first;
	int ai, gci;
	int nrects;
	int type;
	
	int add (ARect *);
	int rm ();
	
	Anim ();
	int delay ();
	int a_step ();
	int d_step ();
	int ad_step ();
	int step ();
	int run ();
	int imp ();
	int travel_exp ();
	int imp_travel ();
};

//********************************************************************

extern Anim anim;
extern AnimStyle as;

#endif
