Skip to content

ui::LottieIconSource

Header: winui/ui/media/AnimatedVisuals.hpp.

Derives from ui::AnimatedIconSource.

The base of the stock animated icons. Each is 48x48 DIPs, and render_frame() draws it in opaque black.

Every stock source is stateless, so one instance can serve any number of icons. AnimatedIcon calls render_icon_frame() with its own foreground color. An AnimatedVisualPlayer calls render_frame().

Example:

static const ui::AnimatedSettingsVisualSource settings;

auto icon = std::make_unique<ui::AnimatedIconControl>();
icon->set_source(&settings);
icon->set_fallback(ui::IconGlyph{0xE713}); // the static settings glyph
icon->set_state("Normal");

// Or play the whole animation in a player:
auto player = std::make_unique<ui::AnimatedVisualPlayerControl>();
player->set_source(&settings);

natural_size

Size natural_size() const override

Always 48x48 DIPs.

render_frame

void render_frame(Renderer& renderer, const Rect& bounds, double progress) const override

Draws the frame at progress (0..1) in opaque black.