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

Low-level animation types: imperative tracks, CSS keyframes, and the per-instance active animation state. More...

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

Go to the source code of this file.

Classes

class  ZenitUI::UIAnimation
 A time-parameterised sequence of per-property tracks. More...
struct  ZenitUI::UIAnimation::TrackBase
 Type-erased track interface. More...
struct  ZenitUI::UIAnimation::Track< T >
 Concrete typed track: start/end pair plus a setter. More...
struct  ZenitUI::AnimState
 Playback state for one UIAnimation on one node. More...
struct  ZenitUI::Keyframe
 One keyframe of a CSS animation: a normalized time and a sparse style delta. More...
struct  ZenitUI::KeyframeAnimation
 A named list of keyframes, keyed by name in Theme::keyframes. More...
struct  ZenitUI::ActiveCssAnimation
 Playback state for one CSS animation on one node. More...

Macros

#define X(T, name, def)

Functions

float ZenitUI::sampleActive (const ActiveCssAnimation &a, bool &finished)
 Sample the given CSS animation's local time without touching the cache.
float ZenitUI::sampleActiveCached (const ActiveCssAnimation &a, bool &finished)
 Cached wrapper around sampleActive.
Style ZenitUI::evaluateKeyframes (const KeyframeAnimation &anim, float localT, TransitionFunction ease)
 Interpolate a KeyframeAnimation at local time localT.

Detailed Description

Low-level animation types: imperative tracks, CSS keyframes, and the per-instance active animation state.

Two animation systems coexist:

  • Imperative (UIAnimation, AnimState): driven by code, one track per property, applied per-frame by AnimationPlayer::tickImperative. Used by Modal::show, Popup::openInternal, and any component that needs runtime-controlled tweens.
  • Declarative CSS (KeyframeAnimation, ActiveCssAnimation): driven by the animations field of a Style, sampled from the theme's @keyframes registry, and overlaid onto the resolved style at draw time by Anim::overlayCssStyle / Anim::overlayCssComputed.

The two systems share easing (Easing.hpp) and style interpolation (Style.hpp::lerpProp and friends) but are otherwise independent.

Macro Definition Documentation

◆ X

#define X ( T,
name,
def )
Value:
if (k0->delta.name.is_set && k1->delta.name.is_set) \
out.name = lerpProp(k0->delta.name.value, k1->delta.name.value, u); \
else if (k0->delta.name.is_set) \
out.name = k0->delta.name.value; \
else if (k1->delta.name.is_set) \
out.name = k1->delta.name.value;