Generalize easing system (works for all components now)

This commit is contained in:
2023-12-29 20:03:01 +01:00
parent 69232cebf4
commit 3ec7505214
4 changed files with 17 additions and 40 deletions

View File

@@ -111,20 +111,13 @@ typedef struct Animation {
} Animation;
extern ECS_COMPONENT_DECLARE(Animation);
typedef enum EasingType {
EASE_ROTATION,
EASE_POS_X,
EASE_POS_Y,
EASE_SIZE_X,
EASE_SIZE_Y,
} EasingType;
typedef struct Easing {
EasingType type;
ecs_entity_t compID;
size_t memberOffset;
BzEaseType easingFunc;
// start + target * (easeStart + (easeTarget * x) + easeOffset) + offset
f32 target;
f32 start;
f32 offset;
@@ -135,7 +128,6 @@ typedef struct Easing {
f32 x;
f32 elapsed;
f32 duration;
//struct Easing *next;
} Easing;
extern ECS_COMPONENT_DECLARE(Easing);