Go to the documentation of this file.
9 #ifndef EAGINE_ANIMATED_VALUE_HPP
10 #define EAGINE_ANIMATED_VALUE_HPP
14 #include <type_traits>
19 template <
typename T,
typename F,
typename S =
float>
42 return set(value, duration, 2);
46 auto get() const -> T {
61 return _phase >= _duration;
static constexpr auto clamp(T x, Min min, Max max) noexcept
Clamps x to be between min and max.
Definition: functions.hpp:96
Common code is placed in this namespace.
Definition: eagine.hpp:21
Class representing a value animated between two points, with easing.
Definition: animated_value.hpp:20
static constexpr auto extract(api_result_value< Result, api_result_validity::never > &) noexcept -> Result &
Overload of extract for api_result_value.
Definition: c_api_wrap.hpp:270
auto update(F deltaT) -> auto &
Updates the transition factor by the specified amount.
Definition: animated_value.hpp:54
Primary template for conditionally valid values.
Definition: decl.hpp:49
auto is_done() const noexcept -> bool
Indicates if the current transition factor is higher than current duration.
Definition: animated_value.hpp:60
animated_value()=default
Default constructor.
static constexpr auto sigmoid01(T x, C c) noexcept
Calculates the sigmoid of x. The value c controls steepness.
Definition: functions.hpp:134
static constexpr auto blend(T v1, T v2, A alpha) noexcept
Blends v1 and v2, using alpha as the blending factor.
Definition: functions.hpp:110
auto set(T value, valid_if_positive< F > duration) -> auto &
Sets the next point to animate into and the duration of the transition.
Definition: animated_value.hpp:41
animated_value(const T &initial)
Initializing to the specified value.
Definition: animated_value.hpp:26
auto set(T value, valid_if_positive< F > duration, S slope) -> auto &
Sets the next point to animate into, duration and sigmoid slope.
Definition: animated_value.hpp:31
auto get() const -> T
Gets the current value between the current and the next point.
Definition: animated_value.hpp:46