1#ifndef YAZE_APP_GUI_ANIMATION_ANIMATOR_H_
2#define YAZE_APP_GUI_ANIMATION_ANIMATOR_H_
5#include <unordered_map>
6#include <unordered_set>
8#include "imgui/imgui.h"
35 static float Lerp(
float a,
float b,
float t);
40 static ImVec4
LerpColor(ImVec4 a, ImVec4 b,
float t);
43 float Animate(
const std::string& panel_id,
const std::string& anim_id,
44 float target,
float speed = 5.0f);
45 ImVec4
AnimateColor(
const std::string& panel_id,
const std::string& anim_id,
46 ImVec4 target,
float speed = 5.0f);
85 ImVec4
color = ImVec4(0.0f, 0.0f, 0.0f, 0.0f);
98 using AnimationMap = std::unordered_map<std::string, AnimationState>;
101 const std::string& anim_id);
106 std::unordered_map<std::string, AnimationMap>
panels_;
static float EaseOutBack(float t)
void ClearAnimationsForPanel(const std::string &panel_id)
bool IsPanelTransitioning(const std::string &panel_id) const
std::unordered_map< std::string, AnimationState > AnimationMap
static MotionProfile ClampMotionProfile(int raw_profile)
float ComputeStep(float speed) const
PanelTransition UpdatePanelTransition(const std::string &panel_id, float speed=8.0f)
static float EaseInOutCubic(float t)
void SetMotionPreferences(bool reduced_motion, MotionProfile profile)
void ApplyPanelTransitionPre(const std::string &panel_id)
AnimationState & GetState(const std::string &panel_id, const std::string &anim_id)
float ApplyTransitionEasing(float t) const
MotionProfile motion_profile() const
static float Lerp(float a, float b, float t)
ImVec4 AnimateColor(const std::string &panel_id, const std::string &anim_id, ImVec4 target, float speed=5.0f)
bool reduced_motion() const
static float EaseOutElastic(float t)
static ImVec4 LerpColor(ImVec4 a, ImVec4 b, float t)
std::unordered_set< std::string > pushed_transition_alpha_
float Animate(const std::string &panel_id, const std::string &anim_id, float target, float speed=5.0f)
MotionProfile motion_profile_
float GetProfileSpeedMultiplier() const
std::unordered_map< std::string, AnimationMap > panels_
void ApplyPanelTransitionPost(const std::string &panel_id)
void BeginPanelTransition(const std::string &panel_id, TransitionType type)
void ClearAllAnimations()
static float EaseOutCubic(float t)
std::unordered_map< std::string, PanelTransitionState > panel_transitions_