From 56099072165578b505a6c81e187cf392b9bd5a2e Mon Sep 17 00:00:00 2001 From: Syndamia Date: Mon, 16 Mar 2026 20:59:04 +0200 Subject: fix: Rework interpolation to use newly introduced start and end frame times --- graphics.c | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) (limited to 'graphics.c') diff --git a/graphics.c b/graphics.c index 97b07df..4ac5055 100644 --- a/graphics.c +++ b/graphics.c @@ -150,23 +150,17 @@ main() { /* Move child node from right to left */ - childNode_moveToLeft.startFrame = segment_spin_moveToLeft.startFrame = segment_translate_moveToLeft.startFrame - = anim.frameCount / 3 - FPS; - childNode_moveToLeft.endFrame = segment_spin_moveToLeft.endFrame = segment_translate_moveToLeft.endFrame - = anim.frameCount / 3; - Animation_pushEvent(&anim, childNode_moveToLeft.startFrame, childNode_moveToLeft.endFrame, A_Interpolate, &childNode_moveToLeft); - Animation_pushEvent(&anim, childNode_moveToLeft.startFrame, childNode_moveToLeft.endFrame, A_Interpolate, &segment_spin_moveToLeft); - Animation_pushEvent(&anim, childNode_moveToLeft.startFrame, childNode_moveToLeft.endFrame, A_Interpolate, &segment_translate_moveToLeft); + u32 start = anim.frameCount / 3 - FPS, end = anim.frameCount / 3; + Animation_pushEvent(&anim, start, end, A_Interpolate, &childNode_moveToLeft); + Animation_pushEvent(&anim, start, end, A_Interpolate, &segment_spin_moveToLeft); + Animation_pushEvent(&anim, start, end, A_Interpolate, &segment_translate_moveToLeft); /* Move child node from left to right */ - childNode_moveToRight.startFrame = segment_spin_moveToRight.startFrame = segment_translate_moveToRight.startFrame - = anim.frameCount * 2 / 3 - FPS; - childNode_moveToRight.endFrame = segment_spin_moveToRight.endFrame = segment_translate_moveToRight.endFrame - = anim.frameCount * 2 / 3; - Animation_pushEvent(&anim, childNode_moveToRight.startFrame, childNode_moveToRight.endFrame, A_Interpolate, &childNode_moveToRight); - Animation_pushEvent(&anim, childNode_moveToRight.startFrame, childNode_moveToRight.endFrame, A_Interpolate, &segment_spin_moveToRight); - Animation_pushEvent(&anim, childNode_moveToRight.startFrame, childNode_moveToRight.endFrame, A_Interpolate, &segment_translate_moveToRight); + start = anim.frameCount * 2 / 3 - FPS, end = anim.frameCount * 2 / 3; + Animation_pushEvent(&anim, start, end, A_Interpolate, &childNode_moveToRight); + Animation_pushEvent(&anim, start, end, A_Interpolate, &segment_spin_moveToRight); + Animation_pushEvent(&anim, start, end, A_Interpolate, &segment_translate_moveToRight); Animation_render(&anim); -- cgit v1.2.3