[SRUK] Initial copy from Tizen 2.2 version
[platform/core/uifw/dali-core.git] / dali / public-api / animation / animation.cpp
1 //
2 // Copyright (c) 2014 Samsung Electronics Co., Ltd.
3 //
4 // Licensed under the Flora License, Version 1.0 (the License);
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 //     http://floralicense.org/license/
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an AS IS BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16
17 // CLASS HEADER
18 #include <dali/public-api/animation/animation.h>
19
20 // INTERNAL INCLUDES
21 #include <dali/public-api/animation/alpha-functions.h>
22 #include <dali/public-api/animation/time-period.h>
23 #include <dali/public-api/math/quaternion.h>
24 #include <dali/public-api/math/degree.h>
25 #include <dali/public-api/math/radian.h>
26 #include <dali/public-api/math/vector2.h>
27 #include <dali/internal/event/actors/actor-impl.h>
28 #include <dali/internal/event/animation/animation-impl.h>
29 #include <dali/internal/event/effects/shader-effect-impl.h>
30
31 namespace Dali
32 {
33
34 const char* const Animation::SIGNAL_FINISHED = "finished";
35 const char* const Animation::ACTION_PLAY = "play";
36 const char* const Animation::ACTION_STOP = "stop";
37 const char* const Animation::ACTION_PAUSE = "pause";
38
39 Animation::Animation()
40 {
41 }
42
43 Animation::Animation(Internal::Animation* animation)
44 : BaseHandle(animation)
45 {
46 }
47
48 Animation Animation::New(float durationSeconds)
49 {
50   Internal::AnimationPtr internal = Dali::Internal::Animation::New(durationSeconds);
51
52   return Animation(internal.Get());
53 }
54
55 Animation Animation::DownCast( BaseHandle handle )
56 {
57   return Animation( dynamic_cast<Dali::Internal::Animation*>(handle.GetObjectPtr()) );
58 }
59
60 Animation::~Animation()
61 {
62 }
63
64 void Animation::SetDuration(float durationSeconds)
65 {
66   GetImplementation(*this).SetDuration(durationSeconds);
67 }
68
69 float Animation::GetDuration() const
70 {
71   return GetImplementation(*this).GetDuration();
72 }
73
74 void Animation::SetLooping(bool looping)
75 {
76   GetImplementation(*this).SetLooping(looping);
77 }
78
79 bool Animation::IsLooping() const
80 {
81   return GetImplementation(*this).IsLooping();
82 }
83
84 void Animation::SetEndAction(Dali::Animation::EndAction endAction)
85 {
86   GetImplementation(*this).SetEndAction(endAction);
87 }
88
89 Dali::Animation::EndAction Animation::GetEndAction() const
90 {
91   return GetImplementation(*this).GetEndAction();
92 }
93
94 void Animation::SetDestroyAction(Dali::Animation::EndAction destroyAction)
95 {
96   GetImplementation(*this).SetDestroyAction(destroyAction);
97 }
98
99 Dali::Animation::EndAction Animation::GetDestroyAction() const
100 {
101   return GetImplementation(*this).GetDestroyAction();
102 }
103
104 void Animation::SetDefaultAlphaFunction(AlphaFunction alpha)
105 {
106   GetImplementation(*this).SetDefaultAlphaFunction(alpha);
107 }
108
109 AlphaFunction Animation::GetDefaultAlphaFunction() const
110 {
111   return GetImplementation(*this).GetDefaultAlphaFunction();
112 }
113
114 void Animation::Play()
115 {
116   GetImplementation(*this).Play();
117 }
118
119 void Animation::Pause()
120 {
121   GetImplementation(*this).Pause();
122 }
123
124 void Animation::Stop()
125 {
126   GetImplementation(*this).Stop();
127 }
128
129 void Animation::Clear()
130 {
131   GetImplementation(*this).Clear();
132 }
133
134 Animation::AnimationSignalV2& Animation::FinishedSignal()
135 {
136   return GetImplementation(*this).FinishedSignal();
137 }
138
139 void Animation::AnimateBy(Property target, Property::Value relativeValue)
140 {
141   GetImplementation(*this).AnimateBy(target, relativeValue);
142 }
143
144 void Animation::AnimateBy(Property target, Property::Value relativeValue, AlphaFunction alpha)
145 {
146   GetImplementation(*this).AnimateBy(target, relativeValue, alpha);
147 }
148
149 void Animation::AnimateBy(Property target, Property::Value relativeValue, TimePeriod period)
150 {
151   GetImplementation(*this).AnimateBy(target, relativeValue, period);
152 }
153
154 void Animation::AnimateBy(Property target, Property::Value relativeValue, AlphaFunction alpha, TimePeriod period)
155 {
156   GetImplementation(*this).AnimateBy(target, relativeValue, alpha, period);
157 }
158
159 void Animation::AnimateTo(Property target, Property::Value destinationValue)
160 {
161   GetImplementation(*this).AnimateTo(target, destinationValue);
162 }
163
164 void Animation::AnimateTo(Property target, Property::Value destinationValue, AlphaFunction alpha)
165 {
166   GetImplementation(*this).AnimateTo(target, destinationValue, alpha);
167 }
168
169 void Animation::AnimateTo(Property target, Property::Value destinationValue, TimePeriod period)
170 {
171   GetImplementation(*this).AnimateTo(target, destinationValue, period);
172 }
173
174 void Animation::AnimateTo(Property target, Property::Value destinationValue, AlphaFunction alpha, TimePeriod period)
175 {
176   GetImplementation(*this).AnimateTo(target, destinationValue, alpha, period);
177 }
178
179 void Animation::AnimateBetween(Property target, KeyFrames& keyFrames)
180 {
181   GetImplementation(*this).AnimateBetween(target, GetImplementation(keyFrames));
182 }
183
184 void Animation::AnimateBetween(Property target, KeyFrames& keyFrames, TimePeriod period)
185 {
186   GetImplementation(*this).AnimateBetween(target, GetImplementation(keyFrames), period);
187 }
188
189 void Animation::AnimateBetween(Property target, KeyFrames& keyFrames, AlphaFunction alpha)
190 {
191   GetImplementation(*this).AnimateBetween(target, GetImplementation(keyFrames), alpha);
192 }
193
194 void Animation::AnimateBetween(Property target, KeyFrames& keyFrames, AlphaFunction alpha, TimePeriod period)
195 {
196   GetImplementation(*this).AnimateBetween(target, GetImplementation(keyFrames), alpha, period);
197 }
198
199 void Animation::Animate( Property target, Property::Type targetType, AnyFunction func )
200 {
201   GetImplementation(*this).Animate( target, targetType, func );
202 }
203
204 void Animation::Animate( Property target, Property::Type targetType, AnyFunction func, AlphaFunction alpha )
205 {
206   GetImplementation(*this).Animate( target, targetType, func, alpha );
207 }
208
209 void Animation::Animate( Property target, Property::Type targetType, AnyFunction func, TimePeriod period )
210 {
211   GetImplementation(*this).Animate( target, targetType, func, period );
212 }
213
214 void Animation::Animate( Property target, Property::Type targetType, AnyFunction func, AlphaFunction alpha, TimePeriod period )
215 {
216   GetImplementation(*this).Animate( target, targetType, func, alpha, period );
217 }
218
219 // Actor specific animations
220
221 void Animation::MoveBy(Actor actor, float x, float y, float z)
222 {
223   GetImplementation(*this).MoveBy(GetImplementation(actor), x, y, z);
224 }
225
226 void Animation::MoveBy(Actor actor, Vector3 displacement, AlphaFunction alpha)
227 {
228   GetImplementation(*this).MoveBy(GetImplementation(actor), displacement, alpha);
229 }
230
231 void Animation::MoveBy(Actor actor, Vector3 displacement, AlphaFunction alpha, float delaySeconds, float durationSeconds)
232 {
233   GetImplementation(*this).MoveBy(GetImplementation(actor), displacement, alpha, delaySeconds, durationSeconds);
234 }
235
236 void Animation::MoveTo(Actor actor, float x, float y, float z)
237 {
238   GetImplementation(*this).MoveTo(GetImplementation(actor), x, y, z);
239 }
240
241 void Animation::MoveTo(Actor actor, Vector3 position, AlphaFunction alpha)
242 {
243   GetImplementation(*this).MoveTo(GetImplementation(actor), position, alpha);
244 }
245
246 void Animation::MoveTo(Actor actor, Vector3 position, AlphaFunction alpha, float delaySeconds, float durationSeconds)
247 {
248   GetImplementation(*this).MoveTo(GetImplementation(actor), position, alpha, delaySeconds, durationSeconds);
249 }
250
251 void Animation::Move(Actor actor, AnimatorFunctionVector3 animatorFunc, AlphaFunction alpha, float delaySeconds, float durationSeconds)
252 {
253   GetImplementation(*this).Move(GetImplementation(actor), animatorFunc, alpha, delaySeconds, durationSeconds);
254 }
255
256 void Animation::RotateBy(Actor actor, Degree angle, Vector3 axis)
257 {
258   GetImplementation(*this).RotateBy(GetImplementation(actor), Radian(angle), axis);
259 }
260
261 void Animation::RotateBy(Actor actor, Radian angle, Vector3 axis)
262 {
263   GetImplementation(*this).RotateBy(GetImplementation(actor), angle, axis);
264 }
265
266 void Animation::RotateBy(Actor actor, Degree angle, Vector3 axis, AlphaFunction alpha)
267 {
268   GetImplementation(*this).RotateBy(GetImplementation(actor), Radian(angle), axis, alpha);
269 }
270
271 void Animation::RotateBy(Actor actor, Radian angle, Vector3 axis, AlphaFunction alpha)
272 {
273   GetImplementation(*this).RotateBy(GetImplementation(actor), angle, axis, alpha);
274 }
275
276 void Animation::RotateBy(Actor actor, Degree angle, Vector3 axis, AlphaFunction alpha, float delaySeconds, float durationSeconds)
277 {
278   GetImplementation(*this).RotateBy(GetImplementation(actor), Radian(angle), axis, alpha, delaySeconds, durationSeconds);
279 }
280
281 void Animation::RotateBy(Actor actor, Radian angle, Vector3 axis, AlphaFunction alpha, float delaySeconds, float durationSeconds)
282 {
283   GetImplementation(*this).RotateBy(GetImplementation(actor), angle, axis, alpha, delaySeconds, durationSeconds);
284 }
285
286 void Animation::RotateTo(Actor actor, Degree angle, Vector3 axis)
287 {
288   GetImplementation(*this).RotateTo(GetImplementation(actor), Radian(angle), axis);
289 }
290
291 void Animation::RotateTo(Actor actor, Radian angle, Vector3 axis)
292 {
293   GetImplementation(*this).RotateTo(GetImplementation(actor), angle, axis);
294 }
295
296 void Animation::RotateTo(Actor actor, Quaternion rotation)
297 {
298   GetImplementation(*this).RotateTo(GetImplementation(actor), rotation);
299 }
300
301 void Animation::RotateTo(Actor actor, Degree angle, Vector3 axis, AlphaFunction alpha)
302 {
303   GetImplementation(*this).RotateTo(GetImplementation(actor), Radian(angle), axis, alpha);
304 }
305
306 void Animation::RotateTo(Actor actor, Radian angle, Vector3 axis, AlphaFunction alpha)
307 {
308   GetImplementation(*this).RotateTo(GetImplementation(actor), angle, axis, alpha);
309 }
310
311 void Animation::RotateTo(Actor actor, Quaternion rotation, AlphaFunction alpha)
312 {
313   GetImplementation(*this).RotateTo(GetImplementation(actor), rotation, alpha);
314 }
315
316 void Animation::RotateTo(Actor actor, Degree angle, Vector3 axis, AlphaFunction alpha, float delaySeconds, float durationSeconds)
317 {
318   GetImplementation(*this).RotateTo(GetImplementation(actor), Radian(angle), axis, alpha, delaySeconds, durationSeconds);
319 }
320
321 void Animation::RotateTo(Actor actor, Radian angle, Vector3 axis, AlphaFunction alpha, float delaySeconds, float durationSeconds)
322 {
323   GetImplementation(*this).RotateTo(GetImplementation(actor), angle, axis, alpha, delaySeconds, durationSeconds);
324 }
325
326 void Animation::RotateTo(Actor actor, Quaternion rotation, AlphaFunction alpha, float delaySeconds, float durationSeconds)
327 {
328   GetImplementation(*this).RotateTo(GetImplementation(actor), rotation, alpha, delaySeconds, durationSeconds);
329 }
330
331 void Animation::Rotate(Actor actor, AnimatorFunctionQuaternion animatorFunc, AlphaFunction alpha, float delaySeconds, float durationSeconds)
332 {
333   GetImplementation(*this).Rotate(GetImplementation(actor), animatorFunc, alpha, delaySeconds, durationSeconds);
334 }
335
336 void Animation::ScaleBy(Actor actor, float x, float y, float z)
337 {
338   GetImplementation(*this).ScaleBy(GetImplementation(actor), x, y, z);
339 }
340
341 void Animation::ScaleBy(Actor actor, Vector3 scale, AlphaFunction alpha)
342 {
343   GetImplementation(*this).ScaleBy(GetImplementation(actor), scale, alpha);
344 }
345
346 void Animation::ScaleBy(Actor actor, Vector3 scale, AlphaFunction alpha, float delaySeconds, float durationSeconds)
347 {
348   GetImplementation(*this).ScaleBy(GetImplementation(actor), scale, alpha, delaySeconds, durationSeconds);
349 }
350
351 void Animation::ScaleTo(Actor actor, float x, float y, float z)
352 {
353   GetImplementation(*this).ScaleTo(GetImplementation(actor), x, y, z);
354 }
355
356 void Animation::ScaleTo(Actor actor, Vector3 scale, AlphaFunction alpha)
357 {
358   GetImplementation(*this).ScaleTo(GetImplementation(actor), scale, alpha);
359 }
360
361 void Animation::ScaleTo(Actor actor, Vector3 scale, AlphaFunction alpha, float delaySeconds, float durationSeconds)
362 {
363   GetImplementation(*this).ScaleTo(GetImplementation(actor), scale, alpha, delaySeconds, durationSeconds);
364 }
365
366 void Animation::Show(Actor actor, float delaySeconds)
367 {
368   GetImplementation(*this).Show(GetImplementation(actor), delaySeconds);
369 }
370
371 void Animation::Hide(Actor actor, float delaySeconds)
372 {
373   GetImplementation(*this).Hide(GetImplementation(actor), delaySeconds);
374 }
375
376 void Animation::OpacityBy(Actor actor, float opacity)
377 {
378   GetImplementation(*this).OpacityBy(GetImplementation(actor), opacity);
379 }
380
381 void Animation::OpacityBy(Actor actor, float opacity, AlphaFunction alpha)
382 {
383   GetImplementation(*this).OpacityBy(GetImplementation(actor), opacity, alpha);
384 }
385
386 void Animation::OpacityBy(Actor actor, float opacity, AlphaFunction alpha, float delaySeconds, float durationSeconds)
387 {
388   GetImplementation(*this).OpacityBy(GetImplementation(actor), opacity, alpha, delaySeconds, durationSeconds);
389 }
390
391 void Animation::OpacityTo(Actor actor, float opacity)
392 {
393   GetImplementation(*this).OpacityTo(GetImplementation(actor), opacity);
394 }
395
396 void Animation::OpacityTo(Actor actor, float opacity, AlphaFunction alpha)
397 {
398   GetImplementation(*this).OpacityTo(GetImplementation(actor), opacity, alpha);
399 }
400
401 void Animation::OpacityTo(Actor actor, float opacity, AlphaFunction alpha, float delaySeconds, float durationSeconds)
402 {
403   GetImplementation(*this).OpacityTo(GetImplementation(actor), opacity, alpha, delaySeconds, durationSeconds);
404 }
405
406 void Animation::ColorBy(Actor actor, Vector4 color)
407 {
408   GetImplementation(*this).ColorBy(GetImplementation(actor), color);
409 }
410
411 void Animation::ColorBy(Actor actor, Vector4 color, AlphaFunction alpha)
412 {
413   GetImplementation(*this).ColorBy(GetImplementation(actor), color, alpha);
414 }
415
416 void Animation::ColorBy(Actor actor, Vector4 color, AlphaFunction alpha, float delaySeconds, float durationSeconds)
417 {
418   GetImplementation(*this).ColorBy(GetImplementation(actor), color, alpha, delaySeconds, durationSeconds);
419 }
420
421 void Animation::ColorTo(Actor actor, Vector4 color)
422 {
423   GetImplementation(*this).ColorTo(GetImplementation(actor), color);
424 }
425
426 void Animation::ColorTo(Actor actor, Vector4 color, AlphaFunction alpha)
427 {
428   GetImplementation(*this).ColorTo(GetImplementation(actor), color, alpha);
429 }
430
431 void Animation::ColorTo(Actor actor, Vector4 color, AlphaFunction alpha, float delaySeconds, float durationSeconds)
432 {
433   GetImplementation(*this).ColorTo(GetImplementation(actor), color, alpha, delaySeconds, durationSeconds);
434 }
435
436 void Animation::Resize(Actor actor, float width, float height)
437 {
438   GetImplementation(*this).Resize(GetImplementation(actor), width, height);
439 }
440
441 void Animation::Resize(Actor actor, float width, float height, AlphaFunction alpha)
442 {
443   GetImplementation(*this).Resize(GetImplementation(actor), width, height, alpha);
444 }
445
446 void Animation::Resize(Actor actor,float width, float height, AlphaFunction alpha, float delaySeconds, float durationSeconds)
447 {
448   GetImplementation(*this).Resize(GetImplementation(actor), width, height, alpha, delaySeconds, durationSeconds);
449 }
450
451 void Animation::Resize(Actor actor, Vector3 size)
452 {
453   GetImplementation(*this).Resize(GetImplementation(actor), size);
454 }
455
456 void Animation::Resize(Actor actor, Vector3 size, AlphaFunction alpha)
457 {
458   GetImplementation(*this).Resize(GetImplementation(actor), size, alpha);
459 }
460
461 void Animation::Resize(Actor actor, Vector3 size, AlphaFunction alpha, float delaySeconds, float durationSeconds)
462 {
463   GetImplementation(*this).Resize(GetImplementation(actor), size, alpha, delaySeconds, durationSeconds);
464 }
465
466 } // namespace Dali