1 #include <lib/gui/ewidgetanimation.h>
2 #include <lib/gui/ewidget.h>
4 eWidgetAnimation::eWidgetAnimation(eWidget *widget): m_widget(widget)
9 void eWidgetAnimation::tick(int inc)
17 if (m_move_current_tick >= m_move_length)
20 m_move_current_tick = m_move_length;
23 m_move_start = m_widget->position();
25 int xdiff = m_move_start.x() - m_move_end.x();
26 int ydiff = m_move_start.y() - m_move_end.y();
28 xdiff *= 31; xdiff /= 32;
29 ydiff *= 31; ydiff /= 32;
32 xdiff *= m_move_current_tick;
33 xdiff /= m_move_length;
35 ydiff *= m_move_current_tick;
36 ydiff /= m_move_length;
39 ePoint res(m_move_end.x() + xdiff, m_move_end.y() + ydiff);
41 m_move_current_tick += inc;
47 void eWidgetAnimation::startMoveAnimation(ePoint start, ePoint end, int length)
49 m_move_current_tick = 0;
50 m_move_length = length;
54 m_widget->move(m_move_start);