16 m_ElementsSequence.push_back(std::move(element));
21 template<
class... args_t>
24 m_ElementsSequence.emplace_back(std::forward<args_t>(args)...);
31 m_ElementsSequence.clear();
32 m_nCurrentElement = 0;
33 m_fCurrentTime = T(0.f);
40 if (
auto pCurrentElement = get_current_element())
41 pCurrentElement->start();
47 if (
auto pCurrentElement = get_current_element())
48 pCurrentElement->pause();
54 if (
auto pCurrentElement = get_current_element())
55 pCurrentElement->resume();
61 if (
auto pCurrentElement = get_current_element())
63 pCurrentElement->finish();
71 m_nCurrentElement = 0;
72 m_fCurrentTime = T(0.f);
73 for (
auto& element : m_ElementsSequence)
80 if (
auto pCurrentElement = get_current_element())
82 T fNotUsedTime = pCurrentElement->update(fDeltaTime * m_fSpeed) / m_fSpeed;
84 if (pCurrentElement->is_finished())
87 m_fCurrentTime += T(1.f) / pCurrentElement->get_speed();
88 if (m_nCurrentElement >= m_ElementsSequence.size() && m_bLoop)
90 m_nCurrentElement = 0;
91 m_fCurrentTime = T(0.f);
94 if (
auto pNewElement = get_current_element())
118 if (
auto pCurrentElement = get_current_element())
120 return pCurrentElement->get();
122 else if (!m_ElementsSequence.empty() && m_nCurrentElement >= m_ElementsSequence.size())
124 return m_ElementsSequence.back().get();
135 if (
auto pCurrentElement = get_current_element())
137 return (m_fCurrentTime + pCurrentElement->get_fraction() / pCurrentElement->get_speed()) / m_fTotalTime;
139 else if (m_fTotalTime > T(0.f))
141 return m_fCurrentTime / m_fTotalTime;
158 if (
auto pCurrentElement = get_current_element())
160 return pCurrentElement->is_not_started();
162 else if (!m_ElementsSequence.empty() && m_nCurrentElement >= m_ElementsSequence.size())
164 return m_ElementsSequence.back().is_not_started();
175 if (
auto pCurrentElement = get_current_element())
177 return pCurrentElement->is_started();
179 else if (!m_ElementsSequence.empty() && m_nCurrentElement >= m_ElementsSequence.size())
181 return m_ElementsSequence.back().is_started();
192 if (
auto pCurrentElement = get_current_element())
193 return pCurrentElement->is_paused();
201 if (
auto pCurrentElement = get_current_element())
203 return pCurrentElement->is_finished();
205 else if (!m_ElementsSequence.empty() && m_nCurrentElement >= m_ElementsSequence.size())
207 return m_ElementsSequence.back().is_finished();
224 return m_nCurrentElement < m_ElementsSequence.size() ? &m_ElementsSequence[m_nCurrentElement] :
nullptr;
228 inline const typename base_easing_sequence<T>::easing_element_type* base_easing_sequence<T>::get_current_element()
231 return QX_CONST_CAST_THIS()->get_current_element();
235 inline void base_easing_sequence<T>::update_total_time() noexcept
237 m_fTotalTime += T(1.f) / m_ElementsSequence.back().
get_speed();
An updatable element representing the value of the easing function at a given time.
T get_speed() const noexcept
Get speed value.
qx::base_easing_element queue
bool is_started() const noexcept
Is sequence started.
T get_speed() const noexcept
Get updating speed value.
void update(T fDeltaTime) noexcept
Update easing element sequence.
void start() noexcept
Start easing element sequence playing.
void clear() noexcept
Clear elements queue.
void pause() noexcept
Pause easing element sequence playing.
void skip() noexcept
Skip current element.
bool is_paused() const noexcept
Is sequence paused.
bool is_finished() const noexcept
Is sequence finished.
T get_fraction() const noexcept
Get a fraction indicating how much of the sequence has played.
void resume() noexcept
Resume easing element sequence playing.
void emplace_back(args_t &&... args) noexcept
Add easing element to queue by constructing in-place.
T get() const noexcept
Get value of current sequence element.
void set_looped(bool bLooped) noexcept
Set loop state.
void reset() noexcept
Reset sequence.
bool is_not_started() const noexcept
Is sequence not started.
void set_speed(T fSpeed) noexcept
Set updating speed value.
bool is_looped() const noexcept
Is sequence looped.
void push_back(easing_element_type element) noexcept
Add easing element to queue.