/* * Copyright (c) 2021, Andreas Kling * * SPDX-License-Identifier: BSD-2-Clause */ #pragma once #include #include #include #include #include #include namespace WindowServer { class Compositor; class Screen; class Animation : public RefCounted { public: static NonnullRefPtr create() { return adopt_ref(*new Animation); } ~Animation(); bool is_running() const { return m_running; } void start(); void stop(); void set_duration(int duration_in_ms); int duration() const { return m_duration; } void update(Badge, Gfx::Painter&, Screen&, Gfx::DisjointRectSet& flush_rects); Function on_update; Function on_stop; private: Animation(); Core::ElapsedTimer m_timer; int m_duration { 0 }; bool m_running { false }; }; }