Purge underscored header file barriers
[platform/core/uifw/dali-core.git] / dali / devel-api / animation / animation-data.h
1 #ifndef DALI_ANIMATION_DATA_H
2 #define DALI_ANIMATION_DATA_H
3
4 /*
5  * Copyright (c) 2019 Samsung Electronics Co., Ltd.
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  *
19  */
20
21 // EXTERNAL INCLUDES
22 #include <string>
23
24 // INTERNAL INCLUDES
25 #include <dali/public-api/actors/actor.h>
26 #include <dali/public-api/animation/alpha-function.h>
27 #include <dali/public-api/animation/animation.h>
28 #include <dali/public-api/common/dali-vector.h>
29 #include <dali/public-api/object/property-value.h>
30
31 namespace Dali
32 {
33
34 /**
35  * @brief This object stores description data that can be used to generate an Animation.
36  * This data can be produced from passing JSON.
37  *
38  * This then allows the same description data to be used to repeatedly create an animation multiple times.
39  */
40 class DALI_CORE_API AnimationData
41 {
42 public:
43
44   AnimationData();
45
46   ~AnimationData();
47
48   /**
49    * @brief AnimationDataElement Describes one part of an animation.
50    */
51   struct AnimationDataElement
52   {
53     std::string actor;
54     std::string property;
55     Property::Value value;
56     AlphaFunction::BuiltinFunction alphaFunction;
57     float timePeriodDelay;
58     float timePeriodDuration;
59
60     AnimationDataElement()
61     : alphaFunction( AlphaFunction::DEFAULT ),
62       timePeriodDelay( 0.0f ),
63       timePeriodDuration( 1.0f )
64     {
65     }
66   };
67
68
69   /**
70    * @brief AnimationData holds the required data required to define an
71    * animation to be performed on an actor or actors.
72    */
73   typedef Dali::Vector< AnimationDataElement* > AnimationDataList;
74
75
76   /**
77    * @brief Adds one AnimationDataElement to the list to describe one animation.
78    * @param[in] animationDataElement A pre-populated struct to add
79    * @note This class takes ownership of animationDataElement
80    */
81   void Add( AnimationDataElement* animationDataElement );
82
83
84   /**
85    * @brief Creates a Dali::Animation from this AnimationData object.
86    * The AnimationData object can describe multiple individual property animations.
87    * Each one will be added to a created animation.
88    *
89    * If there is no animation data defined, an invalid Dali::Animation handle is returned.
90    * @param[in] targetActor The actor to target the property animations to.
91    * @param[in] duration The duration of the animation to create.
92    * @return    A ready-to-go Dali::Animation, or an invalid handle if there was no data.
93    */
94   Dali::Animation CreateAnimation( Dali::Actor targetActor, float duration );
95
96
97   /**
98    * @brief Empties this AnimationData object (and frees all memory).
99    */
100   void Clear();
101
102 private:
103
104   AnimationDataList mAnimationDataList; ///< A vector of individual property animations from which to generate a Dali::Animation.
105
106 };
107
108
109 } // namespace Dali
110
111 #endif // DALI_ANIMATION_DATA_H
112