diff options
| -rw-r--r-- | AnimationInterpolate.c | 4 | ||||
| -rw-r--r-- | AnimationInterpolate.h | 3 | ||||
| -rw-r--r-- | graphics.c | 22 |
3 files changed, 10 insertions, 19 deletions
diff --git a/AnimationInterpolate.c b/AnimationInterpolate.c index 44bdafc..a84b5a2 100644 --- a/AnimationInterpolate.c +++ b/AnimationInterpolate.c @@ -29,11 +29,11 @@ A_Interpolate(const Animation* anim, PixelRendererParams a) { return a.pixel; } - if (a.frame.current == in.startFrame) { + if (a.frame.current == a.frame.start) { memcpy(in.initialValueTemp, in.value, in.initialValueTempSize); } - double perc = (double)(a.frame.current - in.startFrame) / (in.endFrame - in.startFrame); + double perc = (double)(a.frame.current - a.frame.start) / (a.frame.end - a.frame.start); if (perc < 0.0) perc = 0.0; if (perc > 1.0) perc = 1.0; diff --git a/AnimationInterpolate.h b/AnimationInterpolate.h index 4e83054..18ae841 100644 --- a/AnimationInterpolate.h +++ b/AnimationInterpolate.h @@ -4,9 +4,6 @@ #include "Animation.h" struct A_Interpolate { - u32 startFrame; - u32 endFrame; - void* initialValueTemp; size_t initialValueTempSize; @@ -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); |
