Update instead of overwrite value in easing system
This commit is contained in:
@@ -66,6 +66,7 @@ void updateEasingSystem(ecs_iter_t *it) {
|
||||
easing[i].elapsed += dt;
|
||||
f32 alpha = easing[i].elapsed / easing[i].duration;
|
||||
alpha = BZ_MIN(1.0f, alpha);
|
||||
f32 prevX = easing[i].x;
|
||||
easing[i].x = bzEase(easing[i].easingFunc, alpha);
|
||||
|
||||
const Easing *e = &easing[i];
|
||||
@@ -74,10 +75,13 @@ void updateEasingSystem(ecs_iter_t *it) {
|
||||
x = e->easeStart + e->easeTarget * x + e->easeOffset;
|
||||
// Outer
|
||||
x = e->start + e->target * x + e->offset;
|
||||
easing->x = x;
|
||||
|
||||
u8 *compData = ecs_get_mut_id(ECS, entity, easing[i].compID);
|
||||
compData += easing[i].memberOffset;
|
||||
f32 *out = (f32 *) compData;
|
||||
|
||||
*(f32 *) compData = x;
|
||||
*out -= prevX;
|
||||
*out += x;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user