Update rive-cpp to 2.0 version
[platform/core/uifw/rive-tizen.git] / submodule / rive-cpp / include / rive / animation / linear_animation.hpp
1 #ifndef _RIVE_LINEAR_ANIMATION_HPP_
2 #define _RIVE_LINEAR_ANIMATION_HPP_
3 #include "rive/animation/loop.hpp"
4 #include "rive/generated/animation/linear_animation_base.hpp"
5 #include <vector>
6 namespace rive {
7     class Artboard;
8     class KeyedObject;
9
10     class LinearAnimation : public LinearAnimationBase {
11     private:
12         std::vector< std::unique_ptr<KeyedObject> > m_KeyedObjects;
13
14         friend class Artboard;
15
16     public:
17         LinearAnimation();
18         ~LinearAnimation() override;
19         StatusCode onAddedDirty(CoreContext* context) override;
20         StatusCode onAddedClean(CoreContext* context) override;
21         void addKeyedObject(std::unique_ptr<KeyedObject>);
22         void apply(Artboard* artboard, float time, float mix = 1.0f) const;
23
24         Loop loop() const { return (Loop)loopValue(); }
25
26         StatusCode import(ImportStack& importStack) override;
27
28         float startSeconds() const;
29         float endSeconds() const;
30         float durationSeconds() const;
31
32         /// Convert a global clock to local seconds (takes into consideration
33         /// work area start/end, speed, looping).
34         float globalToLocalSeconds(float seconds) const;
35
36 #ifdef TESTING
37         size_t numKeyedObjects() { return m_KeyedObjects.size(); }
38         // Used in testing to check how many animations gets deleted.
39         static int deleteCount;
40 #endif
41     };
42 } // namespace rive
43
44 #endif