[NUI] Clean NUI codes from Adaptor.cs to Window.cs (#652)
[platform/core/csapi/tizenfx.git] / src / Tizen.NUI / src / public / Animation.cs
1 /*
2  * Copyright(c) 2018 Samsung Electronics Co., Ltd.
3  *
4  * Licensed under the Apache License, Version 2.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://www.apache.org/licenses/LICENSE-2.0
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
18 namespace Tizen.NUI
19 {
20
21     using System;
22     using System.ComponentModel;
23     using System.Runtime.InteropServices;
24     using Tizen.NUI.BaseComponents;
25
26     using System.Collections;
27     using System.Collections.Generic;
28     using System.Linq;
29     using System.Reflection;
30     using System.Xml;
31     using Tizen.NUI.Binding.Internals;
32     using Tizen.NUI.Binding;
33     using System.Globalization;
34     using Tizen.NUI.Xaml.Internals;
35
36     /// <summary>
37     /// Animation can be used to animate the properties of any number of objects, typically view.<br />
38     /// If the "Finished" event is connected to a member function of an object, it must be disconnected before the object is destroyed.<br />
39     /// This is typically done in the object destructor, and requires either the animation handle to be stored.<br />
40     /// The overall animation time is superseded by the values given in the animation time used when calling the AnimateTo(), AnimateBy(), AnimateBetween() and AnimatePath() methods.<br />
41     /// If any of the individual calls to those functions exceeds the overall animation time (Duration), then the overall animation time is automatically extended.<br />
42     /// </summary>
43     /// <since_tizen> 3 </since_tizen>
44     public class Animation : BaseHandle
45     {
46         private static bool? disableAnimation = null;
47
48         private global::System.Runtime.InteropServices.HandleRef swigCPtr;
49
50         private AnimationFinishedEventCallbackType _animationFinishedEventCallback;
51         private System.IntPtr _finishedCallbackOfNative;
52
53         private AnimationProgressReachedEventCallbackType _animationProgressReachedEventCallback;
54
55         private string[] _properties = null;
56         private string[] _destValue = null;
57         private int[] _startTime = null;
58         private int[] _endTime = null;
59
60         /// <summary>
61         /// Creates an initialized animation.<br />
62         /// The animation will not loop.<br />
63         /// The default end action is "Cancel".<br />
64         /// The default alpha function is linear.<br />
65         /// </summary>
66         /// <remarks>DurationmSeconds must be greater than zero.</remarks>
67         /// <param name="durationMilliSeconds">The duration in milliseconds.</param>
68         /// <since_tizen> 3 </since_tizen>
69         public Animation(int durationMilliSeconds) : this(NDalicPINVOKE.Animation_New((float)durationMilliSeconds / 1000.0f), true)
70         {
71             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
72         }
73
74         internal Animation(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicPINVOKE.Animation_SWIGUpcast(cPtr), cMemoryOwn)
75         {
76             swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
77
78             _animationFinishedEventCallback = OnFinished;
79             _finishedCallbackOfNative = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate<System.Delegate>(_animationFinishedEventCallback);
80         }
81
82         [UnmanagedFunctionPointer(CallingConvention.StdCall)]
83         private delegate void AnimationFinishedEventCallbackType(IntPtr data);
84
85         [UnmanagedFunctionPointer(CallingConvention.StdCall)]
86         private delegate void AnimationProgressReachedEventCallbackType(IntPtr data);
87
88         private event EventHandler _animationFinishedEventHandler;
89
90         /**
91         * @brief Event for the finished signal which can be used to subscribe or unsubscribe the event handler.
92         * The finished signal is emitted when an animation's animations have finished.
93         */
94         /// <since_tizen> 3 </since_tizen>
95         public event EventHandler Finished
96         {
97             add
98             {
99                 if (_animationFinishedEventHandler == null && disposed == false)
100                 {
101                     FinishedSignal().Connect(_finishedCallbackOfNative);
102                 }
103                 _animationFinishedEventHandler += value;
104             }
105             remove
106             {
107                 _animationFinishedEventHandler -= value;
108
109                 if (_animationFinishedEventHandler == null && FinishedSignal().Empty() == false)
110                 {
111                     FinishedSignal().Disconnect(_finishedCallbackOfNative);
112                 }
113             }
114         }
115
116         private event EventHandler _animationProgressReachedEventHandler;
117
118         /**
119        * @brief Event for the ProgressReached signal, which can be used to subscribe or unsubscribe the event handler.
120        * The ProgressReached signal is emitted when the animation has reached a given progress percentage, this is set in the api SetProgressNotification.
121        */
122         /// <since_tizen> 3 </since_tizen>
123         public event EventHandler ProgressReached
124         {
125             add
126             {
127                 if (_animationProgressReachedEventHandler == null)
128                 {
129                     _animationProgressReachedEventCallback = OnProgressReached;
130                     ProgressReachedSignal().Connect(_animationProgressReachedEventCallback);
131                 }
132
133                 _animationProgressReachedEventHandler += value;
134             }
135             remove
136             {
137                 _animationProgressReachedEventHandler -= value;
138
139                 if (_animationProgressReachedEventHandler == null && ProgressReachedSignal().Empty() == false)
140                 {
141                     ProgressReachedSignal().Disconnect(_animationProgressReachedEventCallback);
142                 }
143             }
144         }
145
146         /// <summary>
147         /// Enumeration for what to do when the animation ends, stopped, or destroyed.
148         /// </summary>
149         /// <since_tizen> 3 </since_tizen>
150         public enum EndActions
151         {
152             /// <summary>
153             /// When the animation ends, the animated property values are saved.
154             /// </summary>
155             Cancel,
156             /// <summary>
157             /// When the animation ends, the animated property values are forgotten.
158             /// </summary>
159             Discard,
160             /// <summary>
161             /// If the animation is stopped, the animated property values are saved as if the animation had run to completion, otherwise behaves like cancel.
162             /// </summary>
163             StopFinal
164         }
165
166         /// <summary>
167         /// Enumeration for what interpolation method to use on key-frame animations.
168         /// </summary>
169         /// <since_tizen> 3 </since_tizen>
170         public enum Interpolation
171         {
172             /// <summary>
173             /// Values in between key frames are interpolated using a linear polynomial. (Default)
174             /// </summary>
175             Linear,
176             /// <summary>
177             /// Values in between key frames are interpolated using a cubic polynomial.
178             /// </summary>
179             Cubic
180         }
181
182         /// <summary>
183         /// Enumeration for what state the animation is in.
184         /// </summary>
185         /// <remarks>Calling Reset() on this class will not reset the animation. It will call the BaseHandle.Reset() which drops the object handle.</remarks>
186         /// <since_tizen> 3 </since_tizen>
187         public enum States
188         {
189             /// <summary>
190             /// The animation has stopped.
191             /// </summary>
192             Stopped,
193             /// <summary>
194             /// The animation is playing.
195             /// </summary>
196             Playing,
197             /// <summary>
198             /// The animation is paused.
199             /// </summary>
200             Paused
201         }
202
203         /// <summary>
204         /// Gets or sets the duration in milliseconds of the animation.
205         /// </summary>
206         /// <since_tizen> 3 </since_tizen>
207         public int Duration
208         {
209             set
210             {
211                 SetDuration(MilliSecondsToSeconds(value));
212             }
213             get
214             {
215                 return SecondsToMilliSeconds(GetDuration());
216             }
217         }
218
219         /// <summary>
220         ///  Gets or sets the default alpha function for the animation.
221         /// </summary>
222         /// <since_tizen> 3 </since_tizen>
223         public AlphaFunction DefaultAlphaFunction
224         {
225             set
226             {
227                 SetDefaultAlphaFunction(value);
228             }
229             get
230             {
231                 AlphaFunction ret = GetDefaultAlphaFunction();
232                 return ret;
233             }
234         }
235
236         /// <summary>
237         /// Queries the state of the animation.
238         /// </summary>
239         /// <since_tizen> 3 </since_tizen>
240         public States State
241         {
242             get
243             {
244                 return GetState();
245             }
246         }
247
248         /// <summary>
249         /// Set: Enables looping for a specified number of repeats. A zero is the same as Looping = true; i.e., repeat forever.<br />
250         /// This property resets the looping value and should not be used with the Looping property.<br />
251         /// Setting this parameter does not cause the animation to Play().<br />
252         /// Get: Gets the loop count. A zero is the same as Looping = true; i.e., repeat forever.<br />
253         /// The loop count is initially 1 for play once.<br />
254         /// </summary>
255         /// <since_tizen> 3 </since_tizen>
256         public int LoopCount
257         {
258             set
259             {
260                 SetLoopCount(value);
261             }
262             get
263             {
264                 int ret = GetLoopCount();
265                 return ret;
266             }
267         }
268
269         /// <summary>
270         /// Gets or sets the status of whether the animation will loop.<br />
271         /// This property resets the loop count and should not be used with the LoopCount property.<br />
272         /// Setting this parameter does not cause the animation to Play().<br />
273         /// </summary>
274         /// <since_tizen> 3 </since_tizen>
275         public bool Looping
276         {
277             set
278             {
279                 SetLooping(value);
280             }
281             get
282             {
283                 bool ret = IsLooping();
284                 return ret;
285             }
286         }
287
288
289         /// <summary>
290         /// Gets or sets the end action of the animation.<br />
291         /// This action is performed when the animation ends or if it is stopped.<br />
292         /// The default end action is cancel.<br />
293         /// </summary>
294         /// <since_tizen> 3 </since_tizen>
295         public EndActions EndAction
296         {
297             set
298             {
299                 SetEndAction(value);
300             }
301             get
302             {
303                 return GetEndAction();
304             }
305         }
306
307         /// <summary>
308         /// Gets the current loop count.<br />
309         /// A value 0 indicating the current loop count when looping.<br />
310         /// </summary>
311         /// <since_tizen> 3 </since_tizen>
312         public int CurrentLoop
313         {
314             get
315             {
316                 return GetCurrentLoop();
317             }
318         }
319
320         /// <summary>
321         /// Gets or sets the disconnect action.<br />
322         /// If any of the animated property owners are disconnected from the stage while the animation is being played, then this action is performed.<br />
323         /// The default action is cancel.<br />
324         /// </summary>
325         /// <since_tizen> 3 </since_tizen>
326         public EndActions DisconnectAction
327         {
328             set
329             {
330                 NDalicPINVOKE.Animation_SetDisconnectAction(swigCPtr, (int)value);
331                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
332             }
333             get
334             {
335                 Animation.EndActions ret = (Animation.EndActions)NDalicPINVOKE.Animation_GetDisconnectAction(swigCPtr);
336                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
337                 return ret;
338             }
339         }
340
341
342         /// <summary>
343         /// Gets or sets the progress of the animation.<br />
344         /// The animation will play (or continue playing) from this point.<br />
345         /// The progress must be in the 0-1 interval or in the play range interval if defined<br />
346         /// otherwise, it will be ignored.<br />
347         /// </summary>
348         /// <since_tizen> 3 </since_tizen>
349         public float CurrentProgress
350         {
351             set
352             {
353                 NDalicPINVOKE.Animation_SetCurrentProgress(swigCPtr, value);
354                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
355             }
356             get
357             {
358                 float ret = NDalicPINVOKE.Animation_GetCurrentProgress(swigCPtr);
359                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
360                 return ret;
361             }
362         }
363
364         /// <summary>
365         /// Gets or sets specificifications of a speed factor for the animation.<br />
366         /// The speed factor is a multiplier of the normal velocity of the animation.<br />
367         /// Values between [0, 1] will slow down the animation and values above one will speed up the animation.<br />
368         /// It is also possible to specify a negative multiplier to play the animation in reverse.<br />
369         /// </summary>
370         /// <since_tizen> 3 </since_tizen>
371         public float SpeedFactor
372         {
373             set
374             {
375                 NDalicPINVOKE.Animation_SetSpeedFactor(swigCPtr, value);
376                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
377             }
378             get
379             {
380                 float ret = NDalicPINVOKE.Animation_GetSpeedFactor(swigCPtr);
381                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
382                 return ret;
383             }
384         }
385
386         /// <summary>
387         /// Gets or sets the playing range.<br />
388         /// Animation will play between the values specified. Both values (range.x and range.y ) should be between 0-1,
389         /// otherwise they will be ignored. If the range provided is not in proper order (minimum, maximum ), it will be reordered.<br />
390         /// </summary>
391         /// <since_tizen> 3 </since_tizen>
392         public RelativeVector2 PlayRange
393         {
394             set
395             {
396                 NDalicPINVOKE.Animation_SetPlayRange(swigCPtr, Vector2.getCPtr(value));
397                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
398             }
399             get
400             {
401                 Vector2 ret = new Vector2(NDalicPINVOKE.Animation_GetPlayRange(swigCPtr), true);
402                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
403                 return ret;
404             }
405         }
406
407
408         /// <summary>
409         /// Gets or sets the progress notification marker which triggers the ProgressReachedSignal.<br />
410         /// Percentage of animation progress should be greater than 0 and less than 1, for example, 0.3 for 30% <br />
411         /// One notification can be set on each animation.
412         /// </summary>
413         /// <since_tizen> 3 </since_tizen>
414         public float ProgressNotification
415         {
416             set
417             {
418                 NDalicPINVOKE.Animation_SetProgressNotification(swigCPtr, value);
419                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
420             }
421             get
422             {
423                 float ret = NDalicPINVOKE.Animation_GetProgressNotification(swigCPtr);
424                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
425                 return ret;
426             }
427         }
428
429         /// <summary>
430         /// Gets or sets the properties of the animation.
431         /// </summary>
432         public string[] Properties
433         {
434             get
435             {
436                 return _properties;
437             }
438             set
439             {
440                 _properties = value;
441             }
442         }
443
444         /// <summary>
445         /// Gets or sets the destination value for each property of the animation.
446         /// </summary>
447         public string[] DestValue
448         {
449             get
450             {
451                 return _destValue;
452             }
453             set
454             {
455                 _destValue = value;
456             }
457         }
458
459         /// <summary>
460         /// Gets or sets the start time for each property of the animation.
461         /// </summary>
462         public int[] StartTime
463         {
464             get
465             {
466                 return _startTime;
467             }
468             set
469             {
470                 _startTime = value;
471             }
472         }
473
474         /// <summary>
475         /// Gets or sets the end time for each property of the animation.
476         /// </summary>
477         public int[] EndTime
478         {
479             get
480             {
481                 return _endTime;
482             }
483             set
484             {
485                 _endTime = value;
486             }
487         }
488
489         private bool DisableAnimation
490         {
491             get
492             {
493                 if (disableAnimation.HasValue == false)
494                 {
495                     string type = Environment.GetEnvironmentVariable("PlatformSmartType");
496                     if (type == "Entry")
497                         disableAnimation = true;
498                     else
499                         disableAnimation = false;
500                 }
501                 return disableAnimation.Value;
502             }
503         }
504
505         /// <summary>
506         /// Downcasts a handle to animation handle.<br />
507         /// If handle points to an animation object, the downcast produces a valid handle.<br />
508         /// If not, the returned handle is left uninitialized.<br />
509         /// </summary>
510         /// <param name="handle">Handle to an object.</param>
511         /// <returns>Handle to an animation object or an uninitialized handle.</returns>
512         /// <since_tizen> 3 </since_tizen>
513         public static Animation DownCast(BaseHandle handle)
514         {
515             Animation ret = Registry.GetManagedBaseHandleFromNativePtr(handle) as Animation;
516             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
517             return ret;
518         }
519
520         /// <summary>
521         /// Stops the animation.
522         /// </summary>
523         /// <param name="action">The end action can be set.</param>
524         /// <since_tizen> 3 </since_tizen>
525         public void Stop(EndActions action = EndActions.Cancel)
526         {
527             SetEndAction(action);
528             NDalicPINVOKE.Animation_Stop(swigCPtr);
529             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
530         }
531
532         /// <summary>
533         /// Animates a property value by a relative amount.<br />
534         /// </summary>
535         /// <param name="target">The target object to animate.</param>
536         /// <param name="property">The target property to animate.</param>
537         /// <param name="relativeValue">The property value will change by this amount.</param>
538         /// <param name="alphaFunction">The alpha function to apply.</param>
539         /// <since_tizen> 3 </since_tizen>
540         public void AnimateBy(View target, string property, object relativeValue, AlphaFunction alphaFunction = null)
541         {
542             Property _prop = PropertyHelper.GetPropertyFromString(target, property);
543
544             PropertyType propertyType = target.GetPropertyType(_prop.propertyIndex);
545             if (propertyType.Equals(PropertyType.Float))
546             {
547                 System.Type type = relativeValue.GetType();
548                 if (type.Equals(typeof(System.Int32)) || type.Equals(typeof(int)))
549                 {
550                     int num = (int)relativeValue;
551                     relativeValue = (float)num;
552                 }
553             }
554
555             PropertyValue val = PropertyValue.CreateFromObject(relativeValue);
556
557             if (alphaFunction != null)
558             {
559                 AnimateBy(_prop, val, alphaFunction);
560             }
561             else
562             {
563                 AnimateBy(_prop, val);
564             }
565         }
566
567         /// <summary>
568         /// Animates a property value by a relative amount.<br />
569         /// </summary>
570         /// <param name="target">The target object to animate.</param>
571         /// <param name="property">The target property to animate.</param>
572         /// <param name="relativeValue">The property value will change by this amount.</param>
573         /// <param name="startTime">The start time of the animation.</param>
574         /// <param name="endTime">The end time of the animation.</param>
575         /// <param name="alphaFunction">The alpha function to apply.</param>
576         /// <since_tizen> 3 </since_tizen>
577         public void AnimateBy(View target, string property, object relativeValue, int startTime, int endTime, AlphaFunction alphaFunction = null)
578         {
579             Property _prop = PropertyHelper.GetPropertyFromString(target, property);
580
581             PropertyType propertyType = target.GetPropertyType(_prop.propertyIndex);
582             if (propertyType.Equals(PropertyType.Float))
583             {
584                 System.Type type = relativeValue.GetType();
585                 if (type.Equals(typeof(System.Int32)) || type.Equals(typeof(int)))
586                 {
587                     int num = (int)relativeValue;
588                     relativeValue = (float)num;
589                 }
590             }
591
592             PropertyValue val = PropertyValue.CreateFromObject(relativeValue);
593
594             if (alphaFunction != null)
595             {
596                 Tizen.NUI.TimePeriod time = new Tizen.NUI.TimePeriod(MilliSecondsToSeconds(startTime), MilliSecondsToSeconds(endTime - startTime));
597                 AnimateBy(_prop, val, alphaFunction, time);
598             }
599             else
600             {
601                 Tizen.NUI.TimePeriod time = new Tizen.NUI.TimePeriod(MilliSecondsToSeconds(startTime), MilliSecondsToSeconds(endTime - startTime));
602                 AnimateBy(_prop, val, time);
603             }
604         }
605
606         /// <summary>
607         /// Animates a property to a destination value.<br />
608         /// </summary>
609         /// <param name="target">The target object to animate.</param>
610         /// <param name="property">The target property to animate.</param>
611         /// <param name="destinationValue">The destination value.</param>
612         /// <param name="alphaFunction">The alpha function to apply.</param>
613         /// <since_tizen> 3 </since_tizen>
614         public void AnimateTo(View target, string property, object destinationValue, AlphaFunction alphaFunction = null)
615         {
616             Property _prop = PropertyHelper.GetPropertyFromString(target, property);
617
618             PropertyType propertyType = target.GetPropertyType(_prop.propertyIndex);
619             if (propertyType.Equals(PropertyType.Float))
620             {
621                 System.Type type = destinationValue.GetType();
622                 if (type.Equals(typeof(System.Int32)) || type.Equals(typeof(int)))
623                 {
624                     int num = (int)destinationValue;
625                     destinationValue = (float)num;
626                 }
627             }
628
629             PropertyValue val = PropertyValue.CreateFromObject(destinationValue);
630
631             if (alphaFunction != null)
632             {
633                 AnimateTo(_prop, val, alphaFunction);
634             }
635             else
636             {
637                 AnimateTo(_prop, val);
638             }
639         }
640
641         /// <summary>
642         /// Animates one or more properties to a destination value.<br />
643         /// </summary>
644         /// <param name="target">The target object to animate.</param>
645         public void PlayAnimateTo(View target)
646         {
647             Clear();
648             if (_properties.Length == _destValue.Length && _startTime.Length == _endTime.Length && _properties.Length == _startTime.Length)
649             {
650                 int length = _properties.Length;
651                 for (int index = 0; index < length; index++)
652                 {
653                     //object destinationValue = _destValue[index];
654                     var elementType = target.GetType();
655                     PropertyInfo propertyInfo = elementType.GetProperties().FirstOrDefault(fi => fi.Name == _properties[index]);
656                     //var propertyInfo = elementType.GetRuntimeProperties().FirstOrDefault(p => p.Name == localName);
657                     if (propertyInfo != null)
658                     {
659                         object destinationValue = ConvertTo(_destValue[index], propertyInfo.PropertyType);
660
661                         if (destinationValue != null)
662                         {
663                             AnimateTo(target, _properties[index], destinationValue, _startTime[index], _endTime[index]);
664                         }
665                     }
666                 }
667                 Play();
668             }
669         }
670
671         /// <summary>
672         /// Animates a property to a destination value.<br />
673         /// </summary>
674         /// <param name="target">The target object to animate.</param>
675         /// <param name="property">The target property to animate.</param>
676         /// <param name="destinationValue">The destination value.</param>
677         /// <param name="startTime">The start time of the animation.</param>
678         /// <param name="endTime">The end time of the animation.</param>
679         /// <param name="alphaFunction">The alpha function to apply.</param>
680         /// <since_tizen> 3 </since_tizen>
681         public void AnimateTo(View target, string property, object destinationValue, int startTime, int endTime, AlphaFunction alphaFunction = null)
682         {
683             Property _prop = PropertyHelper.GetPropertyFromString(target, property);
684
685             PropertyType propertyType = target.GetPropertyType(_prop.propertyIndex);
686             if (propertyType.Equals(PropertyType.Float))
687             {
688                 System.Type type = destinationValue.GetType();
689                 if (type.Equals(typeof(System.Int32)) || type.Equals(typeof(int)))
690                 {
691                     int num = (int)destinationValue;
692                     destinationValue = (float)num;
693                 }
694             }
695
696             PropertyValue val = PropertyValue.CreateFromObject(destinationValue);
697
698             if (alphaFunction != null)
699             {
700                 Tizen.NUI.TimePeriod time = new Tizen.NUI.TimePeriod(MilliSecondsToSeconds(startTime), MilliSecondsToSeconds(endTime - startTime));
701                 AnimateTo(_prop, val, alphaFunction, time);
702             }
703             else
704             {
705                 Tizen.NUI.TimePeriod time = new Tizen.NUI.TimePeriod(MilliSecondsToSeconds(startTime), MilliSecondsToSeconds(endTime - startTime));
706                 AnimateTo(_prop, val, time);
707             }
708         }
709
710         /// <summary>
711         /// Animates a property between keyframes.
712         /// </summary>
713         /// <param name="target">The target object to animate.</param>
714         /// <param name="property">The target property to animate.</param>
715         /// <param name="keyFrames">The set of time or value pairs between which to animate.</param>
716         /// <param name="interpolation">The method used to interpolate between values.</param>
717         /// <param name="alphaFunction">The alpha function to apply.</param>
718         /// <since_tizen> 3 </since_tizen>
719         public void AnimateBetween(View target, string property, KeyFrames keyFrames, Interpolation interpolation = Interpolation.Linear, AlphaFunction alphaFunction = null)
720         {
721             Property _prop = PropertyHelper.GetPropertyFromString(target, property);
722
723             if (_prop.propertyIndex == Property.INVALID_INDEX)
724             {
725                 throw new System.ArgumentException("second argument string property is invalid parameter!");
726             }
727
728             if (alphaFunction != null)
729             {
730                 AnimateBetween(_prop, keyFrames, alphaFunction, interpolation);
731             }
732             else
733             {
734                 AnimateBetween(_prop, keyFrames, interpolation);
735             }
736         }
737
738         /// <summary>
739         /// Animates a property between keyframes.
740         /// </summary>
741         /// <param name="target">The target object to animate</param>
742         /// <param name="property">The target property to animate</param>
743         /// <param name="keyFrames">The set of time/value pairs between which to animate</param>
744         /// <param name="startTime">The start time of animation in milliseconds.</param>
745         /// <param name="endTime">The end time of animation in milliseconds.</param>
746         /// <param name="interpolation">The method used to interpolate between values.</param>
747         /// <param name="alphaFunction">The alpha function to apply.</param>
748         /// <since_tizen> 3 </since_tizen>
749         public void AnimateBetween(View target, string property, KeyFrames keyFrames, int startTime, int endTime, Interpolation interpolation = Interpolation.Linear, AlphaFunction alphaFunction = null)
750         {
751             Property _prop = PropertyHelper.GetPropertyFromString(target, property);
752
753             Tizen.NUI.TimePeriod time = new Tizen.NUI.TimePeriod(MilliSecondsToSeconds(startTime), MilliSecondsToSeconds(endTime - startTime));
754             if (alphaFunction != null)
755             {
756                 AnimateBetween(_prop, keyFrames, alphaFunction, time, interpolation);
757             }
758             else
759             {
760                 AnimateBetween(_prop, keyFrames, time, interpolation);
761             }
762         }
763
764         /// <summary>
765         /// Animates the view's position and orientation through a predefined path.<br />
766         /// The view will rotate to orient the supplied forward vector with the path's tangent.<br />
767         /// If forward is the zero vector then no rotation will happen.<br />
768         /// </summary>
769         /// <param name="view">The view to animate.</param>
770         /// <param name="path">It defines position and orientation.</param>
771         /// <param name="forward">The vector (in local space coordinate system) will be oriented with the path's tangent direction.</param>
772         /// <param name="alphaFunction">The alpha function to apply.</param>
773         /// <since_tizen> 3 </since_tizen>
774         public void AnimatePath(View view, Path path, Vector3 forward, AlphaFunction alphaFunction = null)
775         {
776             if (alphaFunction == null)
777             {
778                 Animate(view, path, forward);
779             }
780             else
781             {
782                 Animate(view, path, forward, alphaFunction);
783             }
784         }
785
786         /// <summary>
787         /// Animates the view's position and orientation through a predefined path.<br />
788         /// The view will rotate to orient the supplied forward vector with the path's tangent.<br />
789         /// If forward is the zero vector then no rotation will happen.<br />
790         /// </summary>
791         /// <param name="view">The view to animate.</param>
792         /// <param name="path">It defines position and orientation.</param>
793         /// <param name="forward">The vector (in local space coordinate system) will be oriented with the path's tangent direction.</param>
794         /// <param name="startTime">The start time of the animation.</param>
795         /// <param name="endTime">The end time of the animation.</param>
796         /// <param name="alphaFunction">The alpha function to apply.</param>
797         /// <since_tizen> 3 </since_tizen>
798         public void AnimatePath(View view, Path path, Vector3 forward, int startTime, int endTime, AlphaFunction alphaFunction = null)
799         {
800             TimePeriod time = new TimePeriod(MilliSecondsToSeconds(startTime), MilliSecondsToSeconds(endTime - startTime));
801             if (alphaFunction == null)
802             {
803                 Animate(view, path, forward, time);
804             }
805             else
806             {
807                 Animate(view, path, forward, alphaFunction, time);
808             }
809         }
810
811         /// <summary>
812         /// Creates an initialized animation.<br />
813         /// The animation will not loop.<br />
814         /// The default end action is "Cancel".<br />
815         /// The default alpha function is linear.<br />
816         /// </summary>
817         /// <since_tizen> 3 </since_tizen>
818         public Animation() : this(NDalicPINVOKE.Animation_New(0.0f), true)
819         {
820             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
821         }
822
823         /// <summary>
824         /// Plays the animation.
825         /// </summary>
826         /// <since_tizen> 3 </since_tizen>
827         public void Play()
828         {
829             NDalicPINVOKE.Animation_Play(swigCPtr);
830             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
831
832             if (DisableAnimation == true)
833                 Stop(EndActions.StopFinal);
834         }
835
836         /// <summary>
837         /// Plays the animation from a given point.<br />
838         /// The progress must be in the 0-1 interval or in the play range interval if defined,
839         /// otherwise, it will be ignored.<br />
840         /// </summary>
841         /// <param name="progress">A value between [0,1], or between the play range if specified, from where the animation should start playing.</param>
842         /// <since_tizen> 3 </since_tizen>
843         public void PlayFrom(float progress)
844         {
845             NDalicPINVOKE.Animation_PlayFrom(swigCPtr, progress);
846             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
847         }
848
849         /// <summary>
850         /// Plays the animation after a given delay time.<br/>
851         /// The delay time is not included in the looping time.<br/>
852         /// When the delay time is a negative value, it would treat as play immediately.<br/>
853         /// </summary>
854         /// <param name="delayMilliseconds">The delay time.</param>
855         /// <since_tizen> 4 </since_tizen>
856         public void PlayAfter(int delayMilliseconds)
857         {
858             NDalicPINVOKE.Animation_PlayAfter(swigCPtr, MilliSecondsToSeconds(delayMilliseconds));
859             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
860         }
861
862         /// <summary>
863         /// Pauses the animation.
864         /// </summary>
865         /// <since_tizen> 3 </since_tizen>
866         public void Pause()
867         {
868             NDalicPINVOKE.Animation_Pause(swigCPtr);
869             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
870         }
871
872         /// <summary>
873         /// Stops the animation.
874         /// </summary>
875         /// <since_tizen> 3 </since_tizen>
876         public void Stop()
877         {
878             NDalicPINVOKE.Animation_Stop(swigCPtr);
879             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
880         }
881
882         /// <summary>
883         /// Clears the animation.<br />
884         /// This disconnects any objects that were being animated, effectively stopping the animation.<br />
885         /// </summary>
886         /// <since_tizen> 3 </since_tizen>
887         public void Clear()
888         {
889             NDalicPINVOKE.Animation_Clear(swigCPtr);
890             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
891         }
892
893         internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Animation obj)
894         {
895             return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
896         }
897
898         internal object ConvertTo(object value, Type toType)
899         {
900             Func<object> getConverter = () =>
901             {
902                 string converterTypeName = GetTypeConverterTypeName(toType.GetTypeInfo().CustomAttributes);
903                 if (converterTypeName == null)
904                     return null;
905
906                 Type convertertype = Type.GetType(converterTypeName);
907                 return Activator.CreateInstance(convertertype);
908             };
909
910             return ConvertTo(value, toType, getConverter);
911         }
912
913         internal object ConvertTo(object value, Type toType, Func<object> getConverter)
914         {
915             if (value == null)
916                 return null;
917
918             var str = value as string;
919             if (str != null)
920             {
921                 //If there's a [TypeConverter], use it
922                 object converter = getConverter?.Invoke();
923                 var xfTypeConverter = converter as Tizen.NUI.Binding.TypeConverter;
924                 if (xfTypeConverter != null)
925                     return value = xfTypeConverter.ConvertFromInvariantString(str);
926                 var converterType = converter?.GetType();
927                 if (converterType != null)
928                 {
929                     var convertFromStringInvariant = converterType.GetRuntimeMethod("ConvertFromInvariantString",
930                         new[] { typeof(string) });
931                     if (convertFromStringInvariant != null)
932                         return value = convertFromStringInvariant.Invoke(converter, new object[] { str });
933                 }
934
935                 //If the type is nullable, as the value is not null, it's safe to assume we want the built-in conversion
936                 if (toType.GetTypeInfo().IsGenericType && toType.GetGenericTypeDefinition() == typeof(Nullable<>))
937                     toType = Nullable.GetUnderlyingType(toType);
938
939                 //Obvious Built-in conversions
940                 if (toType.GetTypeInfo().IsEnum)
941                     return Enum.Parse(toType, str, true);
942                 if (toType == typeof(SByte))
943                     return SByte.Parse(str, CultureInfo.InvariantCulture);
944                 if (toType == typeof(Int16))
945                     return Int16.Parse(str, CultureInfo.InvariantCulture);
946                 if (toType == typeof(Int32))
947                     return Int32.Parse(str, CultureInfo.InvariantCulture);
948                 if (toType == typeof(Int64))
949                     return Int64.Parse(str, CultureInfo.InvariantCulture);
950                 if (toType == typeof(Byte))
951                     return Byte.Parse(str, CultureInfo.InvariantCulture);
952                 if (toType == typeof(UInt16))
953                     return UInt16.Parse(str, CultureInfo.InvariantCulture);
954                 if (toType == typeof(UInt32))
955                     return UInt32.Parse(str, CultureInfo.InvariantCulture);
956                 if (toType == typeof(UInt64))
957                     return UInt64.Parse(str, CultureInfo.InvariantCulture);
958                 if (toType == typeof(Single))
959                     return Single.Parse(str, CultureInfo.InvariantCulture);
960                 if (toType == typeof(Double))
961                     return Double.Parse(str, CultureInfo.InvariantCulture);
962                 if (toType == typeof(Boolean))
963                     return Boolean.Parse(str);
964                 if (toType == typeof(TimeSpan))
965                     return TimeSpan.Parse(str, CultureInfo.InvariantCulture);
966                 if (toType == typeof(DateTime))
967                     return DateTime.Parse(str, CultureInfo.InvariantCulture);
968                 if (toType == typeof(Char))
969                 {
970                     char c = '\0';
971                     Char.TryParse(str, out c);
972                     return c;
973                 }
974                 if (toType == typeof(String) && str.StartsWith("{}", StringComparison.Ordinal))
975                     return str.Substring(2);
976                 if (toType == typeof(String))
977                     return value;
978                 if (toType == typeof(Decimal))
979                     return Decimal.Parse(str, CultureInfo.InvariantCulture);
980             }
981
982             //if the value is not assignable and there's an implicit conversion, convert
983             if (value != null && !toType.IsAssignableFrom(value.GetType()))
984             {
985                 var opImplicit = GetImplicitConversionOperator(value.GetType(), value.GetType(), toType)
986                                  ?? GetImplicitConversionOperator(toType, value.GetType(), toType);
987                 //var opImplicit = value.GetType().GetImplicitConversionOperator(fromType: value.GetType(), toType: toType)
988                 //                ?? toType.GetImplicitConversionOperator(fromType: value.GetType(), toType: toType);
989
990                 if (opImplicit != null)
991                 {
992                     value = opImplicit.Invoke(null, new[] { value });
993                     return value;
994                 }
995             }
996
997             var nativeValueConverterService = DependencyService.Get<INativeValueConverterService>();
998
999             object nativeValue = null;
1000             if (nativeValueConverterService != null && nativeValueConverterService.ConvertTo(value, toType, out nativeValue))
1001                 return nativeValue;
1002
1003             return value;
1004         }
1005
1006         internal string GetTypeConverterTypeName(IEnumerable<CustomAttributeData> attributes)
1007         {
1008             var converterAttribute =
1009                 attributes.FirstOrDefault(cad => Tizen.NUI.Binding.TypeConverterAttribute.TypeConvertersType.Contains(cad.AttributeType.FullName));
1010             if (converterAttribute == null)
1011                 return null;
1012             if (converterAttribute.ConstructorArguments[0].ArgumentType == typeof(string))
1013                 return (string)converterAttribute.ConstructorArguments[0].Value;
1014             if (converterAttribute.ConstructorArguments[0].ArgumentType == typeof(Type))
1015                 return ((Type)converterAttribute.ConstructorArguments[0].Value).AssemblyQualifiedName;
1016             return null;
1017         }
1018
1019         internal MethodInfo GetImplicitConversionOperator(Type onType, Type fromType, Type toType)
1020         {
1021 #if NETSTANDARD1_0
1022             var mi = onType.GetRuntimeMethod("op_Implicit", new[] { fromType });
1023 #else
1024             var bindingFlags = BindingFlags.Public | BindingFlags.Static | BindingFlags.FlattenHierarchy;
1025             var mi = onType.GetMethod("op_Implicit", bindingFlags, null, new[] { fromType }, null);
1026 #endif
1027             if (mi == null) return null;
1028             if (!mi.IsSpecialName) return null;
1029             if (!mi.IsPublic) return null;
1030             if (!mi.IsStatic) return null;
1031             if (!toType.IsAssignableFrom(mi.ReturnType)) return null;
1032
1033             return mi;
1034         }
1035
1036         internal Animation(float durationSeconds) : this(NDalicPINVOKE.Animation_New(durationSeconds), true)
1037         {
1038             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1039
1040         }
1041
1042         internal Animation(Animation handle) : this(NDalicPINVOKE.new_Animation__SWIG_1(Animation.getCPtr(handle)), true)
1043         {
1044             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1045         }
1046
1047         internal Animation Assign(Animation rhs)
1048         {
1049             Animation ret = new Animation(NDalicPINVOKE.Animation_Assign(swigCPtr, Animation.getCPtr(rhs)), false);
1050             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1051             return ret;
1052         }
1053
1054         internal void SetDuration(float seconds)
1055         {
1056             NDalicPINVOKE.Animation_SetDuration(swigCPtr, seconds);
1057             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1058         }
1059
1060         internal float GetDuration()
1061         {
1062             float ret = NDalicPINVOKE.Animation_GetDuration(swigCPtr);
1063             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1064             return ret;
1065         }
1066
1067         internal void SetLooping(bool looping)
1068         {
1069             NDalicPINVOKE.Animation_SetLooping(swigCPtr, looping);
1070             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1071         }
1072
1073         internal void SetLoopCount(int count)
1074         {
1075             NDalicPINVOKE.Animation_SetLoopCount(swigCPtr, count);
1076             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1077         }
1078
1079         internal int GetLoopCount()
1080         {
1081             int ret = NDalicPINVOKE.Animation_GetLoopCount(swigCPtr);
1082             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1083             return ret;
1084         }
1085
1086         internal int GetCurrentLoop()
1087         {
1088             int ret = NDalicPINVOKE.Animation_GetCurrentLoop(swigCPtr);
1089             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1090             return ret;
1091         }
1092
1093         internal bool IsLooping()
1094         {
1095             bool ret = NDalicPINVOKE.Animation_IsLooping(swigCPtr);
1096             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1097             return ret;
1098         }
1099
1100         internal void SetEndAction(Animation.EndActions action)
1101         {
1102             NDalicPINVOKE.Animation_SetEndAction(swigCPtr, (int)action);
1103             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1104         }
1105
1106         internal Animation.EndActions GetEndAction()
1107         {
1108             Animation.EndActions ret = (Animation.EndActions)NDalicPINVOKE.Animation_GetEndAction(swigCPtr);
1109             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1110             return ret;
1111         }
1112
1113         internal void SetDisconnectAction(Animation.EndActions disconnectAction)
1114         {
1115             NDalicPINVOKE.Animation_SetDisconnectAction(swigCPtr, (int)disconnectAction);
1116             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1117         }
1118
1119         internal Animation.EndActions GetDisconnectAction()
1120         {
1121             Animation.EndActions ret = (Animation.EndActions)NDalicPINVOKE.Animation_GetDisconnectAction(swigCPtr);
1122             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1123             return ret;
1124         }
1125
1126         internal void SetDefaultAlphaFunction(AlphaFunction alpha)
1127         {
1128             NDalicPINVOKE.Animation_SetDefaultAlphaFunction(swigCPtr, AlphaFunction.getCPtr(alpha));
1129             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1130         }
1131
1132         internal AlphaFunction GetDefaultAlphaFunction()
1133         {
1134             AlphaFunction ret = new AlphaFunction(NDalicPINVOKE.Animation_GetDefaultAlphaFunction(swigCPtr), true);
1135             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1136             return ret;
1137         }
1138
1139         internal void SetCurrentProgress(float progress)
1140         {
1141             NDalicPINVOKE.Animation_SetCurrentProgress(swigCPtr, progress);
1142             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1143         }
1144
1145         internal float GetCurrentProgress()
1146         {
1147             float ret = NDalicPINVOKE.Animation_GetCurrentProgress(swigCPtr);
1148             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1149             return ret;
1150         }
1151
1152         internal void SetSpeedFactor(float factor)
1153         {
1154             NDalicPINVOKE.Animation_SetSpeedFactor(swigCPtr, factor);
1155             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1156         }
1157
1158         internal float GetSpeedFactor()
1159         {
1160             float ret = NDalicPINVOKE.Animation_GetSpeedFactor(swigCPtr);
1161             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1162             return ret;
1163         }
1164
1165         internal void SetPlayRange(Vector2 range)
1166         {
1167             NDalicPINVOKE.Animation_SetPlayRange(swigCPtr, Vector2.getCPtr(range));
1168             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1169         }
1170
1171         internal Vector2 GetPlayRange()
1172         {
1173             Vector2 ret = new Vector2(NDalicPINVOKE.Animation_GetPlayRange(swigCPtr), true);
1174             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1175             return ret;
1176         }
1177
1178         internal Animation.States GetState()
1179         {
1180             Animation.States ret = (Animation.States)NDalicPINVOKE.Animation_GetState(swigCPtr);
1181             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1182             return ret;
1183         }
1184
1185         internal AnimationSignal FinishedSignal()
1186         {
1187             AnimationSignal ret = new AnimationSignal(NDalicPINVOKE.Animation_FinishedSignal(swigCPtr), false);
1188             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1189             return ret;
1190         }
1191
1192         internal AnimationSignal ProgressReachedSignal()
1193         {
1194             AnimationSignal ret = new AnimationSignal(NDalicPINVOKE.Animation_ProgressReachedSignal(swigCPtr), false);
1195             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1196             return ret;
1197         }
1198
1199         internal void AnimateBy(Property target, PropertyValue relativeValue)
1200         {
1201             NDalicPINVOKE.Animation_AnimateBy__SWIG_0(swigCPtr, Property.getCPtr(target), PropertyValue.getCPtr(relativeValue));
1202             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1203         }
1204
1205         internal void AnimateBy(Property target, PropertyValue relativeValue, AlphaFunction alpha)
1206         {
1207             NDalicPINVOKE.Animation_AnimateBy__SWIG_1(swigCPtr, Property.getCPtr(target), PropertyValue.getCPtr(relativeValue), AlphaFunction.getCPtr(alpha));
1208             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1209         }
1210
1211         internal void AnimateBy(Property target, PropertyValue relativeValue, TimePeriod period)
1212         {
1213             NDalicPINVOKE.Animation_AnimateBy__SWIG_2(swigCPtr, Property.getCPtr(target), PropertyValue.getCPtr(relativeValue), TimePeriod.getCPtr(period));
1214             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1215         }
1216
1217         internal void AnimateBy(Property target, PropertyValue relativeValue, AlphaFunction alpha, TimePeriod period)
1218         {
1219             NDalicPINVOKE.Animation_AnimateBy__SWIG_3(swigCPtr, Property.getCPtr(target), PropertyValue.getCPtr(relativeValue), AlphaFunction.getCPtr(alpha), TimePeriod.getCPtr(period));
1220             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1221         }
1222
1223         internal void AnimateTo(Property target, PropertyValue destinationValue)
1224         {
1225             NDalicPINVOKE.Animation_AnimateTo__SWIG_0(swigCPtr, Property.getCPtr(target), PropertyValue.getCPtr(destinationValue));
1226             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1227         }
1228
1229         internal void AnimateTo(Property target, PropertyValue destinationValue, AlphaFunction alpha)
1230         {
1231             NDalicPINVOKE.Animation_AnimateTo__SWIG_1(swigCPtr, Property.getCPtr(target), PropertyValue.getCPtr(destinationValue), AlphaFunction.getCPtr(alpha));
1232             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1233         }
1234
1235         internal void AnimateTo(Property target, PropertyValue destinationValue, TimePeriod period)
1236         {
1237             NDalicPINVOKE.Animation_AnimateTo__SWIG_2(swigCPtr, Property.getCPtr(target), PropertyValue.getCPtr(destinationValue), TimePeriod.getCPtr(period));
1238             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1239         }
1240
1241         internal void AnimateTo(Property target, PropertyValue destinationValue, AlphaFunction alpha, TimePeriod period)
1242         {
1243             NDalicPINVOKE.Animation_AnimateTo__SWIG_3(swigCPtr, Property.getCPtr(target), PropertyValue.getCPtr(destinationValue), AlphaFunction.getCPtr(alpha), TimePeriod.getCPtr(period));
1244             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1245         }
1246
1247         internal void AnimateBetween(Property target, KeyFrames keyFrames)
1248         {
1249             NDalicPINVOKE.Animation_AnimateBetween__SWIG_0(swigCPtr, Property.getCPtr(target), KeyFrames.getCPtr(keyFrames));
1250             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1251         }
1252
1253         internal void AnimateBetween(Property target, KeyFrames keyFrames, Animation.Interpolation interpolation)
1254         {
1255             NDalicPINVOKE.Animation_AnimateBetween__SWIG_1(swigCPtr, Property.getCPtr(target), KeyFrames.getCPtr(keyFrames), (int)interpolation);
1256             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1257         }
1258
1259         internal void AnimateBetween(Property target, KeyFrames keyFrames, AlphaFunction alpha)
1260         {
1261             NDalicPINVOKE.Animation_AnimateBetween__SWIG_2(swigCPtr, Property.getCPtr(target), KeyFrames.getCPtr(keyFrames), AlphaFunction.getCPtr(alpha));
1262             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1263         }
1264
1265         internal void AnimateBetween(Property target, KeyFrames keyFrames, AlphaFunction alpha, Animation.Interpolation interpolation)
1266         {
1267             NDalicPINVOKE.Animation_AnimateBetween__SWIG_3(swigCPtr, Property.getCPtr(target), KeyFrames.getCPtr(keyFrames), AlphaFunction.getCPtr(alpha), (int)interpolation);
1268             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1269         }
1270
1271         internal void AnimateBetween(Property target, KeyFrames keyFrames, TimePeriod period)
1272         {
1273             NDalicPINVOKE.Animation_AnimateBetween__SWIG_4(swigCPtr, Property.getCPtr(target), KeyFrames.getCPtr(keyFrames), TimePeriod.getCPtr(period));
1274             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1275         }
1276
1277         internal void AnimateBetween(Property target, KeyFrames keyFrames, TimePeriod period, Animation.Interpolation interpolation)
1278         {
1279             NDalicPINVOKE.Animation_AnimateBetween__SWIG_5(swigCPtr, Property.getCPtr(target), KeyFrames.getCPtr(keyFrames), TimePeriod.getCPtr(period), (int)interpolation);
1280             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1281         }
1282
1283         internal void AnimateBetween(Property target, KeyFrames keyFrames, AlphaFunction alpha, TimePeriod period)
1284         {
1285             NDalicPINVOKE.Animation_AnimateBetween__SWIG_6(swigCPtr, Property.getCPtr(target), KeyFrames.getCPtr(keyFrames), AlphaFunction.getCPtr(alpha), TimePeriod.getCPtr(period));
1286             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1287         }
1288
1289         internal void AnimateBetween(Property target, KeyFrames keyFrames, AlphaFunction alpha, TimePeriod period, Animation.Interpolation interpolation)
1290         {
1291             NDalicPINVOKE.Animation_AnimateBetween__SWIG_7(swigCPtr, Property.getCPtr(target), KeyFrames.getCPtr(keyFrames), AlphaFunction.getCPtr(alpha), TimePeriod.getCPtr(period), (int)interpolation);
1292             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1293         }
1294
1295         internal void Animate(View view, Path path, Vector3 forward)
1296         {
1297             NDalicPINVOKE.Animation_Animate__SWIG_0(swigCPtr, View.getCPtr(view), Path.getCPtr(path), Vector3.getCPtr(forward));
1298             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1299         }
1300
1301         internal void Animate(View view, Path path, Vector3 forward, AlphaFunction alpha)
1302         {
1303             NDalicPINVOKE.Animation_Animate__SWIG_1(swigCPtr, View.getCPtr(view), Path.getCPtr(path), Vector3.getCPtr(forward), AlphaFunction.getCPtr(alpha));
1304             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1305         }
1306
1307         internal void Animate(View view, Path path, Vector3 forward, TimePeriod period)
1308         {
1309             NDalicPINVOKE.Animation_Animate__SWIG_2(swigCPtr, View.getCPtr(view), Path.getCPtr(path), Vector3.getCPtr(forward), TimePeriod.getCPtr(period));
1310             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1311         }
1312
1313         internal void Animate(View view, Path path, Vector3 forward, AlphaFunction alpha, TimePeriod period)
1314         {
1315             NDalicPINVOKE.Animation_Animate__SWIG_3(swigCPtr, View.getCPtr(view), Path.getCPtr(path), Vector3.getCPtr(forward), AlphaFunction.getCPtr(alpha), TimePeriod.getCPtr(period));
1316             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1317         }
1318
1319         internal void Show(View view, float delaySeconds)
1320         {
1321             NDalicPINVOKE.Animation_Show(swigCPtr, View.getCPtr(view), delaySeconds);
1322             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1323         }
1324
1325         internal void Hide(View view, float delaySeconds)
1326         {
1327             NDalicPINVOKE.Animation_Hide(swigCPtr, View.getCPtr(view), delaySeconds);
1328             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1329         }
1330
1331         /// <summary>
1332         /// To make animation instance be disposed.
1333         /// </summary>
1334         /// <since_tizen> 3 </since_tizen>
1335         protected override void Dispose(DisposeTypes type)
1336         {
1337             if (this != null)
1338             {
1339                 if (_animationFinishedEventCallback != null)
1340                 {
1341                     FinishedSignal().Disconnect(_finishedCallbackOfNative);
1342                 }
1343
1344                 if (_animationProgressReachedEventCallback != null)
1345                 {
1346
1347                     ProgressReachedSignal().Disconnect(_animationProgressReachedEventCallback);
1348                 }
1349             }
1350
1351             if(disposed)
1352             {
1353                 return;
1354             }
1355             if(type == DisposeTypes.Explicit)
1356             {
1357                 //Called by User
1358                 //Release your own managed resources here.
1359                 //You should release all of your own disposable objects here.
1360
1361             }
1362             else if(type == DisposeTypes.Implicit)
1363             {
1364
1365             }
1366
1367             if (this != null)
1368             {
1369                 this.Clear();
1370             }
1371
1372             //Release your own unmanaged resources here.
1373             //You should not access any managed member here except static instance.
1374             //because the execution order of Finalizes is non-deterministic.
1375
1376             if (swigCPtr.Handle != global::System.IntPtr.Zero)
1377             {
1378                 if (swigCMemOwn)
1379                 {
1380                     swigCMemOwn = false;
1381                     NDalicPINVOKE.delete_Animation(swigCPtr);
1382                 }
1383                 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
1384             }
1385
1386             base.Dispose(type);
1387         }
1388
1389         private void OnFinished(IntPtr data)
1390         {
1391             if (_animationFinishedEventHandler != null)
1392             {
1393                 //here we send all data to user event handlers
1394                 _animationFinishedEventHandler(this, null);
1395             }
1396         }
1397
1398         private void OnProgressReached(IntPtr data)
1399         {
1400             if (_animationProgressReachedEventHandler != null)
1401             {
1402                 //here we send all data to user event handlers
1403                 _animationProgressReachedEventHandler(this, null);
1404             }
1405         }
1406
1407         private float MilliSecondsToSeconds(int millisec)
1408         {
1409             return (float)millisec / 1000.0f;
1410         }
1411
1412         private int SecondsToMilliSeconds(float sec)
1413         {
1414             return (int)(sec * 1000);
1415         }
1416
1417     }
1418
1419 }