ImAnim: animate values in Dear ImGui. Its core is the tween: a float, a vector or a color moves toward its target with an easing, frame by frame. Around it: springs, motion paths, text effects, and clips (timelines of keyframes).
The C++ API of ImAnim: the signatures and the documentation of its headers. This page is generated by litgen, the engine behind the Python bindings of Dear ImGui Bundle. Functions without Python bindings are not listed.
im_anim.h¶
PI constants¶
ease_type (enum)¶
enum ease_typePublic enums & descriptors (C-style)
| Member | Value | |
|---|---|---|
ease_linear = 0 | 0 | |
ease_in_quad | 1 | |
ease_out_quad | 2 | |
ease_in_out_quad | 3 | |
ease_in_cubic | 4 | |
ease_out_cubic | 5 | |
ease_in_out_cubic | 6 | |
ease_in_quart | 7 | |
ease_out_quart | 8 | |
ease_in_out_quart | 9 | |
ease_in_quint | 10 | |
ease_out_quint | 11 | |
ease_in_out_quint | 12 | |
ease_in_sine | 13 | |
ease_out_sine | 14 | |
ease_in_out_sine | 15 | |
ease_in_expo | 16 | |
ease_out_expo | 17 | |
ease_in_out_expo | 18 | |
ease_in_circ | 19 | |
ease_out_circ | 20 | |
ease_in_out_circ | 21 | |
ease_in_back | 22 | |
ease_out_back | 23 | |
ease_in_out_back | 24 | p0 = overshoot |
ease_in_elastic | 25 | |
ease_out_elastic | 26 | |
ease_in_out_elastic | 27 | p0 = amplitude, p1 = period |
ease_in_bounce | 28 | |
ease_out_bounce | 29 | |
ease_in_out_bounce | 30 | |
ease_steps | 31 | p0 = steps (>=1), p1 = 0:end 1:start 2:both |
ease_cubic_bezier | 32 | p0=x1 p1=y1 p2=x2 p3=y2 |
ease_spring | 33 | p0=mass p1=stiffness p2=damping p3=v0 |
ease_custom | 34 | User-defined easing function (use ease_custom_fn) |
policy (enum)¶
enum policy| Member | Value | |
|---|---|---|
policy_crossfade = 0 | 0 | smooth into new target |
policy_cut | 1 | snap to target |
policy_queue | 2 | queue one pending target |
policy_additive | 3 | add animated delta to current value |
policy_multiply | 4 | multiply current value by animated factor |
color_space (enum)¶
enum color_space| Member | Value | |
|---|---|---|
col_srgb = 0 | 0 | blend in sRGB (not physically linear) |
col_srgb_linear | 1 | sRGB<->linear, blend in linear, back to sRGB |
col_hsv | 2 | blend H/S/V (hue shortest arc), keep A linear |
col_oklab | 3 | sRGB<->OKLAB, blend in OKLAB, back to sRGB |
col_oklch | 4 | sRGB<->OKLCH (cylindrical OKLAB), blend in OKLCH, back to sRGB |
anchor_space (enum)¶
enum anchor_space| Member | Value | |
|---|---|---|
anchor_window_content = 0 | 0 | ImGui::GetContentRegionAvail() |
anchor_window | 1 | ImGui::GetWindowSize() |
anchor_viewport | 2 | ImGui::GetWindowViewport()->Size |
anchor_last_item | 3 | ImGui::GetItemRectSize() |
ease_desc (struct)¶
struct ease_descDescriptor for any easing (preset or parametric)
| Member | |
|---|---|
int type; | ease_type |
float p0, | |
p1, | |
p2, | |
p3; |
update_begin_frame¶
IM_ANIM_API void update_begin_frame();Call once per frame before any tweens.
Custom easing function callback (t in [0,1], returns eased value)
[/ADAPT_IMGUI_BUNDLE]
Public API declarations
Frame management
gc¶
IM_ANIM_API void gc(unsigned int max_age_frames = 600);Remove stale tween entries older than max_age_frames.
pool_clear¶
IM_ANIM_API void pool_clear();Manually clean up pools.
reserve¶
IM_ANIM_API void reserve(int cap_float, int cap_vec2, int cap_vec4, int cap_int, int cap_color);Pre-allocate pool capacity.
set_ease_lut_samples¶
IM_ANIM_API void set_ease_lut_samples(int count);Set LUT resolution for parametric easings (default: 256).
Global time scale (for slow-motion / fast-forward debugging)¶
set_global_time_scale¶
IM_ANIM_API void set_global_time_scale(float scale);Set global time multiplier (1.0 = normal, 0.5 = half speed, 2.0 = double).
get_global_time_scale¶
IM_ANIM_API float get_global_time_scale();Get current global time scale.
set_lazy_init¶
IM_ANIM_API void set_lazy_init(bool enable);Enable/disable lazy initialization (default: True).
Lazy Initialization - defer channel creation until animation is needed
is_lazy_init_enabled¶
IM_ANIM_API bool is_lazy_init_enabled();Check if lazy init is enabled.
Custom easing functions¶
register_custom_ease¶
IM_ANIM_API void register_custom_ease(int slot, ease_fn fn);Register custom easing in slot 0-15. Use with ease_custom_fn(slot).
get_custom_ease¶
IM_ANIM_API ease_fn get_custom_ease(int slot);Get registered custom easing function.
Debug UI¶
show_unified_inspector¶
IM_ANIM_API void show_unified_inspector(bool* p_open = nullptr);Show unified inspector (merges debug window + animation inspector).
show_debug_timeline¶
IM_ANIM_API void show_debug_timeline(ImGuiID instance_id);Show debug timeline for a clip instance.
Performance Profiler¶
profiler_enable¶
IM_ANIM_API void profiler_enable(bool enable);Enable/disable the performance profiler.
profiler_is_enabled¶
IM_ANIM_API bool profiler_is_enabled();Check if profiler is enabled.
profiler_begin_frame¶
IM_ANIM_API void profiler_begin_frame();Call at frame start when profiler is enabled.
profiler_end_frame¶
IM_ANIM_API void profiler_end_frame();Call at frame end when profiler is enabled.
profiler_begin¶
IM_ANIM_API void profiler_begin(const char* name);Begin a named profiler section.
profiler_end¶
IM_ANIM_API void profiler_end();End the current profiler section.
drag_opts (struct)¶
struct drag_optsDrag Feedback - animated feedback for drag operations
| Member | |
|---|---|
ImVec2 snap_grid; | Grid size for snapping (0,0 = no grid) |
ImVec2* snap_points; | Array of custom snap points |
int snap_points_count; | Number of snap points |
float snap_duration; | Duration of snap animation |
float overshoot; | Overshoot amount (0 = none, 1 = normal) |
int ease_type; | Easing type for snap animation |
drag_opts::drag_opts¶
drag_opts() : snap_grid(0, 0), snap_points(nullptr), snap_points_count(0), snap_duration(0.2f), overshoot(0), ease_type(ease_out_cubic);drag_feedback (struct)¶
struct drag_feedback| Member | |
|---|---|
ImVec2 position; | Current animated position |
ImVec2 offset; | Offset from drag start |
ImVec2 velocity; | Current velocity estimate |
bool is_dragging; | Currently being dragged |
bool is_snapping; | Currently snapping to target |
float snap_progress; | Snap animation progress (0-1) |
drag_begin¶
IM_ANIM_API drag_feedback drag_begin(ImGuiID id, ImVec2 pos);Start tracking drag at position.
drag_update¶
IM_ANIM_API drag_feedback drag_update(ImGuiID id, ImVec2 pos, float dt);Update drag position during drag.
drag_release¶
IM_ANIM_API drag_feedback drag_release(ImGuiID id, ImVec2 pos, drag_opts const& opts, float dt);Release drag with animated feedback.
drag_cancel¶
IM_ANIM_API void drag_cancel(ImGuiID id);Cancel drag tracking.
wave_type (enum)¶
enum wave_typeOscillators - continuous periodic animations
| Member | Value | |
|---|---|---|
wave_sine = 0 | 0 | Smooth sine wave |
wave_triangle | 1 | Triangle wave (linear up/down) |
wave_sawtooth | 2 | Sawtooth wave (linear up, instant reset) |
wave_square | 3 | Square wave (on/off pulse) |
oscillate¶
IM_ANIM_API float oscillate(ImGuiID id, float amplitude, float frequency, int wave_type, float phase, float dt);Returns oscillating value [-amplitude, +amplitude].
oscillate_int¶
IM_ANIM_API int oscillate_int(ImGuiID id, int amplitude, float frequency, int wave_type, float phase, float dt);Returns oscillating integer value [-amplitude, +amplitude].
oscillate_vec2¶
IM_ANIM_API ImVec2 oscillate_vec2(ImGuiID id, ImVec2 amplitude, ImVec2 frequency, int wave_type, ImVec2 phase, float dt);2D oscillation.
oscillate_vec4¶
IM_ANIM_API ImVec4 oscillate_vec4(ImGuiID id, ImVec4 amplitude, ImVec4 frequency, int wave_type, ImVec4 phase, float dt);4D oscillation.
oscillate_color¶
IM_ANIM_API ImVec4 oscillate_color(ImGuiID id, ImVec4 base_color, ImVec4 amplitude, float frequency, int wave_type, float phase, int color_space, float dt);Color oscillation in specified color space.
Shake/Wiggle - procedural noise animations¶
shake¶
IM_ANIM_API float shake(ImGuiID id, float intensity, float frequency, float decay_time, float dt);Decaying random shake. Returns offset that decays to 0.
shake_int¶
IM_ANIM_API int shake_int(ImGuiID id, int intensity, float frequency, float decay_time, float dt);Decaying random shake for integers.
shake_vec2¶
IM_ANIM_API ImVec2 shake_vec2(ImGuiID id, ImVec2 intensity, float frequency, float decay_time, float dt);2D decaying shake.
shake_vec4¶
IM_ANIM_API ImVec4 shake_vec4(ImGuiID id, ImVec4 intensity, float frequency, float decay_time, float dt);4D decaying shake.
shake_color¶
IM_ANIM_API ImVec4 shake_color(ImGuiID id, ImVec4 base_color, ImVec4 intensity, float frequency, float decay_time, int color_space, float dt);Color shake in specified color space.
wiggle¶
IM_ANIM_API float wiggle(ImGuiID id, float amplitude, float frequency, float dt);Continuous smooth random movement.
wiggle_int¶
IM_ANIM_API int wiggle_int(ImGuiID id, int amplitude, float frequency, float dt);Continuous smooth random movement for integers.
wiggle_vec2¶
IM_ANIM_API ImVec2 wiggle_vec2(ImGuiID id, ImVec2 amplitude, float frequency, float dt);2D continuous wiggle.
wiggle_vec4¶
IM_ANIM_API ImVec4 wiggle_vec4(ImGuiID id, ImVec4 amplitude, float frequency, float dt);4D continuous wiggle.
wiggle_color¶
IM_ANIM_API ImVec4 wiggle_color(ImGuiID id, ImVec4 base_color, ImVec4 amplitude, float frequency, int color_space, float dt);Color wiggle in specified color space.
trigger_shake¶
IM_ANIM_API void trigger_shake(ImGuiID id);Trigger/restart a shake animation.
Easing evaluation¶
eval_preset¶
IM_ANIM_API float eval_preset(int type, float t);Evaluate a preset easing function at time t (0-1).
Tween API - smoothly interpolate values over time¶
init_value: Initial value when channel is first created. Defaults to 0 (or white for color).
Use this to avoid unwanted animations when the first target differs from the default.
tween_float¶
IM_ANIM_API float tween_float(ImGuiID id, ImGuiID channel_id, float target, float dur, ease_desc const& ez, int policy, float dt, float init_value = 0.0f);Animate a float value.
tween_vec2¶
IM_ANIM_API ImVec2 tween_vec2(ImGuiID id, ImGuiID channel_id, ImVec2 target, float dur, ease_desc const& ez, int policy, float dt, ImVec2 init_value = ImVec2(0, 0));Animate a 2D vector.
tween_vec4¶
IM_ANIM_API ImVec4 tween_vec4(ImGuiID id, ImGuiID channel_id, ImVec4 target, float dur, ease_desc const& ez, int policy, float dt, ImVec4 init_value = ImVec4(0, 0, 0, 0));Animate a 4D vector.
tween_int¶
IM_ANIM_API int tween_int(ImGuiID id, ImGuiID channel_id, int target, float dur, ease_desc const& ez, int policy, float dt, int init_value = 0);Animate an integer value.
tween_color¶
IM_ANIM_API ImVec4 tween_color(ImGuiID id, ImGuiID channel_id, ImVec4 target_srgb, float dur, ease_desc const& ez, int policy, int color_space, float dt, ImVec4 init_value = ImVec4(1, 1, 1, 1));Animate a color in specified color space.
Resize-friendly helpers¶
anchor_size¶
IM_ANIM_API ImVec2 anchor_size(int space);Get dimensions of anchor space (window, viewport, etc.).
tween_float_rel¶
IM_ANIM_API float tween_float_rel(ImGuiID id, ImGuiID channel_id, float percent, float px_bias, float dur, ease_desc const& ez, int policy, int anchor_space, int axis, float dt);Float relative to anchor (axis: 0=x, 1=y).
Relative target tweens (percent of anchor + pixel offset) - survive window resizes
tween_vec2_rel¶
IM_ANIM_API ImVec2 tween_vec2_rel(ImGuiID id, ImGuiID channel_id, ImVec2 percent, ImVec2 px_bias, float dur, ease_desc const& ez, int policy, int anchor_space, float dt);Vec2 relative to anchor.
tween_vec4_rel¶
IM_ANIM_API ImVec4 tween_vec4_rel(ImGuiID id, ImGuiID channel_id, ImVec4 percent, ImVec4 px_bias, float dur, ease_desc const& ez, int policy, int anchor_space, float dt);Vec4 with x,y relative to anchor.
tween_color_rel¶
IM_ANIM_API ImVec4 tween_color_rel(ImGuiID id, ImGuiID channel_id, ImVec4 percent, ImVec4 px_bias, float dur, ease_desc const& ez, int policy, int color_space, int anchor_space, float dt);Color with component offsets.
Resolver callbacks for dynamic target computation¶
Resolved tweens - target computed dynamically by callback each frame
tween_float_resolved¶
IM_ANIM_API float tween_float_resolved(ImGuiID id, ImGuiID channel_id, float_resolver fn, float dur, ease_desc const& ez, int policy, float dt);Float with dynamic target.
tween_vec2_resolved¶
IM_ANIM_API ImVec2 tween_vec2_resolved(ImGuiID id, ImGuiID channel_id, vec2_resolver fn, float dur, ease_desc const& ez, int policy, float dt);Vec2 with dynamic target.
tween_vec4_resolved¶
IM_ANIM_API ImVec4 tween_vec4_resolved(ImGuiID id, ImGuiID channel_id, vec4_resolver fn, float dur, ease_desc const& ez, int policy, float dt);Vec4 with dynamic target.
tween_color_resolved¶
IM_ANIM_API ImVec4 tween_color_resolved(ImGuiID id, ImGuiID channel_id, color_resolver fn, float dur, ease_desc const& ez, int policy, int color_space, float dt);Color with dynamic target.
tween_int_resolved¶
IM_ANIM_API int tween_int_resolved(ImGuiID id, ImGuiID channel_id, int_resolver fn, float dur, ease_desc const& ez, int policy, float dt);Int with dynamic target.
rebase_float¶
IM_ANIM_API void rebase_float(ImGuiID id, ImGuiID channel_id, float new_target, float dt);Smoothly redirect float animation to new target.
Rebase functions - change target of in-progress animation without restarting
rebase_vec2¶
IM_ANIM_API void rebase_vec2(ImGuiID id, ImGuiID channel_id, ImVec2 new_target, float dt);Smoothly redirect vec2 animation to new target.
rebase_vec4¶
IM_ANIM_API void rebase_vec4(ImGuiID id, ImGuiID channel_id, ImVec4 new_target, float dt);Smoothly redirect vec4 animation to new target.
rebase_color¶
IM_ANIM_API void rebase_color(ImGuiID id, ImGuiID channel_id, ImVec4 new_target, float dt);Smoothly redirect color animation to new target.
rebase_int¶
IM_ANIM_API void rebase_int(ImGuiID id, ImGuiID channel_id, int new_target, float dt);Smoothly redirect int animation to new target.
Color blending utility¶
get_blended_color¶
IM_ANIM_API ImVec4 get_blended_color(ImVec4 a_srgb, ImVec4 b_srgb, float t, int color_space);Blend two sRGB colors in specified color space.
Convenience shorthands for common easings¶
ease_preset¶
inline ease_desc ease_preset(int type);Create descriptor from preset enum.
ease_bezier¶
inline ease_desc ease_bezier(float x1, float y1, float x2, float y2);Create cubic bezier easing.
ease_steps_desc¶
inline ease_desc ease_steps_desc(int steps, int mode);Create step function easing.
ease_back¶
inline ease_desc ease_back(float overshoot);Create back easing with overshoot.
ease_elastic¶
inline ease_desc ease_elastic(float amplitude, float period);Create elastic easing.
ease_spring_desc¶
inline ease_desc ease_spring_desc(float mass, float stiffness, float damping, float v0);Create physics spring.
ease_custom_fn¶
inline ease_desc ease_custom_fn(int slot);Use registered custom easing (slot 0-15).
Scroll animation - smooth scrolling for ImGui windows¶
scroll_to_y¶
IM_ANIM_API void scroll_to_y(float target_y, float duration, ease_desc const& ez = ease_preset(ease_out_cubic));Scroll current window to Y position.
scroll_to_x¶
IM_ANIM_API void scroll_to_x(float target_x, float duration, ease_desc const& ez = ease_preset(ease_out_cubic));Scroll current window to X position.
scroll_to_top¶
IM_ANIM_API void scroll_to_top(float duration = 0.3f, ease_desc const& ez = ease_preset(ease_out_cubic));Scroll to top of window.
scroll_to_bottom¶
IM_ANIM_API void scroll_to_bottom(float duration = 0.3f, ease_desc const& ez = ease_preset(ease_out_cubic));Scroll to bottom of window.
Per-axis easing - different easing per component¶
ease_per_axis (struct)¶
struct ease_per_axisPer-axis easing descriptor (for vec2/vec4/color)
| Member | |
|---|---|
ease_desc x; | Easing for X component |
ease_desc y; | Easing for Y component |
ease_desc z; | Easing for Z component (vec4/color only) |
ease_desc w; | Easing for W/alpha component (vec4/color only) |
ease_per_axis::ease_per_axis¶
ease_per_axis()ease_per_axis(ease_desc all)ease_per_axis(ease_desc ex, ease_desc ey)ease_per_axis(ease_desc ex, ease_desc ey, ease_desc ez, ease_desc ew) : x(ease_preset(ease_linear)), y(ease_preset(ease_linear)),tween_vec2_per_axis¶
IM_ANIM_API ImVec2 tween_vec2_per_axis(ImGuiID id, ImGuiID channel_id, ImVec2 target, float dur, ease_per_axis const& ez, int policy, float dt);Tween with per-axis easing - each component uses its own easing curve
tween_vec4_per_axis¶
IM_ANIM_API ImVec4 tween_vec4_per_axis(ImGuiID id, ImGuiID channel_id, ImVec4 target, float dur, ease_per_axis const& ez, int policy, float dt);tween_color_per_axis¶
IM_ANIM_API ImVec4 tween_color_per_axis(ImGuiID id, ImGuiID channel_id, ImVec4 target_srgb, float dur, ease_per_axis const& ez, int policy, int color_space, float dt);Motion Paths - animate along curves and splines¶
path_segment_type (enum)¶
enum path_segment_typePath segment types
| Member | Value | |
|---|---|---|
seg_line = 0 | 0 | Linear segment to endpoint |
seg_quadratic_bezier | 1 | Quadratic bezier (1 control point) |
seg_cubic_bezier | 2 | Cubic bezier (2 control points) |
seg_catmull_rom | 3 | Catmull-rom spline segment |
bezier_quadratic¶
IM_ANIM_API ImVec2 bezier_quadratic(ImVec2 p0, ImVec2 p1, ImVec2 p2, float t);Evaluate quadratic bezier at t [0,1].
Single-curve evaluation functions (stateless, for direct use)
bezier_cubic¶
IM_ANIM_API ImVec2 bezier_cubic(ImVec2 p0, ImVec2 p1, ImVec2 p2, ImVec2 p3, float t);Evaluate cubic bezier at t [0,1].
catmull_rom¶
IM_ANIM_API ImVec2 catmull_rom(ImVec2 p0, ImVec2 p1, ImVec2 p2, ImVec2 p3, float t, float tension = 0.5f);Evaluate Catmull-Rom spline at t [0,1]. Points go through p1 and p2.
Derivatives (for tangent/velocity)¶
bezier_quadratic_deriv¶
IM_ANIM_API ImVec2 bezier_quadratic_deriv(ImVec2 p0, ImVec2 p1, ImVec2 p2, float t);Derivative of quadratic bezier.
bezier_cubic_deriv¶
IM_ANIM_API ImVec2 bezier_cubic_deriv(ImVec2 p0, ImVec2 p1, ImVec2 p2, ImVec2 p3, float t);Derivative of cubic bezier.
catmull_rom_deriv¶
IM_ANIM_API ImVec2 catmull_rom_deriv(ImVec2 p0, ImVec2 p1, ImVec2 p2, ImVec2 p3, float t, float tension = 0.5f);Derivative of Catmull-Rom.
path (struct)¶
class pathpath - fluent API for building multi-segment motion paths
path::begin¶
static path begin(ImGuiID path_id, ImVec2 start);Start building a path at position.
path::line_to¶
path& line_to(ImVec2 end);Add linear segment to endpoint.
path::quadratic_to¶
path& quadratic_to(ImVec2 ctrl, ImVec2 end);Add quadratic bezier segment.
path::cubic_to¶
path& cubic_to(ImVec2 ctrl1, ImVec2 ctrl2, ImVec2 end);Add cubic bezier segment.
path::catmull_to¶
path& catmull_to(ImVec2 end, float tension = 0.5f);Add Catmull-Rom segment to endpoint.
path::close¶
path& close();Close path back to start point.
path::end¶
void end();Finalize and register path.
path::id¶
ImGuiID id() const;Query path info¶
path_exists¶
IM_ANIM_API bool path_exists(ImGuiID path_id);Check if path exists.
path_length¶
IM_ANIM_API float path_length(ImGuiID path_id);Get approximate path length.
path_evaluate¶
IM_ANIM_API ImVec2 path_evaluate(ImGuiID path_id, float t);Sample path at t [0,1].
path_tangent¶
IM_ANIM_API ImVec2 path_tangent(ImGuiID path_id, float t);Get tangent (normalized direction) at t.
path_angle¶
IM_ANIM_API float path_angle(ImGuiID path_id, float t);Get rotation angle (radians) at t.
Tween along a path¶
tween_path¶
IM_ANIM_API ImVec2 tween_path(ImGuiID id, ImGuiID channel_id, ImGuiID path_id, float dur, ease_desc const& ez, int policy, float dt);Animate position along path.
tween_path_angle¶
IM_ANIM_API float tween_path_angle(ImGuiID id, ImGuiID channel_id, ImGuiID path_id, float dur, ease_desc const& ez, int policy, float dt);Animate rotation angle along path.
Arc-length parameterization¶
path_build_arc_lut¶
IM_ANIM_API void path_build_arc_lut(ImGuiID path_id, int subdivisions = 64);Build LUT with specified resolution.
Build arc-length lookup table for a path (call once per path, improves accuracy)
path_has_arc_lut¶
IM_ANIM_API bool path_has_arc_lut(ImGuiID path_id);Check if path has precomputed LUT.
path_distance_to_t¶
IM_ANIM_API float path_distance_to_t(ImGuiID path_id, float distance);Convert arc-length distance to t parameter.
Distance-based path evaluation (uses arc-length LUT for constant speed)
path_evaluate_at_distance¶
IM_ANIM_API ImVec2 path_evaluate_at_distance(ImGuiID path_id, float distance);Get position at arc-length distance.
path_angle_at_distance¶
IM_ANIM_API float path_angle_at_distance(ImGuiID path_id, float distance);Get rotation angle at arc-length distance.
path_tangent_at_distance¶
IM_ANIM_API ImVec2 path_tangent_at_distance(ImGuiID path_id, float distance);Get tangent at arc-length distance.
Path Morphing - interpolate between two paths¶
morph_opts (struct)¶
struct morph_optsMorph options for path interpolation
| Member | |
|---|---|
int samples; | Number of sample points for resampling (default: 64) |
bool match_endpoints; | Force endpoints to match exactly (default: True) |
bool use_arc_length; | Use arc-length parameterization for smoother morphing (default: True) |
morph_opts::morph_opts¶
morph_opts() : samples(64), match_endpoints(true), use_arc_length(true);path_morph¶
IM_ANIM_API ImVec2 path_morph(ImGuiID path_a, ImGuiID path_b, float t, float blend, morph_opts const& opts = morph_opts());Evaluate morphed path at parameter t [0,1] with blend factor [0,1]
path_a at blend=0, path_b at blend=1
Paths can have different numbers of segments - they are resampled to match
path_morph_tangent¶
IM_ANIM_API ImVec2 path_morph_tangent(ImGuiID path_a, ImGuiID path_b, float t, float blend, morph_opts const& opts = morph_opts());Get tangent of morphed path
path_morph_angle¶
IM_ANIM_API float path_morph_angle(ImGuiID path_a, ImGuiID path_b, float t, float blend, morph_opts const& opts = morph_opts());Get angle (radians) of morphed path
tween_path_morph¶
IM_ANIM_API ImVec2 tween_path_morph(ImGuiID id, ImGuiID channel_id, ImGuiID path_a, ImGuiID path_b, float target_blend, float dur, ease_desc const& path_ease, ease_desc const& morph_ease, int policy, float dt, morph_opts const& opts = morph_opts());Tween along a morphing path - animates both position along path AND the morph blend
get_morph_blend¶
IM_ANIM_API float get_morph_blend(ImGuiID id, ImGuiID channel_id);Get current morph blend value from a tween (for querying state)
Text along motion paths¶
text_path_align (enum)¶
enum text_path_alignText alignment along path
| Member | Value | |
|---|---|---|
text_align_start = 0 | 0 | Text starts at path start (or offset) |
text_align_center | 1 | Text centered on path |
text_align_end | 2 | Text ends at path end |
text_path_opts (struct)¶
struct text_path_optsText path options
| Member | |
|---|---|
ImVec2 origin; | Screen-space origin for rendering (path coords are offset by this) |
float offset; | Starting offset along path (pixels) |
float letter_spacing; | Extra spacing between characters (pixels) |
int align; | text_path_align value |
bool flip_y; | Flip text vertically (for paths going right-to-left) |
ImU32 color; | Text color (default: white) |
ImFont* font; | Font to use (None = current font) |
float font_scale; | Additional font scale (1.0 = normal) |
text_path_opts::text_path_opts¶
text_path_opts() : origin(0, 0), offset(0), letter_spacing(0), align(text_align_start), flip_y(false), color(IM_COL32_WHITE), font(nullptr), font_scale(1.0f);text_path¶
IM_ANIM_API void text_path(ImGuiID path_id, const char* text, text_path_opts const& opts = text_path_opts());Render text along a path (static - no animation)
text_path_animated¶
IM_ANIM_API void text_path_animated(ImGuiID path_id, const char* text, float progress, text_path_opts const& opts = text_path_opts());Animated text along path (characters appear progressively)
text_path_width¶
IM_ANIM_API float text_path_width(const char* text, text_path_opts const& opts = text_path_opts());Helper: Get text width for path layout calculations
Quad transform helpers¶
transform_quad¶
IM_ANIM_API void transform_quad(ImVec2* quad, ImVec2 center, float angle_rad, ImVec2 translation);Transform a quad (4 vertices) by rotation and translation
make_glyph_quad¶
IM_ANIM_API void make_glyph_quad(ImVec2* quad, ImVec2 pos, float angle_rad, float glyph_width, float glyph_height, float baseline_offset = 0.0f);Create a rotated quad for a glyph at a position on the path
Text Stagger - per-character animation effects¶
text_stagger_effect (enum)¶
enum text_stagger_effectText stagger effect types
| Member | Value | |
|---|---|---|
text_fx_none = 0 | 0 | No effect (instant appear) |
text_fx_fade | 1 | Fade in alpha |
text_fx_scale | 2 | Scale from center |
text_fx_slide_up | 3 | Slide up from below |
text_fx_slide_down | 4 | Slide down from above |
text_fx_slide_left | 5 | Slide in from right |
text_fx_slide_right | 6 | Slide in from left |
text_fx_rotate | 7 | Rotate in |
text_fx_bounce | 8 | Bounce in with overshoot |
text_fx_wave | 9 | Wave motion (continuous) |
text_fx_typewriter | 10 | Typewriter style (instant per char) |
text_stagger_opts (struct)¶
struct text_stagger_optsText stagger options
| Member | |
|---|---|
ImVec2 pos; | Base position for text |
int effect; | text_stagger_effect |
float char_delay; | Delay between each character (seconds) |
float char_duration; | Duration of each character’s animation (seconds) |
float effect_intensity; | Intensity of effect (pixels for slide, degrees for rotate, scale factor) |
ease_desc ease; | Easing for character animation |
ImU32 color; | Text color |
ImFont* font; | Font to use (None = current) |
float font_scale; | Font scale multiplier |
float letter_spacing; | Extra spacing between characters |
text_stagger_opts::text_stagger_opts¶
text_stagger_opts() : pos(0, 0), effect(text_fx_fade), char_delay(0.05f), char_duration(0.3f),
effect_intensity(20.0f), ease(ease_preset(ease_out_cubic)), color(IM_COL32_WHITE), font(nullptr), font_scale(1.0f), letter_spacing(0.0f);text_stagger¶
IM_ANIM_API void text_stagger(ImGuiID id, const char* text, float progress, text_stagger_opts const& opts = text_stagger_opts());Render text with per-character stagger animation
text_stagger_width¶
IM_ANIM_API float text_stagger_width(const char* text, text_stagger_opts const& opts = text_stagger_opts());Get text width for layout calculations
text_stagger_duration¶
IM_ANIM_API float text_stagger_duration(const char* text, text_stagger_opts const& opts = text_stagger_opts());Get total animation duration for text (accounts for stagger delays)
Noise Channels - Perlin/Simplex noise for organic movement¶
noise_type (enum)¶
enum noise_typeNoise types
| Member | Value | |
|---|---|---|
noise_perlin = 0 | 0 | Classic Perlin noise |
noise_simplex | 1 | Simplex noise (faster, fewer artifacts) |
noise_value | 2 | Value noise (blocky) |
noise_worley | 3 | Worley/cellular noise |
noise_opts (struct)¶
struct noise_optsNoise options
| Member | |
|---|---|
int type; | noise_type |
int octaves; | Number of octaves for fractal noise (1-8) |
float persistence; | Amplitude multiplier per octave (0.0-1.0) |
float lacunarity; | Frequency multiplier per octave (typically 2.0) |
int seed; | Random seed for noise generation |
noise_opts::noise_opts¶
noise_opts() : type(noise_perlin), octaves(4), persistence(0.5f), lacunarity(2.0f), seed(0);noise_2d¶
IM_ANIM_API float noise_2d(float x, float y, noise_opts const& opts = noise_opts());2D noise
Sample noise at a point (returns value in [-1, 1])
noise_3d¶
IM_ANIM_API float noise_3d(float x, float y, float z, noise_opts const& opts = noise_opts());3D noise
noise_channel_float¶
IM_ANIM_API float noise_channel_float(ImGuiID id, float frequency, float amplitude, noise_opts const& opts, float dt);1D animated noise
Animated noise channels - continuous noise that evolves over time
noise_channel_vec2¶
IM_ANIM_API ImVec2 noise_channel_vec2(ImGuiID id, ImVec2 frequency, ImVec2 amplitude, noise_opts const& opts, float dt);2D animated noise
noise_channel_vec4¶
IM_ANIM_API ImVec4 noise_channel_vec4(ImGuiID id, ImVec4 frequency, ImVec4 amplitude, noise_opts const& opts, float dt);4D animated noise
noise_channel_color¶
IM_ANIM_API ImVec4 noise_channel_color(ImGuiID id, ImVec4 base_color, ImVec4 amplitude, float frequency, noise_opts const& opts, int color_space, float dt);Animated color noise in specified color space
Convenience: smooth random movement¶
(like wiggle but using noise)
smooth_noise_float¶
IM_ANIM_API float smooth_noise_float(ImGuiID id, float amplitude, float speed, float dt);Simple 1D smooth noise
smooth_noise_vec2¶
IM_ANIM_API ImVec2 smooth_noise_vec2(ImGuiID id, ImVec2 amplitude, float speed, float dt);Simple 2D smooth noise
smooth_noise_vec4¶
IM_ANIM_API ImVec4 smooth_noise_vec4(ImGuiID id, ImVec4 amplitude, float speed, float dt);Simple 4D smooth noise
smooth_noise_color¶
IM_ANIM_API ImVec4 smooth_noise_color(ImGuiID id, ImVec4 base_color, ImVec4 amplitude, float speed, int color_space, float dt);Smooth noise for colors in specified color space
Style Interpolation - animate between ImGuiStyle themes¶
Register a named style for interpolation¶
style_register¶
IM_ANIM_API void style_register(ImGuiID style_id, ImGuiStyle const& style);Register a style snapshot
style_register_current¶
IM_ANIM_API void style_register_current(ImGuiID style_id);Register current ImGui style
style_blend¶
IM_ANIM_API void style_blend(ImGuiID style_a, ImGuiID style_b, float t, int color_space = color_space::col_oklab);Blend between two registered styles (result applied to ImGui::GetStyle())
Uses color_space for color blending mode (col_oklab recommended)
style_tween¶
IM_ANIM_API void style_tween(ImGuiID id, ImGuiID target_style, float duration, ease_desc const& ease, int color_space, float dt);Tween between styles over time
style_blend_to¶
IM_ANIM_API void style_blend_to(ImGuiID style_a, ImGuiID style_b, float t, ImGuiStyle* out_style, int color_space = color_space::col_oklab);Get interpolated style without applying
style_exists¶
IM_ANIM_API bool style_exists(ImGuiID style_id);Check if a style is registered
style_unregister¶
IM_ANIM_API void style_unregister(ImGuiID style_id);Remove a registered style
Gradient Interpolation - animate between color gradients¶
gradient (struct)¶
struct gradientColor gradient with any number of stops (sorted by position)
| Member | |
|---|---|
ImVector<float> positions; | Positions along gradient [0,1], kept sorted |
ImVector<ImVec4> colors; | Colors at each position (sRGB) |
gradient::gradient¶
gradient();gradient::add¶
gradient& add(float position, ImVec4 color);gradient& add(float position, ImU32 color);Add a stop to the gradient (automatically sorted by position)
gradient::stop_count¶
int stop_count() const;Get stop count
gradient::sample¶
ImVec4 sample(float t, int color_space = color_space::col_oklab) const;Sample the gradient at position t [0,1]
gradient::solid¶
static gradient solid(ImVec4 color);gradient::two_color¶
static gradient two_color(ImVec4 start, ImVec4 end);gradient::three_color¶
static gradient three_color(ImVec4 start, ImVec4 mid, ImVec4 end);gradient_lerp¶
IM_ANIM_API gradient gradient_lerp(gradient const& a, gradient const& b, float t, int color_space = color_space::col_oklab);Blend between two gradients
tween_gradient¶
IM_ANIM_API gradient tween_gradient(ImGuiID id, ImGuiID channel_id, gradient const& target, float dur, ease_desc const& ez, int policy, int color_space, float dt);Tween between gradients over time
Transform Interpolation - animate 2D transforms¶
rotation_mode (enum)¶
enum rotation_modeRotation interpolation modes
| Member | Value | |
|---|---|---|
rotation_shortest = 0 | 0 | Shortest path (default) - never rotates more than 180 degrees |
rotation_longest | 1 | Longest path - always takes the long way around |
rotation_cw | 2 | Clockwise - always rotates clockwise (positive direction) |
rotation_ccw | 3 | Counter-clockwise - always rotates counter-clockwise |
rotation_direct | 4 | Direct lerp - no angle unwrapping, can cause spinning for large deltas |
transform (struct)¶
struct transform2D transform (position, rotation, scale)
| Member | |
|---|---|
ImVec2 position; | Translation |
ImVec2 scale; | Scale (1,1 = identity) |
float rotation; | Rotation in radians |
transform::transform¶
transform() : position(0, 0), scale(1, 1), rotation(0);transform(ImVec2 pos, float rot = 0, ImVec2 scl = ImVec2(1, 1))transform::identity¶
static transform identity();Create identity transform
transform::apply¶
ImVec2 apply(ImVec2 point) const;Apply transform to a point
transform::inverse¶
transform inverse() const;Get inverse transform
transform_lerp¶
IM_ANIM_API transform transform_lerp(transform const& a, transform const& b, float t, int rotation_mode = rotation_mode::rotation_shortest);Blend between two transforms with rotation interpolation
tween_transform¶
IM_ANIM_API transform tween_transform(ImGuiID id, ImGuiID channel_id, transform const& target, float dur, ease_desc const& ez, int policy, int rotation_mode, float dt);Tween between transforms over time
transform_from_matrix¶
IM_ANIM_API transform transform_from_matrix(float m00, float m01, float m10, float m11, float tx, float ty);Decompose a 3x2 matrix into transform components
CLIP-BASED ANIMATION SYSTEM¶
direction (enum)¶
enum directionDirection for looping animations
| Member | Value | |
|---|---|---|
dir_normal = 0 | 0 | play forward |
dir_reverse | 1 | play backward |
dir_alternate | 2 | ping-pong |
channel_type (enum)¶
enum channel_typeChannel types for keyframes
| Member | Value | |
|---|---|---|
chan_float = 0 | 0 | |
chan_vec2 | 1 | |
chan_vec4 | 2 | |
chan_int | 3 | |
chan_color | 4 | Color with color space (stores in vec4 + color_space metadata) |
chan_float_rel | 5 | Float relative to anchor (percent + px_bias) |
chan_vec2_rel | 6 | Vec2 relative to anchor (percent.xy + px_bias.xy) |
chan_vec4_rel | 7 | Vec4 relative to anchor (percent.xy + px_bias.xy for x,y; z,w absolute) |
chan_color_rel | 8 | Color relative to anchor (for position-based color effects) |
result (enum)¶
enum resultResult codes
| Member | Value | |
|---|---|---|
ok = 0 | 0 | |
err_not_found | 1 | |
err_bad_arg | 2 | |
err_no_mem | 3 |
spring_params (struct)¶
struct spring_paramsSpring parameters for physics-based animation
| Member | |
|---|---|
float mass; | |
float stiffness; | |
float damping; | |
float initial_velocity; |
Repeat with Variation - per-loop parameter changes¶
variation_mode (enum)¶
enum variation_modeVariation modes for repeat animations
| Member | Value | |
|---|---|---|
var_none = 0 | 0 | No variation |
var_increment | 1 | Add amount each iteration |
var_decrement | 2 | Subtract amount each iteration |
var_multiply | 3 | Multiply by factor each iteration |
var_random | 4 | Random in range [-amount, +amount] |
var_random_abs | 5 | Random in range [0, amount] |
var_pingpong | 6 | Alternate +/- each iteration |
var_callback | 7 | Use custom callback |
Callback types for custom variation logic¶
variation_float (struct)¶
struct variation_floatFloat variation
| Member | |
|---|---|
int mode; | |
float amount; | |
float min_clamp; | |
float max_clamp; | |
unsigned int seed; | 0 = global random, non-zero = deterministic |
variation_float_fn callback; | |
void* user; |
variation_int (struct)¶
struct variation_intInt variation
| Member | |
|---|---|
int mode; | |
int amount; | |
int min_clamp; | |
int max_clamp; | |
unsigned int seed; | |
variation_int_fn callback; | |
void* user; |
variation_vec2 (struct)¶
struct variation_vec2Vec2 variation (global mode or per-axis)
| Member | |
|---|---|
int mode; | Global mode (var_none = use per-axis) |
ImVec2 amount; | |
ImVec2 min_clamp; | |
ImVec2 max_clamp; | |
unsigned int seed; | |
variation_vec2_fn callback; | |
void* user; | |
variation_float x, | Per-axis (used when mode == var_none) |
y; | Per-axis (used when mode == var_none) |
variation_vec4 (struct)¶
struct variation_vec4Vec4 variation (global mode or per-axis)
| Member | |
|---|---|
int mode; | |
ImVec4 amount; | |
ImVec4 min_clamp; | |
ImVec4 max_clamp; | |
unsigned int seed; | |
variation_vec4_fn callback; | |
void* user; | |
variation_float x, | Per-axis |
y, | Per-axis |
z, | Per-axis |
w; | Per-axis |
variation_color (struct)¶
struct variation_colorColor variation (global mode or per-channel)
| Member | |
|---|---|
int mode; | |
ImVec4 amount; | |
ImVec4 min_clamp; | |
ImVec4 max_clamp; | |
int color_space; | col_oklab, etc. |
unsigned int seed; | |
variation_vec4_fn callback; | Returns ImVec4 color delta |
void* user; | |
variation_float r, | Per-channel |
g, | Per-channel |
b, | Per-channel |
a; | Per-channel |
Variation helper functions¶
Float variation helpers¶
varf_none¶
static inline variation_float varf_none(void);varf_inc¶
static inline variation_float varf_inc(float amt);varf_dec¶
static inline variation_float varf_dec(float amt);varf_mul¶
static inline variation_float varf_mul(float f);varf_rand¶
static inline variation_float varf_rand(float r);varf_rand_abs¶
static inline variation_float varf_rand_abs(float r);varf_pingpong¶
static inline variation_float varf_pingpong(float amt);varf_fn¶
static inline variation_float varf_fn(variation_float_fn fn, void* user);varf_clamp¶
static inline variation_float varf_clamp(variation_float v, float mn, float mx);varf_seed¶
static inline variation_float varf_seed(variation_float v, unsigned int s);Int variation helpers¶
vari_none¶
static inline variation_int vari_none(void);vari_inc¶
static inline variation_int vari_inc(int amt);vari_dec¶
static inline variation_int vari_dec(int amt);vari_rand¶
static inline variation_int vari_rand(int r);vari_fn¶
static inline variation_int vari_fn(variation_int_fn fn, void* user);vari_clamp¶
static inline variation_int vari_clamp(variation_int v, int mn, int mx);vari_seed¶
static inline variation_int vari_seed(variation_int v, unsigned int s);Vec2 variation helpers (global)¶
varv2_none¶
static inline variation_vec2 varv2_none(void);varv2_inc¶
static inline variation_vec2 varv2_inc(float x, float y);varv2_dec¶
static inline variation_vec2 varv2_dec(float x, float y);varv2_mul¶
static inline variation_vec2 varv2_mul(float f);varv2_rand¶
static inline variation_vec2 varv2_rand(float x, float y);varv2_fn¶
static inline variation_vec2 varv2_fn(variation_vec2_fn fn, void* user);Vec2 per-axis helper¶
varv2_axis¶
static inline variation_vec2 varv2_axis(variation_float vx, variation_float vy);varv2_clamp¶
static inline variation_vec2 varv2_clamp(variation_vec2 v, ImVec2 mn, ImVec2 mx);varv2_seed¶
static inline variation_vec2 varv2_seed(variation_vec2 v, unsigned int s);Vec4 variation helpers (global)¶
varv4_none¶
static inline variation_vec4 varv4_none(void);varv4_inc¶
static inline variation_vec4 varv4_inc(float x, float y, float z, float w);varv4_dec¶
static inline variation_vec4 varv4_dec(float x, float y, float z, float w);varv4_mul¶
static inline variation_vec4 varv4_mul(float f);varv4_rand¶
static inline variation_vec4 varv4_rand(float x, float y, float z, float w);varv4_fn¶
static inline variation_vec4 varv4_fn(variation_vec4_fn fn, void* user);Vec4 per-axis helper¶
varv4_axis¶
static inline variation_vec4 varv4_axis(variation_float vx, variation_float vy, variation_float vz, variation_float vw);varv4_clamp¶
static inline variation_vec4 varv4_clamp(variation_vec4 v, ImVec4 mn, ImVec4 mx);varv4_seed¶
static inline variation_vec4 varv4_seed(variation_vec4 v, unsigned int s);Color variation helpers (global)¶
varc_none¶
static inline variation_color varc_none(void);varc_inc¶
static inline variation_color varc_inc(float r, float g, float b, float a);varc_dec¶
static inline variation_color varc_dec(float r, float g, float b, float a);varc_mul¶
static inline variation_color varc_mul(float f);varc_rand¶
static inline variation_color varc_rand(float r, float g, float b, float a);varc_fn¶
static inline variation_color varc_fn(variation_vec4_fn fn, void* user);Color per-channel helper¶
varc_channel¶
static inline variation_color varc_channel(variation_float vr, variation_float vg, variation_float vb, variation_float va);varc_space¶
static inline variation_color varc_space(variation_color v, int space);varc_clamp¶
static inline variation_color varc_clamp(variation_color v, ImVec4 mn, ImVec4 mx);varc_seed¶
static inline variation_color varc_seed(variation_color v, unsigned int s);clip (struct)¶
class clipclip - fluent API for authoring animations
clip::begin¶
static clip begin(ImGuiID clip_id);Start building a new clip with the given ID
clip::key_float¶
clip& key_float(ImGuiID channel, float time, float value, int ease_type = ease_type::ease_linear, float const* bezier4 = nullptr);clip::key_vec2¶
clip& key_vec2(ImGuiID channel, float time, ImVec2 value, int ease_type = ease_type::ease_linear, float const* bezier4 = nullptr);clip::key_vec4¶
clip& key_vec4(ImGuiID channel, float time, ImVec4 value, int ease_type = ease_type::ease_linear, float const* bezier4 = nullptr);clip::key_int¶
clip& key_int(ImGuiID channel, float time, int value, int ease_type = ease_type::ease_linear);clip::key_color¶
clip& key_color(ImGuiID channel, float time, ImVec4 value, int color_space = color_space::col_oklab, int ease_type = ease_type::ease_linear, float const* bezier4 = nullptr);clip::key_float_var¶
clip& key_float_var(ImGuiID channel, float time, float value, variation_float const& var, int ease_type = ease_type::ease_linear, float const* bezier4 = nullptr);Keyframes with repeat variation (value changes per loop iteration)
clip::key_vec2_var¶
clip& key_vec2_var(ImGuiID channel, float time, ImVec2 value, variation_vec2 const& var, int ease_type = ease_type::ease_linear, float const* bezier4 = nullptr);clip::key_vec4_var¶
clip& key_vec4_var(ImGuiID channel, float time, ImVec4 value, variation_vec4 const& var, int ease_type = ease_type::ease_linear, float const* bezier4 = nullptr);clip::key_int_var¶
clip& key_int_var(ImGuiID channel, float time, int value, variation_int const& var, int ease_type = ease_type::ease_linear);clip::key_color_var¶
clip& key_color_var(ImGuiID channel, float time, ImVec4 value, variation_color const& var, int color_space = color_space::col_oklab, int ease_type = ease_type::ease_linear, float const* bezier4 = nullptr);clip::key_float_spring¶
clip& key_float_spring(ImGuiID channel, float time, float target, spring_params const& spring);Spring-based keyframe (float only)
clip::key_float_rel¶
clip& key_float_rel(ImGuiID channel, float time, float percent, float px_bias, int anchor_space, int axis, int ease_type = ease_type::ease_linear, float const* bezier4 = nullptr);Anchor-relative keyframes (values resolved relative to window/viewport at get time)
clip::key_vec2_rel¶
clip& key_vec2_rel(ImGuiID channel, float time, ImVec2 percent, ImVec2 px_bias, int anchor_space, int ease_type = ease_type::ease_linear, float const* bezier4 = nullptr);clip::key_vec4_rel¶
clip& key_vec4_rel(ImGuiID channel, float time, ImVec4 percent, ImVec4 px_bias, int anchor_space, int ease_type = ease_type::ease_linear, float const* bezier4 = nullptr);clip::key_color_rel¶
clip& key_color_rel(ImGuiID channel, float time, ImVec4 percent, ImVec4 px_bias, int color_space, int anchor_space, int ease_type = ease_type::ease_linear, float const* bezier4 = nullptr);clip::seq_begin¶
clip& seq_begin();Start sequential block (keyframes after seq_end start after this block)
clip::seq_end¶
clip& seq_end();clip::par_begin¶
clip& par_begin();Start parallel block (keyframes play at same time offset)
clip::par_end¶
clip& par_end();clip::marker¶
clip& marker(float time, ImGuiID marker_id, marker_callback cb, void* user = nullptr);clip& marker(float time, marker_callback cb, void* user = nullptr);Add marker at specific time.
Timeline markers - callbacks at specific times during playback
clip::set_loop¶
clip& set_loop(bool loop, int direction = direction::dir_normal, int loop_count = -1);clip::set_loop_delay¶
clip& set_loop_delay(float delay_seconds);Delay between loop iterations
clip::set_delay¶
clip& set_delay(float delay_seconds);clip::set_stagger¶
clip& set_stagger(int count, float each_delay, float from_center_bias = 0.0f);clip::set_stagger_ease¶
clip& set_stagger_ease(int ease_type);Ease the delay distribution (default: linear)
clip::set_duration_var¶
clip& set_duration_var(variation_float const& var);Vary clip duration per loop
clip::set_delay_var¶
clip& set_delay_var(variation_float const& var);Vary delay between loops
clip::set_timescale_var¶
clip& set_timescale_var(variation_float const& var);Vary playback speed per loop
clip::on_begin¶
clip& on_begin(clip_callback cb, void* user = nullptr);clip::on_update¶
clip& on_update(clip_callback cb, void* user = nullptr);clip::on_complete¶
clip& on_complete(clip_callback cb, void* user = nullptr);clip::on_loop¶
clip& on_loop(loop_callback cb, void* user = nullptr);Callback per loop iteration
clip::on_pause¶
clip& on_pause(clip_callback cb, void* user = nullptr);Callback when paused
clip::end¶
void end();Finalize the clip
clip::id¶
ImGuiID id() const;Get the clip ID
instance (struct)¶
class instanceinstance - playback control for a clip
instance::instance¶
instance() : m_inst_id(0);instance(ImGuiID inst_id) : m_inst_id(inst_id);instance::pause¶
void pause();instance::resume¶
void resume();instance::stop¶
void stop();instance::restart¶
void restart();Reset to t=0 and start playing (equivalent to stop + play on same clip)
instance::reset¶
void reset();Reset to t=0 and re-evaluate tracks, but do not start playing
instance::refresh¶
void refresh();Re-evaluate all tracks at the current time (re-read current values)
instance::destroy¶
void destroy();Remove instance from system (valid() will return False after this)
instance::seek¶
void seek(float time);instance::set_time_scale¶
void set_time_scale(float scale);instance::set_weight¶
void set_weight(float weight);for layering/blending
instance::then¶
instance& then(ImGuiID next_clip_id);instance& then(ImGuiID next_clip_id, ImGuiID next_instance_id);Chain another clip to play after this one.
Animation chaining - play another clip when this one completes
instance::then_delay¶
instance& then_delay(float delay);Set delay before chained clip starts.
instance::time¶
float time() const;instance::duration¶
float duration() const;instance::is_playing¶
bool is_playing() const;instance::is_paused¶
bool is_paused() const;instance::get_float¶
inline std::pair<bool, float> get_float(ImGuiID channel) const;instance::get_vec2¶
inline std::pair<bool, ImVec2> get_vec2(ImGuiID channel) const;instance::get_vec4¶
inline std::pair<bool, ImVec4> get_vec4(ImGuiID channel) const;instance::get_int¶
inline std::pair<bool, int> get_int(ImGuiID channel) const;instance::get_color¶
inline std::pair<bool, ImVec4> get_color(ImGuiID channel, int color_space = color_space::col_oklab) const;instance::valid¶
bool valid() const;Check validity
instance::id¶
ImGuiID id() const;Clip System API¶
Initialize/shutdown (optional - auto-init on first use)¶
clip_init¶
IM_ANIM_API void clip_init(int initial_clip_cap = 256, int initial_inst_cap = 4096);clip_shutdown¶
IM_ANIM_API void clip_shutdown();clip_update¶
IM_ANIM_API void clip_update(float dt);Per-frame update (call after update_begin_frame)
clip_gc¶
IM_ANIM_API void clip_gc(unsigned int max_age_frames = 600);Garbage collection for instances
play¶
IM_ANIM_API instance play(ImGuiID clip_id, ImGuiID instance_id);Play a clip on an instance (creates or reuses instance)
get_instance¶
IM_ANIM_API instance get_instance(ImGuiID instance_id);Get an existing instance (returns invalid instance if not found)
Query clip info¶
clip_duration¶
IM_ANIM_API float clip_duration(ImGuiID clip_id);Get clip duration in seconds.
clip_exists¶
IM_ANIM_API bool clip_exists(ImGuiID clip_id);Check if clip exists.
Stagger helpers - compute delay for indexed instances¶
stagger_delay¶
IM_ANIM_API float stagger_delay(ImGuiID clip_id, int index);Get stagger delay for element at index.
play_stagger¶
IM_ANIM_API instance play_stagger(ImGuiID clip_id, ImGuiID instance_id, int index);Play with stagger delay applied.
stagger_from (enum)¶
enum stagger_fromGrid stagger - 2D grid-based delay distribution
| Member | Value | |
|---|---|---|
stagger_first = 0 | 0 | Stagger from first element (index 0) |
stagger_last | 1 | Stagger from last element |
stagger_center | 2 | Stagger from center of grid |
stagger_index | 3 | Stagger from a specific index (use from_index) |
stagger_axis (enum)¶
enum stagger_axis| Member | Value | |
|---|---|---|
stagger_both = 0 | 0 | Distance on both axes |
stagger_x | 1 | Distance on X axis only (column) |
stagger_y | 2 | Distance on Y axis only (row) |
stagger_grid_opts (struct)¶
struct stagger_grid_opts| Member | |
|---|---|
int cols; | Number of columns |
int rows; | Number of rows |
int from; | stagger_from - origin for distance calculation |
int from_index; | Used when from == stagger_index |
int axis; | stagger_axis - constrain distance to an axis |
float delay; | Base delay between elements (seconds) |
int ease; | ease_type - easing applied to the delay distribution |
float start_delay; | Initial delay offset before first element (seconds) |
stagger_grid_opts::stagger_grid_opts¶
stagger_grid_opts() : cols(1), rows(1), from(stagger_first), from_index(0), axis(stagger_both), delay(0.05f), ease(ease_linear), start_delay(0);stagger_grid_delay¶
IM_ANIM_API float stagger_grid_delay(int col, int row, stagger_grid_opts const& opts);Get stagger delay for element at (col, row) in a grid
stagger_grid_delay_index¶
IM_ANIM_API float stagger_grid_delay_index(int index, stagger_grid_opts const& opts);Get stagger delay for a linear index in the grid (index = row * cols + col)
play_with_delay¶
IM_ANIM_API instance play_with_delay(ImGuiID clip_id, ImGuiID instance_id, float delay);Play a clip instance with a specific delay (useful with grid stagger)
Layering support - blend multiple animation instances¶
layer_begin¶
IM_ANIM_API void layer_begin(ImGuiID instance_id);Start blending into target instance.
layer_add¶
IM_ANIM_API void layer_add(instance inst, float weight);Add source instance with weight.
layer_end¶
IM_ANIM_API void layer_end(ImGuiID instance_id);Finalize blending and normalize weights.
get_blended_float¶
inline std::pair<bool, float> get_blended_float(ImGuiID instance_id, ImGuiID channel);get_blended_vec2¶
inline std::pair<bool, ImVec2> get_blended_vec2(ImGuiID instance_id, ImGuiID channel);get_blended_vec4¶
inline std::pair<bool, ImVec4> get_blended_vec4(ImGuiID instance_id, ImGuiID channel);get_blended_int¶
inline std::pair<bool, int> get_blended_int(ImGuiID instance_id, ImGuiID channel);Persistence (optional)¶
clip_save¶
IM_ANIM_API result clip_save(ImGuiID clip_id, char const* path);clip_load¶
IM_ANIM_API result clip_load(char const* path, ImGuiID* out_clip_id);Usage notes¶
ImAnimDemoWindow¶
void ImAnimDemoWindow(bool create_window = true);TWEEN API:
Call update_begin_frame() once per frame; use ImGui::GetIO().DeltaTime as dt.
For each widget/object, pick a stable ImGuiID (e.g. ImGui::GetItemID()) and a channel_id (ImHashStr(“alpha”)).
Call tween_* to get the animated value, then apply it (PushStyleVar, etc).
Optionally call gc(600) every second to bound memory.
Use tween_vec2_rel / tween_vec2_resolved / rebase_vec2 to keep animations smooth on window/dock/viewport changes.
CLIP API:Author clips once at startup using clip::begin(id).key_*(...).end()
Call clip_update(dt) each frame after update_begin_frame()
Use play(clip_id, instance_id) to start playback; returns instance for queries
Call inst.get_float/vec2/vec4/int() to sample animated values
Optionally call clip_gc(600) to bound instance memory
Demo and doc launchers (see im_anim_demo.cpp, im_anim_docs.cpp, im_anim_usecase.cpp)
ImAnimDocWindow¶
void ImAnimDocWindow(bool create_window = true);ImAnimUsecaseWindow¶
void ImAnimUsecaseWindow(bool create_window = true);ImAnimDemoBasicsWindow¶
void ImAnimDemoBasicsWindow(bool create_window = true);