From 1cc8f72fb1c44e203a324e274038c2883c351fbb Mon Sep 17 00:00:00 2001 From: Syndamia Date: Sat, 28 Mar 2026 22:14:32 +0200 Subject: feat: Add animation capabilities with linear interpolation --- AnimationRender/AnimationRender.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 AnimationRender/AnimationRender.c (limited to 'AnimationRender/AnimationRender.c') diff --git a/AnimationRender/AnimationRender.c b/AnimationRender/AnimationRender.c new file mode 100644 index 0000000..8974ba3 --- /dev/null +++ b/AnimationRender/AnimationRender.c @@ -0,0 +1,26 @@ +#include "AnimationRender.h" +#include "FrameCallback.h" + +void RenderAnimation(u32 width, u32 height, u32 totalFrames, const FrameCallback** callbacks, usize sizeCallbacks) { + RGBImage frameBuffer = RGBImage_new(width, height); + + struct FrameContext fc; + fc.startFrame = 0; + fc.endFrame = totalFrames; + fc.frameBuffer = frameBuffer; + + for (u32 f = 0; f < totalFrames; ++f) { + fc.frame = f; + for (usize i = 0; i < sizeCallbacks; ++i) { + // Soft context reset + if (callbacks[i] == NULL) { + fc.startFrame = 0; + fc.endFrame = totalFrames; + } + else + callbacks[i]->callback(callbacks[i]->callback_self, &fc); + } + } + + RGBImage_delete(&frameBuffer); +} -- cgit v1.2.3