1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-28 16:07:45 +00:00

2048: Add pop-in animation for newly added tiles

This commit is contained in:
Dmitrii Ubskii 2021-06-11 15:28:42 +03:00 committed by Andreas Kling
parent 30c831a3be
commit 9ce5ce3560
3 changed files with 47 additions and 5 deletions

View file

@ -24,6 +24,7 @@ private:
virtual void resize_event(GUI::ResizeEvent&) override;
virtual void paint_event(GUI::PaintEvent&) override;
virtual void keydown_event(GUI::KeyEvent&) override;
virtual void timer_event(Core::TimerEvent&) override;
size_t rows() const;
size_t columns() const;
@ -35,7 +36,13 @@ private:
Color text_color_for_cell(u32 value);
float m_padding { 0 };
float m_min_cell_size { 0 };
float m_cell_size { 0 };
Game::Board const* m_board { nullptr };
static constexpr int frame_duration_ms = 1000 / 60;
static constexpr int animation_duration = 5;
int pop_in_animation_frame = 0;
};