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