soufianekhiat/ImAnim: Animation Enginer for Dear ImGui

✨ Explore this must-read post from Hacker News 📖

📂 Category:

📌 Here’s what you’ll learn:

Hero

Animation Engine for Dear ImGui

ImAnim brings modern animation capabilities to ImGui applications. Write smooth, UI animations with minimal code.

// Animate anything in one line
float alpha = iam_tween_float(id, channel, hovered ? 1.0f : 0.5f, 0.3f, ease, policy, dt);
  • Immediate-mode friendly – Works naturally with ImGui’s paradigm
  • Zero dependencies – Only requires Dear ImGui
  • Large easing collection – 30+ easing functions including spring physics
  • Perceptual color blending – OKLAB and OKLCH
  • Responsive layouts – Anchor-relative animations that survive window resizing

Category Capabilities
Tweens Float, Vec2, Vec4, Int, Color with crossfade/cut/queue policies
Clips Timeline keyframes, looping, callbacks, chaining, stagger
Easing Quad to Bounce presets, cubic-bezier, steps, spring physics
Paths Bezier curves, Catmull-Rom splines, text along paths
Procedural Oscillators, shake, wiggle, Perlin/Simplex noise
Extras Style interpolation, scroll animation, debug inspector

#include "im_anim.h"

// Each frame
iam_update_begin_frame();
iam_clip_update(dt);

// Hover animation
bool hovered = ImGui::IsItemHovered();
float scale = iam_tween_float(
    ImGui::GetID("button"), ImHashStr("scale"),
    hovered ? 1.1f : 1.0f,
    0.15f,
    iam_ease_preset(iam_ease_out_back),
    iam_policy_crossfade,
    dt
);

Add two files to your project:

src/im_anim.h
src/im_anim.cpp

That’s it. No build system changes, no external dependencies.

Full documentation in the docs/ folder:

The demo/ folder contains a comprehensive demo showcasing all features:

  • Interactive easing curve visualizer
  • Cubic bezier editor
  • Spring physics playground
  • All animation types with live controls
  • Performance benchmarks

ImGui Integration

ImGui Integration

Development is supported through Patreon:

Patreon

MIT License – see LICENSE for details.


Made for the Dear ImGui community

🔥 What do you think?

#️⃣ #soufianekhiatImAnim #Animation #Enginer #Dear #ImGui

🕒 Posted on 1764607993

By

Leave a Reply

Your email address will not be published. Required fields are marked *