56 , m_duration(duration)
57 , m_callback(callback)
73 , m_duration(duration)
76 m_callback = [&val](
double v) ->
void
156 const double coeff = m_easing(m_date / m_duration);
157 return m_init + coeff * (m_end - m_init);
171bool claw::tween::single_tweener::do_is_finished()
const
173 return m_date >= m_duration;
180double claw::tween::single_tweener::do_update(
double dt)
182 const double t(std::min(m_duration - m_date, dt));
183 const double result = dt - t;
186 const double val(get_value());
Easing functions for the tweener. Those functions do nothing.
A single_tweener makes a value to evolve through time from a initial value to an end value according ...
void set_duration(double v)
Sets the total duration.
double get_end() const
Gets the final value.
void set_end(double v)
Sets the final value.
single_tweener()
Default constructor.
void set_easing(easing_function f)
The function used to compute the new value.
std::function< double(double)> easing_function
The type of the function used to compute the new value.
double get_init() const
Gets the initial value.
void set_init(double v)
Sets the initial value.
double get_duration() const
Gets the total duration.
void set_callback(update_function f)
The function called when the single_tweener is updated.
double get_value() const
Gets the current value of the tweener.
std::function< void(double)> update_function
The type of the function called when the single_tweener is updated.
A single_tweener makes a value to evolve through time from a initial value to an end value according ...