Source

ArduinoProjects / Libraries / Animation / Animation.h

Full commit
#define MAX_NUM_ANIM_VALUES 8

//My animated servo
class Animation
{
public:
	enum AnimMode
	{
		AnimMode_Wrap,
		AnimMode_PingPong,
	};
	
	struct KeyFrame
	{
		float time;
		float value;
	};

	Animation(KeyFrame* valueArray, int numValues, AnimMode mode);

	void SetValues(KeyFrame* valueArray, int numValues);
	float CalcAnimVal();

	void Update(float timeDelta);

	float currT;
	float totalAnimTime;
	float animSpeed;
	float animDir;

	KeyFrame animValues[MAX_NUM_ANIM_VALUES];
	int numAnimValues;

	float endPauseTime;
	float pauseTimer;

	AnimMode animMode;
	
private:

};