implement animation panel interaction
This commit is contained in:
@@ -227,8 +227,23 @@ bool Layer::create(int width, int height, std::string name)
|
||||
bool Layer::add_frame()
|
||||
{
|
||||
m_frames.emplace_back();
|
||||
m_frame_index = m_frames.size() - 1;
|
||||
return frame().create(w, h);
|
||||
return m_frames.back().create(w, h);
|
||||
}
|
||||
|
||||
int Layer::total_duration() const noexcept
|
||||
{
|
||||
int duration = 0;
|
||||
for (auto& f : m_frames)
|
||||
duration += f.m_duration;
|
||||
return duration;
|
||||
}
|
||||
|
||||
void Layer::goto_frame(int frame) noexcept
|
||||
{
|
||||
int i = 0;
|
||||
for (i = 0; i < m_frames.size() && frame >= 0; i++)
|
||||
frame -= m_frames[i].m_duration;
|
||||
m_frame_index = i - 1;
|
||||
}
|
||||
|
||||
void Layer::resize(int width, int height)
|
||||
|
||||
Reference in New Issue
Block a user