6#ifndef MALENA_FADEABLE_H
7#define MALENA_FADEABLE_H
73 float duration = 0.5f,
75 std::function<
void()> onComplete =
nullptr);
88 std::function<
void()> onComplete =
nullptr);
101 std::function<
void()> onComplete =
nullptr);
118 std::function<
void()> onComplete =
nullptr);
150 float _alpha = 255.f;
151 float _startAlpha = 255.f;
152 float _targetAlpha = 255.f;
153 float _elapsed = 0.f;
154 float _duration = 0.f;
155 bool _active =
false;
156 bool _holding =
false;
159 std::function<void()> _onComplete;
161 static float applyTween(
float t,
Tween tween);
167#include "../../../../src/Traits/Visual/Fadeable.cpp"
void fadeTo(uint8_t targetAlpha, float duration=0.5f, Tween tween=LINEAR, std::function< void()> onComplete=nullptr)
Animate alpha from its current value to targetAlpha.
void setAlpha(uint8_t alpha)
Set alpha immediately with no animation.
void fadeOut(float duration=0.5f, Tween tween=LINEAR, std::function< void()> onComplete=nullptr)
Animate alpha from its current value to 0 (fully transparent).
bool isFading() const
Return true while a fade or hold animation is running.
uint8_t getAlpha() const
Return the current alpha as a uint8_t (0–255).
void fadeIn(float duration=0.5f, Tween tween=LINEAR, std::function< void()> onComplete=nullptr)
Animate alpha from 0 to 255 (fully opaque).
void holdFor(float duration, std::function< void()> onComplete=nullptr)
Hold at the current alpha for duration seconds, then fire onComplete.
Empty marker base class for all Malena traits.
Tween
Easing curve selection for animated movement.
@ LINEAR
Constant-speed interpolation.