13#include <etl/vector.h>
37 group.push_back(std::move(anim));
38 steps.push_back(std::move(group));
49 if (!
steps.back().full())
51 steps.back().push_back(std::move(anim));
64 for (
auto& group :
steps)
66 for (
auto& anim : group)
86 for (
auto& anim : group)
88 if (anim && !anim->tick(dt))
102 etl::vector<Group, MAX_STEPS>
steps;
117 template <
typename Builder>
118 requires(!std::convertible_to<Builder, std::shared_ptr<UIAnimation>>)
121 seq->appendGroup(std::forward<Builder>(b).
build());
125 template <
typename Builder>
126 requires(!std::convertible_to<Builder, std::shared_ptr<UIAnimation>>)
129 seq->joinGroup(std::forward<Builder>(b).
build());
135 seq->appendGroup(std::move(anim));
141 seq->joinGroup(std::move(anim));
147 seq->setRepeat(mode, count);
151 std::shared_ptr<UIAnimation>
build()
159 std::shared_ptr<UISequenceAnimation>
seq;
Weak handle used by callers to cancel/pause/query a running UI animation.
Base class for one UI animation step (property, delay, callback, sequence).
UIRepeatMode
How an animation behaves after reaching its end.
Non-owning control handle for a UIAnimation managed by UIAnimator.
virtual void reset()
Resets runtime state so the animation can play again (used by Loop).
UIAnimation(const UIAnimation &)=delete
Owns and ticks active UI animations. Safe against cancel-during-tick.
Plays groups of animations: each step waits until all in the group finish.
void appendGroup(std::shared_ptr< UIAnimation > anim)
etl::vector< std::shared_ptr< UIAnimation >, MAX_ANIMATIONS_PER_STEP > Group
void reset() override
Resets runtime state so the animation can play again (used by Loop).
static constexpr std::size_t MAX_STEPS
bool onUpdate(ae::q20_12_t dt) override
Per-frame update.
static constexpr std::size_t MAX_ANIMATIONS_PER_STEP
etl::vector< Group, MAX_STEPS > steps
void joinGroup(std::shared_ptr< UIAnimation > anim)
UISequenceBuilder(UIAnimator *animOwner=nullptr)
std::shared_ptr< UISequenceAnimation > seq
UISequenceBuilder & join(std::shared_ptr< UIAnimation > anim)
UISequenceBuilder & append(std::shared_ptr< UIAnimation > anim)
std::shared_ptr< UIAnimation > build()
UISequenceBuilder & append(Builder &&b)
UISequenceBuilder & repeat(UIRepeatMode mode, int count=-1)
UIAnimationHandle start()
UISequenceBuilder & join(Builder &&b)