38 lines
No EOL
844 B
C++
38 lines
No EOL
844 B
C++
#pragma once
|
|
|
|
#include <math.h>
|
|
#include "helpers.hpp"
|
|
|
|
namespace asloengine
|
|
{
|
|
|
|
class Animation
|
|
{
|
|
|
|
public:
|
|
enum Function
|
|
{
|
|
LINEAR, EASE_IN, EASE_OUT, EASE_IN_OUT
|
|
};
|
|
|
|
Animation(Function _function, float _start_value, float _end_value, float _duration);
|
|
|
|
void reset(Function _function, float _start_value, float _end_value, float _duration);
|
|
float animate(float delta_time);
|
|
|
|
protected:
|
|
Function function;
|
|
float start_value;
|
|
float current_value;
|
|
float end_value;
|
|
float time;
|
|
float duration;
|
|
|
|
float calculate_linear();
|
|
float calculate_ease_in();
|
|
float calculate_ease_out();
|
|
float calculate_ease_in_out();
|
|
|
|
};
|
|
|
|
} |