DVUI

animation

Add animation a to key associated with id. See Animation.

If dvui.reduce_motion is true, overwites end_time so the animation will expire next frame.

Only valid between Window.begin and Window.end.

Parameters

#
id:Id
Id
key:[]const u8
[]const u8
a:Animation
Animation

Source

Implementation

#
pub fn animation(id: Id, key: []const u8, a: Animation) void {
    var cw = currentWindow();
    const h = id.update(key);
    var aa = a;
    if (reduce_motion) aa.end_time = aa.start_time + 1;
    cw.animations.put(cw.gpa, h, aa) catch |err| switch (err) {
        error.OutOfMemory => {
            log.err("animation got {any} for id {x} key {s}\n", .{ err, id, key });
        },
    };
}