[dali_2.3.19] Merge branch 'devel/master'
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / devel-api / visuals / animated-gradient-visual-properties-devel.h
1 #ifndef DALI_TOOLKIT_DEVEL_ANIMATED_GRADIENT_VISUAL_PROPERTIES_H
2 #define DALI_TOOLKIT_DEVEL_ANIMATED_GRADIENT_VISUAL_PROPERTIES_H
3
4 /*
5  * Copyright (c) 2020 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 // INTERNAL INCLUDES
22 #include <dali-toolkit/public-api/toolkit-property-index-ranges.h>
23
24 namespace Dali
25 {
26 namespace Toolkit
27 {
28 /**
29  *
30  */
31
32 /**
33  * @brief AnimatedGradientVisual is to render a smooth transition of colors to the control's quad with animation.
34  */
35 namespace DevelAnimatedGradientVisual
36 {
37 /**
38  * @brief AnimatedGradientVisual Property
39  */
40 namespace Property
41 {
42 /**
43  * @brief AnimatedGradientVisual Property
44  */
45 enum
46 {
47   /**
48    * @brief The form of gradient.
49    * @details Name "gradientType", type GradientType::Type (Property::INTEGER) or Property::STRING.
50    * @note If not supplied, default is GradientType::LINEAR.
51    * @see GradientType::Type
52    */
53   GRADIENT_TYPE = VISUAL_PROPERTY_START_INDEX,
54
55   /**
56    * @brief The coordinate system inside of control's quad.
57    * @details Name "unitType", type UnitType::Type (Property::INTEGER) or Property::STRING.
58    * @note If not supplied, default is UnitType::OBJECT_BOUNDING_BOX.
59    * @see UnitType::Type
60    */
61   UNIT_TYPE,
62
63   /**
64    * @brief The policy of color when gradient coordinate is not between 0 and 1.
65    * @details Name "spreadType", type SpreadType::Type (Property::INTEGER) or Property::STRING.
66    * @note If not supplied, default is SpreadType::REFLECT.
67    * @see SpreadType::Type
68    */
69   SPREAD_TYPE,
70
71   /**
72    * @brief The position of a gradient coordinate is 0. If GRADIENT_TYPE is RADIAL, than it will be center of circle.
73    * @details Name "startPosition", type Property::Vector2 or Property::Map which index is AnimatedGradientVisual::AnimationParameter::Property
74    * @note If not supplied, default is Vector2( -0.5f, 0.0f ).
75    * @note This can be animated when you use type as Property::Map which index is AnimatedGradientVisual::AnimationParameter::Property
76    */
77   START_POSITION,
78
79   /**
80    * @brief The color of a gradient coordinate is 0.
81    * @details Name "startColor", type Property::Vector4 or Property::Map which index is AnimatedGradientVisual::AnimationParameter::Property.
82    * @note If not supplied, default is Vector4( 143.0f, 170.0f, 220.0f, 255.0f ) / 255.0f.
83    * @note This can be animated when you use type as Property::Map which index is AnimatedGradientVisual::AnimationParameter::Property.
84    */
85   START_COLOR,
86
87   /**
88    * @brief The position of a gradient coordinate is 1.
89    * @details Name "endPosition", type Property::Vector2 or Property::Map which index is AnimatedGradientVisual::AnimationParameter::Property.
90    * @note If not supplied, default is Vector2( 0.5f, 0.0f ).
91    * @note This can be animated when you use type as Property::Map which index is AnimatedGradientVisual::AnimationParameter::Property.
92    */
93   END_POSITION,
94
95   /**
96    * @brief The color of a gradient coordinate is 1.
97    * @details Name "endColor", type Property::Vector4 or Property::Map which index is AnimatedGradientVisual::AnimationParameter::Property.
98    * @note If not supplied, default is Vector4( 255.0f, 163.0f, 163.0f, 255.0f ) / 255.0f.
99    * @note This can be animated when you use type as Property::Map which index is AnimatedGradientVisual::AnimationParameter::Property
100    */
101   END_COLOR,
102
103   /**
104    * @brief The center of rotate START_POSITION and END_POSITION.
105    * @details Name "rotateCenter", type Property::Vector2 or Property::Map which index is AnimatedGradientVisual::AnimationParameter::Property.
106    * @note If not supplied, default is Vector2( 0.0f, 0.0f ).
107    * @note This can be animated when you use type as Property::Map which index is AnimatedGradientVisual::AnimationParameter::Property
108    */
109   ROTATE_CENTER,
110
111   /**
112    * @brief The amount of rotate START_POSITION and END_POSITION in radian.
113    * @details Name "rotateAmount", type Property::FLOAT or Property::Map which index is AnimatedGradientVisual::AnimationParameter::Property.
114    * @note If not supplied, default is 0.0f.
115    * @note This can be animated when you use type as Property::Map which index is AnimatedGradientVisual::AnimationParameter::Property
116    */
117   ROTATE_AMOUNT,
118
119   /**
120    * @brief The offset of gradient coordinate. The point will have a color where (gradient coordinate + offset).
121    * @details Name "offset", type Property::FLOAT or Property::Map which index is AnimatedGradientVisual::AnimationParameter::Property.
122    * @note If not supplied, default is Animation from 0.0f to 2.0f, with duration 3.0f seconds.
123    * @note This can be animated when you use type as Property::Map which index is AnimatedGradientVisual::AnimationParameter::Property.
124    */
125   OFFSET
126 };
127
128 } // namespace Property
129
130 /**
131  * @brief The type of gradient form. It decide the method of calculate gradient coordinate.
132  * - If GradientType::Type is LINEAR, gradient coordinate is dot product with the line which contain START_POSITION and END_POSITION.
133  * - If GradientType::Type is RADIAL, gradient coordinate is euclidean distance from START_POSITION.
134  */
135 namespace GradientType
136 {
137 /**
138  * @brief The type of gradient form. It decide the method of calculate gradient coordinate.
139  * - If GradientType::Type is LINEAR, gradient coordinate is dot product with the line which contain START_POSITION and END_POSITION.
140  * - If GradientType::Type is RADIAL, gradient coordinate is euclidean distance from START_POSITION.
141  */
142 enum Type
143 {
144   LINEAR, ///< Draw gradient linear form.
145   RADIAL  ///< Draw gradient radial form.
146 };
147
148 } // namespace GradientType
149
150 /**
151  * @brief The type of coordinate system for certain attributes of the points in a gradients.
152  * This applies to the START_POSITION, END_POSITION, and ROTATE_CENTER.
153  */
154 namespace UnitType
155 {
156 /**
157  * @brief The type of coordinate system for certain attributes of the points in a gradients.
158  * This applies to the START_POSITION, END_POSITION, and ROTATE_CENTER.
159  */
160 enum Type
161 {
162   OBJECT_BOUNDING_BOX, ///< Use positions coordinate in bottom-left(-0.5,-0.5) ~ top-right(0.5,0.5).
163   USER_SPACE,          ///< Use positions coordinate in bottom-left(-ActorSize.xy * 0.5) ~ top-right(ActorSize.xy * 0.5).
164 };
165
166 } // namespace UnitType
167
168 /**
169  * @brief The policies that define what happens if the gradient coordinate is not between 0 and 1.
170  */
171 namespace SpreadType
172 {
173 /**
174  * @brief The policies that define what happens if the gradient coordinate is not between 0 and 1.
175  */
176 enum Type
177 {
178   REFLECT, ///<  Reflect the gradient pattern start-to-end, end-to-start, start-to-end etc.
179   REPEAT,  ///< Repeat the gradient pattern start-to-end, start-to-end, start-to-end etc.
180   CLAMP,   ///< Use the terminal colors of gradient.
181 };
182
183 } // namespace SpreadType
184
185 /**
186  * @brief AnimatedGradientVisual::AnimationParameter is information of each properties animation.
187  * Value animate from start to target during duration seconds.
188  * Each start/target value type for AnimatedGradientVisual Property is :
189  * - START_POSITION, END_POSITION, ROTATE_CENTER is Property::Vector2
190  * - START_COLOR, END_COLOR is Property::Vector4
191  * - ROTATE_AMOUNT, OFFSET is Property::FLOAT
192  * You can set the animation information to AnimatedGradientVisual Property by using Property::MAP.
193  */
194 namespace AnimationParameter
195 {
196 /**
197  * @brief AnimatedGradientVisual::AnimationParameter Property
198  */
199 enum Property
200 {
201
202   /**
203    * @brief The start value of this animation.
204    * @details Name "startValue", type depends on AnimatedGradientVisual Property.
205    * @note If not supplied, default is Property::Value( 0.0f ).
206    */
207   START = DevelAnimatedGradientVisual::Property::OFFSET + 1,
208
209   /**
210    * @brief The target value of this animation.
211    * @details Name "targetValue", type depends on AnimatedGradientVisual Property.
212    * @note If not supplied, default is Property::Value( 0.0f ).
213    */
214   TARGET,
215
216   /**
217    * @brief The direction of this animation.
218    * @details Name "directionType", type DirectionType::Type (Property::INTEGER) or Property::STRING.
219    * @note If not supplied, default is DirectionType::FORWARD.
220    * @see DirectionType::Type
221    */
222   DIRECTION,
223
224   /**
225    * @brief The duration of this animation in seconds.
226    * @details Name "duration", type Property::FLOAT.
227    * @note If not supplied, default is 3.0f.
228    */
229   DURATION,
230
231   /**
232    * @brief The delay of this animation in seconds.
233    * If delay is positive, wait the animation 'delay' seconds.
234    * If delay is negative, skip the animation '-delay' seconds.
235    * @details Name "delay", type Property::FLOAT.
236    * @note If not supplied, default is 0.0f.
237    */
238   DELAY,
239
240   /**
241    * @brief The repeat count of this animation.
242    * If repeat is negative, animate unlimited loop.
243    * If repeat is zero, animation will no run.
244    * If repeat is positive, animate 'repeat' times.
245    * @details Name "repeat", type Property::INTEGER.
246    * @note If not supplied, default is 0.
247    */
248   REPEAT,
249
250   /**
251    * @brief The delay before each loop of this animation in seconds.
252    * @details Name "repeatDelay", type Property::FLOAT.
253    * @note If not supplied, default is 0.0f.
254    */
255   REPEAT_DELAY,
256
257   /**
258    * @brief The motion of this animation.
259    * @details Name "motionType", type MotionType::Type (Property::INTEGER) or Property::STRING.
260    * @note If not supplied, default is MotionType::LOOP.
261    * @see MotionType::Type
262    */
263   MOTION_TYPE,
264
265   /**
266    * @brief The easing option of this animation.
267    * @details Name "easingType", type EasingType::Type (Property::INTEGER) or Property::STRING.
268    * @note If not supplied, default is EasingType::LINEAR.
269    * @see EasingType::Type
270    */
271   EASING_TYPE
272 };
273
274 /**
275  * @brief The type of animation direction
276  */
277 namespace DirectionType
278 {
279 /**
280  * @brief The type of animation direction
281  */
282 enum Type
283 {
284   FORWARD,  ///< Animate value from START to TARGET
285   BACKWARD, ///< Animate value frome TARGET to START
286 };
287
288 } // namespace DirectionType
289
290 /**
291  * @brief The type of animation motion
292  */
293 namespace MotionType
294 {
295 /**
296  * @brief The type of animation motion
297  */
298 enum Type
299 {
300   LOOP,   ///< Animate loopingmode restart
301   MIRROR, ///< Animate loopingmode auto_reverse
302 };
303
304 } // namespace MotionType
305
306 /**
307  * @brief The type of animation easing
308  */
309 namespace EasingType
310 {
311 /**
312  * @brief The type of animation easing
313  */
314 enum Type
315 {
316   LINEAR, ///< Easing animation linear
317   IN,     ///< Ease-in animation (slow start -> fast finish)
318   OUT,    ///< Ease-out animation (fast start -> slow finish)
319   IN_OUT, ///< Ease-in and Ease-out animation (slow start -> slow finish)
320 };
321
322 } // namespace EasingType
323
324 } // namespace AnimationParameter
325
326 } // namespace DevelAnimatedGradientVisual
327
328 /**
329  *
330  */
331
332 } // namespace Toolkit
333
334 } // namespace Dali
335
336 #endif