ZenitUI
Retained-mode C++20 UI framework
Loading...
Searching...
No Matches
AnimationPlayer.hpp File Reference

Per-node owner of imperative and CSS animation state. More...

#include "Common.hpp"
#include "CoreTypes.hpp"
#include "Style.hpp"
#include "AnimPrimitives.hpp"
#include "Theme.hpp"

Go to the source code of this file.

Classes

struct  ZenitUI::AnimationPlayer
 Per-node animation state and operations. More...
struct  ZenitUI::AnimationPlayer::State

Namespaces

namespace  ZenitUI::Anim
 Internal helpers; called from AnimationPlayer and from Layout::draw.

Functions

void ZenitUI::Anim::syncRefs (std::vector< ActiveCssAnimation > &anims, const std::vector< AnimationRef > &refs, double now)
 Synchronize the active-animation list with a new set of references.
void ZenitUI::Anim::tickIncremental (std::vector< ActiveCssAnimation > &anims, float dt, const Theme &theme)
 Advance active CSS animations incrementally by dt seconds.
void ZenitUI::Anim::tickAbsolute (std::vector< ActiveCssAnimation > &anims, double now, const Theme &theme)
 Update active CSS animations against absolute timestamp now.
void ZenitUI::Anim::overlayCssStyle (Style &out, const std::vector< ActiveCssAnimation > &anims, const Theme &theme)
 Overlay active CSS keyframe frames onto a sparse Style.
void ZenitUI::Anim::overlayCssComputed (ComputedStyle &out, const std::vector< ActiveCssAnimation > &anims, const Theme &theme)
 Overlay active CSS keyframe frames onto a ComputedStyle.

Detailed Description

Per-node owner of imperative and CSS animation state.

Every Layout embeds one AnimationPlayer (as anim_). It is responsible for:

  • Advancing imperative animations (tickImperative).
  • Keeping the CSS animation list in sync with the node's target style (syncCss, driven by Style::animations).
  • Advancing CSS animations (tickCss).
  • Sampling CSS animations onto a style at draw time (overlayCssStyle, overlayCssComputed).
  • Managing per-pseudo-element animations (applyCssToPart), which use wall-clock time (UIContext::time) instead of a per-frame delta.

The Anim namespace in AnimationPlayer.cpp holds the free functions that mutate ActiveCssAnimation lists; this header only declares them. The AnimationPlayer struct itself is the stateful facade.