Merge remote-tracking branch 'origin/master' into tizen
[platform/core/csapi/tizenfx.git] / src / Tizen.NUI / src / public / Animation / Animation.cs
1 /*
2  * Copyright(c) 2021 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     using System;
21     using System.ComponentModel;
22     using System.Runtime.InteropServices;
23     using System.Collections.Generic;
24     using System.Linq;
25     using System.Reflection;
26     using System.Globalization;
27     using System.Diagnostics.CodeAnalysis;
28
29     using Tizen.NUI.BaseComponents;
30
31     /// <summary>
32     /// Animation can be used to animate the properties of any number of objects, typically view.<br />
33     /// If the "Finished" event is connected to a member function of an object, it must be disconnected before the object is destroyed.<br />
34     /// This is typically done in the object destructor, and requires either the animation handle to be stored.<br />
35     /// 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 />
36     /// If any of the individual calls to those functions exceeds the overall animation time (Duration), then the overall animation time is automatically extended.<br />
37     /// </summary>
38     /// <since_tizen> 3 </since_tizen>
39     public class Animation : BaseHandle
40     {
41         private static bool? disableAnimation = null;
42
43         private AnimationFinishedEventCallbackType animationFinishedEventCallback;
44         private System.IntPtr finishedCallbackOfNative;
45
46         private AnimationProgressReachedEventCallbackType animationProgressReachedEventCallback;
47
48         private string[] properties = null;
49         private string[] destValue = null;
50         private int[] startTime = null;
51         private int[] endTime = null;
52
53         private List<string> propertyList = null;
54         private List<string> destValueList = null;
55         private List<int> startTimeList = null;
56         private List<int> endTimeList = null;
57
58         /// <summary>
59         /// Creates an initialized animation.<br />
60         /// The animation will not loop.<br />
61         /// The default end action is "Cancel".<br />
62         /// The default alpha function is linear.<br />
63         /// </summary>
64         /// <remarks>DurationmSeconds must be greater than zero.</remarks>
65         /// <param name="durationMilliSeconds">The duration in milliseconds.</param>
66         /// <since_tizen> 3 </since_tizen>
67         public Animation(int durationMilliSeconds) : this(Interop.Animation.New((float)durationMilliSeconds / 1000.0f), true)
68         {
69             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
70         }
71
72         internal Animation(global::System.IntPtr cPtr, bool cMemoryOwn) : base(cPtr, cMemoryOwn)
73         {
74             animationFinishedEventCallback = OnFinished;
75             finishedCallbackOfNative = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate<System.Delegate>(animationFinishedEventCallback);
76         }
77
78         [UnmanagedFunctionPointer(CallingConvention.StdCall)]
79         private delegate void AnimationFinishedEventCallbackType(IntPtr data);
80
81         [UnmanagedFunctionPointer(CallingConvention.StdCall)]
82         private delegate void AnimationProgressReachedEventCallbackType(IntPtr data);
83
84         private event EventHandler animationFinishedEventHandler;
85
86         /// <summary>
87         /// Event for the finished signal which can be used to subscribe or unsubscribe the event handler.<br />
88         /// The finished signal is emitted when an animation's animations have finished.<br />
89         /// </summary>
90         /// <since_tizen> 3 </since_tizen>
91         public event EventHandler Finished
92         {
93             add
94             {
95                 if (animationFinishedEventHandler == null && disposed == false)
96                 {
97                     AnimationSignal finishedSignal = FinishedSignal();
98                     finishedSignal.Connect(finishedCallbackOfNative);
99                     finishedSignal.Dispose();
100                 }
101                 animationFinishedEventHandler += value;
102             }
103             remove
104             {
105                 animationFinishedEventHandler -= value;
106
107                 AnimationSignal finishedSignal = FinishedSignal();
108                 if (animationFinishedEventHandler == null && finishedSignal.Empty() == false)
109                 {
110                     finishedSignal.Disconnect(finishedCallbackOfNative);
111                 }
112                 finishedSignal.Dispose();
113             }
114         }
115
116         private event EventHandler animationProgressReachedEventHandler;
117
118         /// <summary>
119         /// Event for the ProgressReached signal, which can be used to subscribe or unsubscribe the event handler.<br />
120         /// The ProgressReached signal is emitted when the animation has reached a given progress percentage, this is set in the api SetProgressNotification.<br />
121         /// </summary>
122         /// <remark>
123         /// This value only be applied if animation state is Stopped.
124         /// </remark>
125         /// <since_tizen> 3 </since_tizen>
126         public event EventHandler ProgressReached
127         {
128             add
129             {
130                 if (animationProgressReachedEventHandler == null)
131                 {
132                     animationProgressReachedEventCallback = OnProgressReached;
133                     AnimationSignal progressReachedSignal = ProgressReachedSignal();
134                     progressReachedSignal?.Connect(animationProgressReachedEventCallback);
135                     progressReachedSignal?.Dispose();
136                 }
137
138                 animationProgressReachedEventHandler += value;
139             }
140             remove
141             {
142                 animationProgressReachedEventHandler -= value;
143
144                 AnimationSignal progressReachedSignal = ProgressReachedSignal();
145                 if (animationProgressReachedEventHandler == null && progressReachedSignal?.Empty() == false)
146                 {
147                     progressReachedSignal?.Disconnect(animationProgressReachedEventCallback);
148                 }
149                 progressReachedSignal.Dispose();
150             }
151         }
152
153         /// <summary>
154         /// Enumeration for what to do when the animation ends, stopped, or destroyed.
155         /// </summary>
156         /// <since_tizen> 3 </since_tizen>
157         [System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1717:Only FlagsAttribute enums should have plural names")]
158         public enum EndActions
159         {
160             /// <summary>
161             /// When the animation ends, the animated property values are saved.
162             /// </summary>
163             Cancel,
164             /// <summary>
165             /// When the animation ends, the animated property values are forgotten.
166             /// </summary>
167             Discard,
168             /// <summary>
169             /// If the animation is stopped, the animated property values are saved as if the animation had run to completion, otherwise behaves like cancel.
170             /// </summary>
171             StopFinal
172         }
173
174         /// <summary>
175         /// Enumeration for what interpolation method to use on key-frame animations.
176         /// </summary>
177         /// <since_tizen> 3 </since_tizen>
178         public enum Interpolation
179         {
180             /// <summary>
181             /// Values in between key frames are interpolated using a linear polynomial. (Default)
182             /// </summary>
183             Linear,
184             /// <summary>
185             /// Values in between key frames are interpolated using a cubic polynomial.
186             /// </summary>
187             Cubic
188         }
189
190         /// <summary>
191         /// Enumeration for what state the animation is in.
192         /// </summary>
193         /// <remarks>Calling Reset() on this class will not reset the animation. It will call the BaseHandle.Reset() which drops the object handle.</remarks>
194         /// <since_tizen> 3 </since_tizen>
195         [System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1717:Only FlagsAttribute enums should have plural names")]
196         public enum States
197         {
198             /// <summary>
199             /// The animation has stopped.
200             /// </summary>
201             Stopped,
202             /// <summary>
203             /// The animation is playing.
204             /// </summary>
205             Playing,
206             /// <summary>
207             /// The animation is paused.
208             /// </summary>
209             Paused
210         }
211
212         /// <summary>
213         /// Enumeration for what looping mode is in.
214         /// </summary>
215         /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
216         [EditorBrowsable(EditorBrowsableState.Never)]
217         [System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1717:Only FlagsAttribute enums should have plural names")]
218         public enum LoopingModes
219         {
220             /// <summary>
221             /// When the animation arrives at the end in looping mode, the animation restarts from the beginning. (Default)
222             /// </summary>
223             /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
224             [EditorBrowsable(EditorBrowsableState.Never)]
225             Restart,
226             /// <summary>
227             /// When the animation arrives at the end in looping mode, the animation reverses direction and runs backwards again.
228             /// </summary>
229             /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
230             [EditorBrowsable(EditorBrowsableState.Never)]
231             AutoReverse
232         }
233
234         /// <summary>
235         /// Gets or sets the duration in milliseconds of the animation.
236         /// This duration is applied to the animations are added after the Duration is set.
237         /// </summary>
238         /// <example>
239         /// <code>
240         /// animation.AnimateTo(actor, "position", destination);
241         /// animation.Duration = 500; // This duration 500 is only applied to the size animation.
242         /// animation.AnimateTo(actor, "size", size);
243         /// </code>
244         /// </example>
245         /// <since_tizen> 3 </since_tizen>
246         public int Duration
247         {
248             set
249             {
250                 SetDuration(MilliSecondsToSeconds(value));
251             }
252             get
253             {
254                 return SecondsToMilliSeconds(GetDuration());
255             }
256         }
257
258         /// <summary>
259         /// Gets or sets the default alpha function for the animation.
260         /// This DefaultAlphaFunction is only applied to the animations are added after the DefaultAlphaFunction is set.
261         /// </summary>
262         /// <example>
263         /// <code>
264         /// animation.AnimateTo(actor, "position", destination);
265         /// animation.DefaultAlphaFunction = newAlphaFunction; // This newAlphaFunction is applied only for the size animation.
266         /// animation.AnimateTo(actor, "size", size);
267         /// </code>
268         /// </example>
269         /// <since_tizen> 3 </since_tizen>
270         public AlphaFunction DefaultAlphaFunction
271         {
272             set
273             {
274                 SetDefaultAlphaFunction(value);
275             }
276             get
277             {
278                 AlphaFunction ret = GetDefaultAlphaFunction();
279                 return ret;
280             }
281         }
282
283         /// <summary>
284         /// Queries the state of the animation.
285         /// </summary>
286         /// <since_tizen> 3 </since_tizen>
287         public States State
288         {
289             get
290             {
291                 return GetState();
292             }
293         }
294
295         /// <summary>
296         /// Set: Enables looping for a specified number of repeats. A zero is the same as Looping = true; i.e., repeat forever.<br />
297         /// This property resets the looping value and should not be used with the Looping property.<br />
298         /// Setting this parameter does not cause the animation to Play().<br />
299         /// Get: Gets the loop count. A zero is the same as Looping = true; i.e., repeat forever.<br />
300         /// The loop count is initially 1 for play once.<br />
301         /// </summary>
302         /// <since_tizen> 3 </since_tizen>
303         public int LoopCount
304         {
305             set
306             {
307                 SetLoopCount(value);
308             }
309             get
310             {
311                 int ret = GetLoopCount();
312                 return ret;
313             }
314         }
315
316         /// <summary>
317         /// Gets or sets the status of whether the animation will loop.<br />
318         /// This property resets the loop count and should not be used with the LoopCount property.<br />
319         /// Setting this parameter does not cause the animation to Play().<br />
320         /// </summary>
321         /// <since_tizen> 3 </since_tizen>
322         public bool Looping
323         {
324             set
325             {
326                 SetLooping(value);
327             }
328             get
329             {
330                 bool ret = IsLooping();
331                 return ret;
332             }
333         }
334
335
336         /// <summary>
337         /// Gets or sets the end action of the animation.<br />
338         /// This action is performed when the animation ends or if it is stopped.<br />
339         /// The default end action is EndActions.Cancel.<br />
340         /// </summary>
341         /// <remark>
342         /// Change the action value from EndActions.Discard, or to EndActions.Discard during animation is playing / paused will not works well.
343         /// </remark>
344         /// <since_tizen> 3 </since_tizen>
345         public EndActions EndAction
346         {
347             set
348             {
349                 SetEndAction(value);
350             }
351             get
352             {
353                 return GetEndAction();
354             }
355         }
356
357         /// <summary>
358         /// Gets the current loop count.<br />
359         /// A value 0 indicating the current loop count when looping.<br />
360         /// </summary>
361         /// <since_tizen> 3 </since_tizen>
362         public int CurrentLoop
363         {
364             get
365             {
366                 return GetCurrentLoop();
367             }
368         }
369
370         /// <summary>
371         /// Gets or sets the disconnect action.<br />
372         /// If any of the animated property owners are disconnected from the stage while the animation is being played, then this action is performed.<br />
373         /// The default action is EndActions.StopFinal.<br />
374         /// </summary>
375         /// <since_tizen> 3 </since_tizen>
376         public EndActions DisconnectAction
377         {
378             set
379             {
380                 Interop.Animation.SetDisconnectAction(SwigCPtr, (int)value);
381                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
382             }
383             get
384             {
385                 Animation.EndActions ret = (Animation.EndActions)Interop.Animation.GetDisconnectAction(SwigCPtr);
386                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve());
387                 return ret;
388             }
389         }
390
391
392         /// <summary>
393         /// Gets or sets the progress of the animation.<br />
394         /// The animation will play (or continue playing) from this point.<br />
395         /// The progress must be in the 0-1 interval or in the play range interval if defined<br />
396         /// otherwise, it will be ignored.<br />
397         /// </summary>
398         /// <since_tizen> 3 </since_tizen>
399         public float CurrentProgress
400         {
401             set
402             {
403                 Interop.Animation.SetCurrentProgress(SwigCPtr, value);
404                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
405             }
406             get
407             {
408                 float ret = Interop.Animation.GetCurrentProgress(SwigCPtr);
409                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve());
410                 return ret;
411             }
412         }
413
414         /// <summary>
415         /// Gets or sets specifications of a speed factor for the animation.<br />
416         /// The speed factor is a multiplier of the normal velocity of the animation.<br />
417         /// Values between [0, 1] will slow down the animation and values above one will speed up the animation.<br />
418         /// It is also possible to specify a negative multiplier to play the animation in reverse.<br />
419         /// </summary>
420         /// <since_tizen> 3 </since_tizen>
421         public float SpeedFactor
422         {
423             set
424             {
425                 Interop.Animation.SetSpeedFactor(SwigCPtr, value);
426                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
427             }
428             get
429             {
430                 float ret = Interop.Animation.GetSpeedFactor(SwigCPtr);
431                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve());
432                 return ret;
433             }
434         }
435
436         /// <summary>
437         /// Gets or sets the playing range.<br />
438         /// Animation will play between the values specified. Both values (range.x and range.y ) should be between 0-1,
439         /// otherwise they will be ignored. If the range provided is not in proper order (minimum, maximum ), it will be reordered.<br />
440         /// </summary>
441         /// <since_tizen> 3 </since_tizen>
442         public RelativeVector2 PlayRange
443         {
444             set
445             {
446                 Interop.Animation.SetPlayRange(SwigCPtr, Vector2.getCPtr(value));
447                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
448             }
449             get
450             {
451                 Vector2 ret = new Vector2(Interop.Animation.GetPlayRange(SwigCPtr), true);
452                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve());
453                 return ret;
454             }
455         }
456
457
458         /// <summary>
459         /// Gets or sets the progress notification marker which triggers the ProgressReachedSignal.<br />
460         /// Percentage of animation progress should be greater than 0 and less than 1, for example, 0.3 for 30%<br />
461         /// One notification can be set on each animation.
462         /// </summary>
463         /// <remark>
464         /// This value only be applied if animation state is Stopped.
465         /// </remark>
466         /// <since_tizen> 3 </since_tizen>
467         public float ProgressNotification
468         {
469             set
470             {
471                 Interop.Animation.SetProgressNotification(SwigCPtr, value);
472                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
473             }
474             get
475             {
476                 float ret = Interop.Animation.GetProgressNotification(SwigCPtr);
477                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve());
478                 return ret;
479             }
480         }
481
482         /// <summary>
483         /// Enumeration for what looping mode is in.
484         /// </summary>
485         /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
486         [EditorBrowsable(EditorBrowsableState.Never)]
487         public LoopingModes LoopingMode
488         {
489             set
490             {
491                 Interop.Animation.SetLoopingMode(SwigCPtr, (int)value);
492                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
493             }
494             get
495             {
496                 Animation.LoopingModes ret = (Animation.LoopingModes)Interop.Animation.GetLoopingMode(SwigCPtr);
497                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve());
498                 return ret;
499             }
500         }
501
502         /// <summary>
503         /// Gets or sets the properties of the animation.
504         /// </summary>
505         //ToDo : will raise deprecated-ACR, [Obsolete("Deprecated in API9, will be removed in API11, Use PropertyList instead")]
506         [SuppressMessage("Microsoft.Performance", "CA1819:PropertiesShouldNotReturnArrays", Justification = "This API will be deprecated, so suppressing the warning for now")]
507         public string[] Properties
508         {
509             get
510             {
511                 return properties;
512             }
513             set
514             {
515                 properties = value;
516             }
517         }
518
519         /// <summary>
520         /// Gets or sets the destination value for each property of the animation.
521         /// </summary>
522         //ToDo : will raise deprecated-ACR, [Obsolete("Deprecated in API9, will be removed in API11, Use DestValueList instead")]
523         [SuppressMessage("Microsoft.Performance", "CA1819:PropertiesShouldNotReturnArrays", Justification = "This API will be deprecated, so suppressing the warning for now")]
524         public string[] DestValue
525         {
526             get
527             {
528                 return destValue;
529             }
530             set
531             {
532                 destValue = value;
533             }
534         }
535
536         /// <summary>
537         /// Gets or sets the start time for each property of the animation.
538         /// </summary>
539         //ToDo : will raise deprecated-ACR, [Obsolete("Deprecated in API9, will be removed in API11, Use StartTimeList instead")]
540         [SuppressMessage("Microsoft.Performance", "CA1819:PropertiesShouldNotReturnArrays", Justification = "This API will be deprecated, so suppressing the warning for now")]
541         public int[] StartTime
542         {
543             get
544             {
545                 return startTime;
546             }
547             set
548             {
549                 startTime = value;
550             }
551         }
552
553         /// <summary>
554         /// Gets or sets the end time for each property of the animation.
555         /// </summary>
556         //ToDo : will raise deprecated-ACR, [Obsolete("Deprecated in API9, will be removed in API11, Use EndTimeList instead")]
557         [SuppressMessage("Microsoft.Performance", "CA1819:PropertiesShouldNotReturnArrays", Justification = "This API will be deprecated, so suppressing the warning for now")]
558         public int[] EndTime
559         {
560             get
561             {
562                 return endTime;
563             }
564             set
565             {
566                 endTime = value;
567             }
568         }
569
570         /// <summary>
571         /// Get the list of the properties of the animation.
572         /// </summary>
573         [EditorBrowsable(EditorBrowsableState.Never)]
574         public IList<string> PropertyList
575         {
576             get
577             {
578                 if (null == propertyList)
579                 {
580                     propertyList = new List<string>();
581                 }
582
583                 return propertyList;
584             }
585         }
586
587         /// <summary>
588         /// Get the list of the destination value for each property of the animation.
589         /// </summary>
590         [EditorBrowsable(EditorBrowsableState.Never)]
591         public IList<string> DestValueList
592         {
593             get
594             {
595                 if (null == destValueList)
596                 {
597                     destValueList = new List<string>();
598                 }
599
600                 return destValueList;
601             }
602         }
603
604         /// <summary>
605         /// Get the list of the start time for each property of the animation.
606         /// </summary>
607         [EditorBrowsable(EditorBrowsableState.Never)]
608         public IList<int> StartTimeList
609         {
610             get
611             {
612                 if (null == startTimeList)
613                 {
614                     startTimeList = new List<int>();
615                 }
616
617                 return startTimeList;
618             }
619         }
620
621         /// <summary>
622         /// Get the list of end time for each property of the animation.
623         /// </summary>
624         [EditorBrowsable(EditorBrowsableState.Never)]
625         public IList<int> EndTimeList
626         {
627             get
628             {
629                 if (null == endTimeList)
630                 {
631                     endTimeList = new List<int>();
632                 }
633
634                 return endTimeList;
635             }
636         }
637
638         private bool DisableAnimation
639         {
640             get
641             {
642                 if (disableAnimation.HasValue == false)
643                 {
644                     string type = Environment.GetEnvironmentVariable("PlatformSmartType");
645                     if (type == "Entry")
646                         disableAnimation = true;
647                     else
648                         disableAnimation = false;
649                 }
650                 return disableAnimation.Value;
651             }
652         }
653
654         /// <summary>
655         /// Downcasts a handle to animation handle.<br />
656         /// If handle points to an animation object, the downcast produces a valid handle.<br />
657         /// If not, the returned handle is left uninitialized.<br />
658         /// </summary>
659         /// <param name="handle">Handle to an object.</param>
660         /// <returns>Handle to an animation object or an uninitialized handle.</returns>
661         /// <exception cref="ArgumentNullException"> Thrown when handle is null. </exception>
662         internal static Animation DownCast(BaseHandle handle)
663         {
664             if (handle == null)
665             {
666                 throw new ArgumentNullException(nameof(handle));
667             }
668             Animation ret = Registry.GetManagedBaseHandleFromNativePtr(handle) as Animation;
669             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
670             return ret;
671         }
672
673         /// <summary>
674         /// Stops the animation. It will change this animation's EndAction property.
675         /// </summary>
676         /// <remark>
677         /// Change the value from EndActions.Discard, or to EndActions.Discard during animation is playing / paused will not works well.<br />
678         /// If you want to stop by EndActions.Discard, EndAction property also should be EndActions.Discard before Play API called.
679         /// </remark>
680         /// <param name="action">The end action can be set.</param>
681         /// <since_tizen> 3 </since_tizen>
682         public void Stop(EndActions action)
683         {
684             SetEndAction(action);
685             Interop.Animation.Stop(SwigCPtr);
686             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
687         }
688
689         /// <summary>
690         /// Animates a property value by a relative amount.<br />
691         /// </summary>
692         /// <param name="target">The target animatable object to animate.</param>
693         /// <param name="property">The target property to animate.</param>
694         /// <param name="relativeValue">The property value will change by this amount.</param>
695         /// <param name="alphaFunction">The alpha function to apply.</param>
696         /// <exception cref="ArgumentNullException"> Thrown when target or property or relativeValue is null. </exception>
697         /// <exception cref="ArgumentException"> Thrown when it failed to find a property from given string or the given relativeValue is invalid format. </exception>
698         /// This will not be public opened.
699         [EditorBrowsable(EditorBrowsableState.Never)]
700         public void AnimateBy(Animatable target, string property, object relativeValue, AlphaFunction alphaFunction = null)
701         {
702             if (target == null)
703             {
704                 throw new ArgumentNullException(nameof(target));
705             }
706             if (property == null)
707             {
708                 throw new ArgumentNullException(nameof(property));
709             }
710             if (relativeValue == null)
711             {
712                 throw new ArgumentNullException(nameof(relativeValue));
713             }
714
715             using (var result = PropertyHelper.Search(target, property))
716             {
717                 if (result == null)
718                 {
719                     throw new ArgumentException("string property is invalid");
720                 }
721
722                 var current = result;
723                 while (current != null)
724                 {
725
726                     var targetValueIntPtr = current.RefineValueIntPtr(relativeValue);
727                     if (targetValueIntPtr == global::System.IntPtr.Zero)
728                     {
729                         throw new ArgumentException("Invalid " + nameof(relativeValue));
730                     }
731                     AnimateByIntPtr(current.Property, targetValueIntPtr, alphaFunction);
732                     Interop.PropertyValue.DeletePropertyValueIntPtr(targetValueIntPtr);
733                     current = current.NextResult;
734                 }
735             }
736         }
737
738         /// <summary>
739         /// Animates a property value by a relative amount.<br />
740         /// </summary>
741         /// <param name="target">The target animatable object to animate.</param>
742         /// <param name="property">The target property to animate.</param>
743         /// <param name="relativeValue">The property value will change by this amount.</param>
744         /// <param name="startTime">The start time of the animation.</param>
745         /// <param name="endTime">The end time of the animation.</param>
746         /// <param name="alphaFunction">The alpha function to apply.</param>
747         /// <exception cref="ArgumentNullException"> Thrown when target or property or relativeValue is null. </exception>
748         /// <exception cref="ArgumentException"> Thrown when it failed to find a property from given string or the given relativeValue is invalid format. </exception>
749         /// This will not be public opened.
750         [EditorBrowsable(EditorBrowsableState.Never)]
751         public void AnimateBy(Animatable target, string property, object relativeValue, int startTime, int endTime, AlphaFunction alphaFunction = null)
752         {
753             if (target == null)
754             {
755                 throw new ArgumentNullException(nameof(target));
756             }
757             if (property == null)
758             {
759                 throw new ArgumentNullException(nameof(property));
760             }
761             if (relativeValue == null)
762             {
763                 throw new ArgumentNullException(nameof(relativeValue));
764             }
765
766             using (var result = PropertyHelper.Search(target, property))
767             {
768                 if (result == null)
769                 {
770                     throw new ArgumentException("string property is invalid");
771                 }
772
773                 var current = result;
774                 using (var time = new TimePeriod(startTime, endTime - startTime))
775                     while (current != null)
776                     {
777
778                         var targetValueIntPtr = current.RefineValueIntPtr(relativeValue);
779                         if (targetValueIntPtr == global::System.IntPtr.Zero)
780                         {
781                             throw new ArgumentException("Invalid " + nameof(relativeValue));
782                         }
783                         AnimateByIntPtr(current.Property, targetValueIntPtr, alphaFunction, time);
784                         Interop.PropertyValue.DeletePropertyValueIntPtr(targetValueIntPtr);
785                         current = current.NextResult;
786                     }
787             }
788         }
789
790         /// <summary>
791         /// Animates a property value by a relative amount.<br />
792         /// </summary>
793         /// <param name="target">The target object to animate.</param>
794         /// <param name="property">The target property to animate.</param>
795         /// <param name="relativeValue">The property value will change by this amount.</param>
796         /// <param name="alphaFunction">The alpha function to apply.</param>
797         /// <exception cref="ArgumentNullException"> Thrown when target or property or relativeValue is null. </exception>
798         /// <exception cref="ArgumentException"> Thrown when it failed to find a property from given string or the given relativeValue is invalid format. </exception>
799         /// <since_tizen> 3 </since_tizen>
800         public void AnimateBy(View target, string property, object relativeValue, AlphaFunction alphaFunction = null)
801         {
802             AnimateBy(target as Animatable, property, relativeValue, alphaFunction);
803         }
804
805         /// <summary>
806         /// Animates a property value by a relative amount.<br />
807         /// </summary>
808         /// <param name="target">The target object to animate.</param>
809         /// <param name="property">The target property to animate.</param>
810         /// <param name="relativeValue">The property value will change by this amount.</param>
811         /// <param name="startTime">The start time of the animation.</param>
812         /// <param name="endTime">The end time of the animation.</param>
813         /// <param name="alphaFunction">The alpha function to apply.</param>
814         /// <exception cref="ArgumentNullException"> Thrown when target or property or relativeValue is null. </exception>
815         /// <exception cref="ArgumentException"> Thrown when it failed to find a property from given string or the given relativeValue is invalid format. </exception>
816         /// <since_tizen> 3 </since_tizen>
817         public void AnimateBy(View target, string property, object relativeValue, int startTime, int endTime, AlphaFunction alphaFunction = null)
818         {
819             AnimateBy(target as Animatable, property, relativeValue, startTime, endTime, alphaFunction);
820         }
821
822         /// <summary>
823         /// Animates a property to a destination value.<br />
824         /// </summary>
825         /// <param name="target">The target animatable object to animate.</param>
826         /// <param name="property">The target property to animate.</param>
827         /// <param name="destinationValue">The destination value.</param>
828         /// <param name="alphaFunction">The alpha function to apply.</param>
829         /// <exception cref="ArgumentNullException"> Thrown when target or property or destinationValue is null. </exception>
830         /// <exception cref="ArgumentException"> Thrown when it failed to find a property from given string or the given destinationValue is invalid format. </exception>
831         /// This will not be public opened.
832         [EditorBrowsable(EditorBrowsableState.Never)]
833         public void AnimateTo(Animatable target, string property, object destinationValue, AlphaFunction alphaFunction = null)
834         {
835             if (target == null)
836             {
837                 throw new ArgumentNullException(nameof(target));
838             }
839             if (property == null)
840             {
841                 throw new ArgumentNullException(nameof(property));
842             }
843             if (destinationValue == null)
844             {
845                 throw new ArgumentNullException(nameof(destinationValue));
846             }
847
848             using (var result = PropertyHelper.Search(target, property))
849             {
850                 if (result == null)
851                 {
852                     throw new ArgumentException("string property is invalid");
853                 }
854
855                 var current = result;
856                 while (current != null)
857                 {
858
859                     var targetValueIntPtr = current.RefineValueIntPtr(destinationValue);
860                     if (targetValueIntPtr == global::System.IntPtr.Zero)
861                     {
862                         throw new ArgumentException("Invalid " + nameof(destinationValue));
863                     }
864                     AnimateToIntPtr(current.Property, targetValueIntPtr, alphaFunction);
865                     Interop.PropertyValue.DeletePropertyValueIntPtr(targetValueIntPtr);
866                     current = current.NextResult;
867                 }
868             }
869         }
870
871         /// <summary>
872         /// Animates a property to a destination value.<br />
873         /// </summary>
874         /// <param name="target">The target animatable object to animate.</param>
875         /// <param name="property">The target property to animate.</param>
876         /// <param name="destinationValue">The destination value.</param>
877         /// <param name="startTime">The start time of the animation.</param>
878         /// <param name="endTime">The end time of the animation.</param>
879         /// <param name="alphaFunction">The alpha function to apply.</param>
880         /// <exception cref="ArgumentNullException"> Thrown when target or property or destinationValue is null. </exception>
881         /// <exception cref="ArgumentException"> Thrown when it failed to find a property from given string or the given destinationValue is invalid format. </exception>
882         /// This will not be public opened.
883         [EditorBrowsable(EditorBrowsableState.Never)]
884         public void AnimateTo(Animatable target, string property, object destinationValue, int startTime, int endTime, AlphaFunction alphaFunction = null)
885         {
886             if (target == null)
887             {
888                 throw new ArgumentNullException(nameof(target));
889             }
890             if (property == null)
891             {
892                 throw new ArgumentNullException(nameof(property));
893             }
894             if (destinationValue == null)
895             {
896                 throw new ArgumentNullException(nameof(destinationValue));
897             }
898
899             using (var result = PropertyHelper.Search(target, property))
900             {
901                 if (result == null)
902                 {
903                     throw new ArgumentException("string property is invalid");
904                 }
905
906                 var current = result;
907                 using (var time = new TimePeriod(startTime, endTime - startTime))
908                     while (current != null)
909                     {
910 #if NUI_ANIMATION_PROPERTY_CHANGE_1
911                         var targetValueIntPtr = current.RefineValueIntPtr(destinationValue);
912                         if (targetValueIntPtr == global::System.IntPtr.Zero)
913                         {
914                             throw new ArgumentException("Invalid " + nameof(destinationValue));
915                         }
916                         AnimateToIntPtr(current.Property, targetValueIntPtr, alphaFunction, time);
917                         Interop.PropertyValue.DeletePropertyValueIntPtr(targetValueIntPtr);
918 #else
919                         var targetValue = current.RefineValue(destinationValue) ?? throw new ArgumentException("Invalid " + nameof(destinationValue));
920                         AnimateTo(current.Property, targetValue, alphaFunction, time);
921                         targetValue.Dispose();
922 #endif
923                         current = current.NextResult;
924                     }
925             }
926         }
927
928         /// <summary>
929         /// Animates a property to a destination value.<br />
930         /// </summary>
931         /// <param name="target">The target object to animate.</param>
932         /// <param name="property">The target property to animate.</param>
933         /// <param name="destinationValue">The destination value.</param>
934         /// <param name="alphaFunction">The alpha function to apply.</param>
935         /// <exception cref="ArgumentNullException"> Thrown when target or property or destinationValue is null. </exception>
936         /// <exception cref="ArgumentException"> Thrown when it failed to find a property from given string or the given destinationValue is invalid format. </exception>
937         /// <since_tizen> 3 </since_tizen>
938         public void AnimateTo(View target, string property, object destinationValue, AlphaFunction alphaFunction = null)
939         {
940             AnimateTo(target as Animatable, property, destinationValue, alphaFunction);
941         }
942
943         /// <summary>
944         /// Animates a property to a destination value.<br />
945         /// </summary>
946         /// <param name="target">The target object to animate.</param>
947         /// <param name="property">The target property to animate.</param>
948         /// <param name="destinationValue">The destination value.</param>
949         /// <param name="startTime">The start time of the animation.</param>
950         /// <param name="endTime">The end time of the animation.</param>
951         /// <param name="alphaFunction">The alpha function to apply.</param>
952         /// <exception cref="ArgumentNullException"> Thrown when target or property or destinationValue is null. </exception>
953         /// <exception cref="ArgumentException"> Thrown when it failed to find a property from given string or the given destinationValue is invalid format. </exception>
954         /// <since_tizen> 3 </since_tizen>
955         public void AnimateTo(View target, string property, object destinationValue, int startTime, int endTime, AlphaFunction alphaFunction = null)
956         {
957             AnimateTo(target as Animatable, property, destinationValue, startTime, endTime, alphaFunction);
958         }
959
960         /// <summary>
961         /// Animates one or more properties to a destination value.<br />
962         /// </summary>
963         /// <param name="target">The target object to animate.</param>
964         /// <exception cref="ArgumentNullException"> Thrown when target is null. </exception>
965         public void PlayAnimateTo(View target)
966         {
967             if (target == null)
968             {
969                 throw new ArgumentNullException(nameof(target));
970             }
971
972             Clear();
973
974             if (null != propertyList && null != destValueList && null != startTimeList && null != endTimeList)
975             {
976                 if (propertyList.Count == destValueList.Count
977                     &&
978                     startTimeList.Count == endTimeList.Count
979                     &&
980                     propertyList.Count == startTimeList.Count)
981                 {
982                     int count = propertyList.Count;
983                     for (int index = 0; index < count; index++)
984                     {
985                         var elementType = target.GetType();
986                         PropertyInfo propertyInfo = elementType.GetProperties().FirstOrDefault(fi => fi.Name == propertyList[index]);
987
988                         if (propertyInfo != null)
989                         {
990                             object destinationValue = ConvertTo(destValueList[index], propertyInfo.PropertyType);
991
992                             if (destinationValue != null)
993                             {
994                                 AnimateTo(target, propertyList[index], destinationValue, startTimeList[index], endTimeList[index]);
995                             }
996                         }
997                     }
998                     Play();
999                 }
1000             }
1001             else
1002             {
1003                 if (properties.Length == destValue.Length && startTime.Length == endTime.Length && properties.Length == startTime.Length)
1004                 {
1005                     int length = properties.Length;
1006                     for (int index = 0; index < length; index++)
1007                     {
1008                         //object destinationValue = _destValue[index];
1009                         var elementType = target.GetType();
1010                         PropertyInfo propertyInfo = elementType.GetProperties().FirstOrDefault(fi => fi.Name == properties[index]);
1011                         //var propertyInfo = elementType.GetRuntimeProperties().FirstOrDefault(p => p.Name == localName);
1012                         if (propertyInfo != null)
1013                         {
1014                             object destinationValue = ConvertTo(destValue[index], propertyInfo.PropertyType);
1015
1016                             if (destinationValue != null)
1017                             {
1018                                 AnimateTo(target, properties[index], destinationValue, startTime[index], endTime[index]);
1019                             }
1020                         }
1021                     }
1022                     Play();
1023                 }
1024             }
1025         }
1026
1027         /// <summary>
1028         /// Animates a property between keyframes.
1029         /// </summary>
1030         /// <param name="target">The target animatable object to animate.</param>
1031         /// <param name="property">The target property to animate.</param>
1032         /// <param name="keyFrames">The set of time or value pairs between which to animate.</param>
1033         /// <param name="interpolation">The method used to interpolate between values.</param>
1034         /// <param name="alphaFunction">The alpha function to apply.</param>
1035         /// <exception cref="ArgumentNullException"> Thrown when target or property or keyFrames is null. </exception>
1036         /// <exception cref="ArgumentException"> Thrown when it failed to find a property from given string or the given keyFrames has invalid value. </exception>
1037         /// This will not be public opened.
1038         [EditorBrowsable(EditorBrowsableState.Never)]
1039         public void AnimateBetween(Animatable target, string property, KeyFrames keyFrames, Interpolation interpolation = Interpolation.Linear, AlphaFunction alphaFunction = null)
1040         {
1041             if (target == null)
1042             {
1043                 throw new ArgumentNullException(nameof(target));
1044             }
1045             if (property == null)
1046             {
1047                 throw new ArgumentNullException(nameof(property));
1048             }
1049             if (keyFrames == null)
1050             {
1051                 throw new ArgumentNullException(nameof(keyFrames));
1052             }
1053
1054             using (var result = PropertyHelper.Search(target, property))
1055             {
1056                 if (result == null)
1057                 {
1058                     throw new ArgumentException("string property is invalid");
1059                 }
1060
1061                 var current = result;
1062                 while (current != null)
1063                 {
1064                     // NOTE Do not dispose keyFrames object returned by GetRefinedKeyFrames() here.
1065                     AnimateBetween(current.Property, current.RefineKeyFrames(keyFrames) ?? throw new ArgumentException("Invalid " + nameof(keyFrames)), alphaFunction, interpolation);
1066                     current = current.NextResult;
1067                 }
1068             }
1069         }
1070
1071         /// <summary>
1072         /// Animates a property between keyframes.
1073         /// </summary>
1074         /// <param name="target">The target animatable object to animate</param>
1075         /// <param name="property">The target property to animate</param>
1076         /// <param name="keyFrames">The set of time/value pairs between which to animate</param>
1077         /// <param name="startTime">The start time of animation in milliseconds.</param>
1078         /// <param name="endTime">The end time of animation in milliseconds.</param>
1079         /// <param name="interpolation">The method used to interpolate between values.</param>
1080         /// <param name="alphaFunction">The alpha function to apply.</param>
1081         /// <exception cref="ArgumentNullException"> Thrown when target or property or keyFrames is null. </exception>
1082         /// <exception cref="ArgumentException"> Thrown when it failed to find a property from given string or the given keyFrames has invalid value. </exception>
1083         /// This will not be public opened.
1084         [EditorBrowsable(EditorBrowsableState.Never)]
1085         public void AnimateBetween(Animatable target, string property, KeyFrames keyFrames, int startTime, int endTime, Interpolation interpolation = Interpolation.Linear, AlphaFunction alphaFunction = null)
1086         {
1087             if (target == null)
1088             {
1089                 throw new ArgumentNullException(nameof(target));
1090             }
1091             if (property == null)
1092             {
1093                 throw new ArgumentNullException(nameof(property));
1094             }
1095             if (keyFrames == null)
1096             {
1097                 throw new ArgumentNullException(nameof(keyFrames));
1098             }
1099
1100             using (var result = PropertyHelper.Search(target, property))
1101             {
1102                 if (result == null)
1103                 {
1104                     throw new ArgumentException("string property is invalid");
1105                 }
1106
1107                 var current = result;
1108                 using (var time = new TimePeriod(startTime, endTime - startTime))
1109                     while (current != null)
1110                     {
1111                         // NOTE Do not dispose keyFrames object returned by GetRefinedKeyFrames() here.
1112                         AnimateBetween(current.Property, current.RefineKeyFrames(keyFrames) ?? throw new ArgumentException("Invalid " + nameof(keyFrames)), alphaFunction, time, interpolation);
1113                         current = current.NextResult;
1114                     }
1115             }
1116         }
1117
1118         /// <summary>
1119         /// Animates a property between keyframes.
1120         /// </summary>
1121         /// <param name="target">The target object to animate.</param>
1122         /// <param name="property">The target property to animate.</param>
1123         /// <param name="keyFrames">The set of time or value pairs between which to animate.</param>
1124         /// <param name="interpolation">The method used to interpolate between values.</param>
1125         /// <param name="alphaFunction">The alpha function to apply.</param>
1126         /// <exception cref="ArgumentNullException"> Thrown when target or property or keyFrames is null. </exception>
1127         /// <exception cref="ArgumentException"> Thrown when it failed to find a property from given string or the given keyFrames has invalid value. </exception>
1128         /// <since_tizen> 3 </since_tizen>
1129         public void AnimateBetween(View target, string property, KeyFrames keyFrames, Interpolation interpolation = Interpolation.Linear, AlphaFunction alphaFunction = null)
1130         {
1131             AnimateBetween(target as Animatable, property, keyFrames, interpolation, alphaFunction);
1132         }
1133
1134         /// <summary>
1135         /// Animates a property between keyframes.
1136         /// </summary>
1137         /// <param name="target">The target object to animate</param>
1138         /// <param name="property">The target property to animate</param>
1139         /// <param name="keyFrames">The set of time/value pairs between which to animate</param>
1140         /// <param name="startTime">The start time of animation in milliseconds.</param>
1141         /// <param name="endTime">The end time of animation in milliseconds.</param>
1142         /// <param name="interpolation">The method used to interpolate between values.</param>
1143         /// <param name="alphaFunction">The alpha function to apply.</param>
1144         /// <exception cref="ArgumentNullException"> Thrown when target or property or keyFrames is null. </exception>
1145         /// <exception cref="ArgumentException"> Thrown when it failed to find a property from given string or the given keyFrames has invalid value. </exception>
1146         /// <since_tizen> 3 </since_tizen>
1147         public void AnimateBetween(View target, string property, KeyFrames keyFrames, int startTime, int endTime, Interpolation interpolation = Interpolation.Linear, AlphaFunction alphaFunction = null)
1148         {
1149             AnimateBetween(target as Animatable, property, keyFrames, startTime, endTime, interpolation, alphaFunction);
1150         }
1151
1152         /// <summary>
1153         /// Animates the view's position and orientation through a predefined path.<br />
1154         /// The view will rotate to orient the supplied forward vector with the path's tangent.<br />
1155         /// If forward is the zero vector then no rotation will happen.<br />
1156         /// </summary>
1157         /// <param name="view">The view to animate.</param>
1158         /// <param name="path">It defines position and orientation.</param>
1159         /// <param name="forward">The vector (in local space coordinate system) will be oriented with the path's tangent direction.</param>
1160         /// <param name="alphaFunction">The alpha function to apply.</param>
1161         /// <since_tizen> 3 </since_tizen>
1162         public void AnimatePath(View view, Path path, Vector3 forward, AlphaFunction alphaFunction = null)
1163         {
1164             if (alphaFunction == null)
1165             {
1166                 Animate(view, path, forward);
1167             }
1168             else
1169             {
1170                 Animate(view, path, forward, alphaFunction);
1171             }
1172         }
1173
1174         /// <summary>
1175         /// Animates the view's position and orientation through a predefined path.<br />
1176         /// The view will rotate to orient the supplied forward vector with the path's tangent.<br />
1177         /// If forward is the zero vector then no rotation will happen.<br />
1178         /// </summary>
1179         /// <param name="view">The view to animate.</param>
1180         /// <param name="path">It defines position and orientation.</param>
1181         /// <param name="forward">The vector (in local space coordinate system) will be oriented with the path's tangent direction.</param>
1182         /// <param name="startTime">The start time of the animation.</param>
1183         /// <param name="endTime">The end time of the animation.</param>
1184         /// <param name="alphaFunction">The alpha function to apply.</param>
1185         /// <since_tizen> 3 </since_tizen>
1186         public void AnimatePath(View view, Path path, Vector3 forward, int startTime, int endTime, AlphaFunction alphaFunction = null)
1187         {
1188             TimePeriod time = new TimePeriod(startTime, endTime - startTime);
1189             if (alphaFunction == null)
1190             {
1191                 Animate(view, path, forward, time);
1192             }
1193             else
1194             {
1195                 Animate(view, path, forward, alphaFunction, time);
1196             }
1197             time.Dispose();
1198         }
1199
1200         /// <summary>
1201         /// Creates an initialized animation.<br />
1202         /// The animation will not loop.<br />
1203         /// The default end action is "Cancel".<br />
1204         /// The default alpha function is linear.<br />
1205         /// </summary>
1206         /// <since_tizen> 3 </since_tizen>
1207         public Animation() : this(Interop.Animation.New(0.0f), true)
1208         {
1209             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1210         }
1211
1212         /// <summary>
1213         /// Plays the animation.
1214         /// </summary>
1215         /// <since_tizen> 3 </since_tizen>
1216         public void Play()
1217         {
1218             Interop.Animation.Play(SwigCPtr);
1219             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1220
1221             if (DisableAnimation == true)
1222                 Stop(EndActions.StopFinal);
1223         }
1224
1225         /// <summary>
1226         /// Plays the animation from a given point.<br />
1227         /// The progress must be in the 0-1 interval or in the play range interval if defined,
1228         /// otherwise, it will be ignored.<br />
1229         /// </summary>
1230         /// <param name="progress">A value between [0,1], or between the play range if specified, from where the animation should start playing.</param>
1231         /// <since_tizen> 3 </since_tizen>
1232         public void PlayFrom(float progress)
1233         {
1234             Interop.Animation.PlayFrom(SwigCPtr, progress);
1235             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1236         }
1237
1238         /// <summary>
1239         /// Plays the animation after a given delay time.<br/>
1240         /// The delay time is not included in the looping time.<br/>
1241         /// When the delay time is a negative value, it would treat as play immediately.<br/>
1242         /// </summary>
1243         /// <param name="delayMilliseconds">The delay time.</param>
1244         /// <since_tizen> 4 </since_tizen>
1245         public void PlayAfter(int delayMilliseconds)
1246         {
1247             Interop.Animation.PlayAfter(SwigCPtr, MilliSecondsToSeconds(delayMilliseconds));
1248             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1249         }
1250
1251         /// <summary>
1252         /// Pauses the animation.
1253         /// </summary>
1254         /// <since_tizen> 3 </since_tizen>
1255         public void Pause()
1256         {
1257             Interop.Animation.Pause(SwigCPtr);
1258             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1259         }
1260
1261         /// <summary>
1262         /// Stops the animation.
1263         /// </summary>
1264         /// <since_tizen> 3 </since_tizen>
1265         public void Stop()
1266         {
1267             Interop.Animation.Stop(SwigCPtr);
1268             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1269         }
1270
1271         /// <summary>
1272         /// Clears the animation.<br />
1273         /// This disconnects any objects that were being animated, effectively stopping the animation.<br />
1274         /// </summary>
1275         /// <since_tizen> 3 </since_tizen>
1276         public void Clear()
1277         {
1278             Interop.Animation.Clear(SwigCPtr);
1279             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1280         }
1281
1282         internal object ConvertTo(object value, Type toType)
1283         {
1284             Func<object> getConverter = () =>
1285             {
1286                 string converterTypeName = GetTypeConverterTypeName(toType.GetTypeInfo().CustomAttributes);
1287                 if (converterTypeName == null)
1288                     return null;
1289
1290                 Type convertertype = Type.GetType(converterTypeName);
1291                 return Activator.CreateInstance(convertertype);
1292             };
1293
1294             return ConvertTo(value, toType, getConverter);
1295         }
1296
1297         internal object ConvertTo(object value, Type toType, Func<object> getConverter)
1298         {
1299             if (value == null)
1300                 return null;
1301
1302             var str = value as string;
1303             if (str != null)
1304             {
1305                 //If there's a [TypeConverter], use it
1306                 object converter = getConverter?.Invoke();
1307                 var xfTypeConverter = converter as Tizen.NUI.Binding.TypeConverter;
1308                 if (xfTypeConverter != null)
1309                     return value = xfTypeConverter.ConvertFromInvariantString(str);
1310                 var converterType = converter?.GetType();
1311                 if (converterType != null)
1312                 {
1313                     var convertFromStringInvariant = converterType.GetRuntimeMethod("ConvertFromInvariantString",
1314                         new[] { typeof(string) });
1315                     if (convertFromStringInvariant != null)
1316                         return value = convertFromStringInvariant.Invoke(converter, new object[] { str });
1317                 }
1318
1319                 //If the type is nullable, as the value is not null, it's safe to assume we want the built-in conversion
1320                 if (toType.GetTypeInfo().IsGenericType && toType.GetGenericTypeDefinition() == typeof(Nullable<>))
1321                     toType = Nullable.GetUnderlyingType(toType);
1322
1323                 //Obvious Built-in conversions
1324                 if (toType.GetTypeInfo().IsEnum)
1325                     return Enum.Parse(toType, str, true);
1326                 if (toType == typeof(SByte))
1327                     return SByte.Parse(str, CultureInfo.InvariantCulture);
1328                 if (toType == typeof(Int16))
1329                     return Int16.Parse(str, CultureInfo.InvariantCulture);
1330                 if (toType == typeof(Int32))
1331                     return Int32.Parse(str, CultureInfo.InvariantCulture);
1332                 if (toType == typeof(Int64))
1333                     return Int64.Parse(str, CultureInfo.InvariantCulture);
1334                 if (toType == typeof(Byte))
1335                     return Byte.Parse(str, CultureInfo.InvariantCulture);
1336                 if (toType == typeof(UInt16))
1337                     return UInt16.Parse(str, CultureInfo.InvariantCulture);
1338                 if (toType == typeof(UInt32))
1339                     return UInt32.Parse(str, CultureInfo.InvariantCulture);
1340                 if (toType == typeof(UInt64))
1341                     return UInt64.Parse(str, CultureInfo.InvariantCulture);
1342                 if (toType == typeof(Single))
1343                     return Single.Parse(str, CultureInfo.InvariantCulture);
1344                 if (toType == typeof(Double))
1345                     return Double.Parse(str, CultureInfo.InvariantCulture);
1346                 if (toType == typeof(Boolean))
1347                     return Boolean.Parse(str);
1348                 if (toType == typeof(TimeSpan))
1349                     return TimeSpan.Parse(str, CultureInfo.InvariantCulture);
1350                 if (toType == typeof(DateTime))
1351                     return DateTime.Parse(str, CultureInfo.InvariantCulture);
1352                 if (toType == typeof(Char))
1353                 {
1354                     char c = '\0';
1355                     _ = Char.TryParse(str, out c);
1356                     return c;
1357                 }
1358                 if (toType == typeof(String) && str.StartsWith("{}", StringComparison.Ordinal))
1359                     return str.Substring(2);
1360                 if (toType == typeof(String))
1361                     return value;
1362                 if (toType == typeof(Decimal))
1363                     return Decimal.Parse(str, CultureInfo.InvariantCulture);
1364             }
1365
1366             //if the value is not assignable and there's an implicit conversion, convert
1367             if (value != null && !toType.IsAssignableFrom(value.GetType()))
1368             {
1369                 var opImplicit = GetImplicitConversionOperator(value.GetType(), value.GetType(), toType)
1370                                  ?? GetImplicitConversionOperator(toType, value.GetType(), toType);
1371                 //var opImplicit = value.GetType().GetImplicitConversionOperator(fromType: value.GetType(), toType: toType)
1372                 //                ?? toType.GetImplicitConversionOperator(fromType: value.GetType(), toType: toType);
1373
1374                 if (opImplicit != null)
1375                 {
1376                     value = opImplicit.Invoke(null, new[] { value });
1377                     return value;
1378                 }
1379             }
1380
1381             return value;
1382         }
1383
1384         internal string GetTypeConverterTypeName(IEnumerable<CustomAttributeData> attributes)
1385         {
1386             var converterAttribute =
1387                 attributes.FirstOrDefault(cad => Tizen.NUI.Binding.TypeConverterAttribute.TypeConvertersType.Contains(cad.AttributeType.FullName));
1388             if (converterAttribute == null)
1389                 return null;
1390             if (converterAttribute.ConstructorArguments[0].ArgumentType == typeof(string))
1391                 return (string)converterAttribute.ConstructorArguments[0].Value;
1392             if (converterAttribute.ConstructorArguments[0].ArgumentType == typeof(Type))
1393                 return ((Type)converterAttribute.ConstructorArguments[0].Value).AssemblyQualifiedName;
1394             return null;
1395         }
1396
1397         internal MethodInfo GetImplicitConversionOperator(Type onType, Type fromType, Type toType)
1398         {
1399 #if NETSTANDARD1_0
1400             var mi = onType.GetRuntimeMethod("op_Implicit", new[] { fromType });
1401 #else
1402             var bindingFlags = BindingFlags.Public | BindingFlags.Static | BindingFlags.FlattenHierarchy;
1403             var mi = onType.GetMethod("op_Implicit", bindingFlags, null, new[] { fromType }, null);
1404 #endif
1405             if (mi == null) return null;
1406             if (!mi.IsSpecialName) return null;
1407             if (!mi.IsPublic) return null;
1408             if (!mi.IsStatic) return null;
1409             if (!toType.IsAssignableFrom(mi.ReturnType)) return null;
1410
1411             return mi;
1412         }
1413
1414         internal Animation(float durationSeconds) : this(Interop.Animation.New(durationSeconds), true)
1415         {
1416             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1417
1418         }
1419
1420         internal Animation(Animation handle) : this(Interop.Animation.NewAnimation(Animation.getCPtr(handle)), true)
1421         {
1422             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1423         }
1424
1425         internal Animation Assign(Animation rhs)
1426         {
1427             Animation ret = new Animation(Interop.Animation.Assign(SwigCPtr, Animation.getCPtr(rhs)), false);
1428             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1429             return ret;
1430         }
1431
1432         internal void SetDuration(float seconds)
1433         {
1434             Interop.Animation.SetDuration(SwigCPtr, seconds);
1435             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1436         }
1437
1438         internal float GetDuration()
1439         {
1440             float ret = Interop.Animation.GetDuration(SwigCPtr);
1441             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1442             return ret;
1443         }
1444
1445         internal void SetLooping(bool looping)
1446         {
1447             Interop.Animation.SetLooping(SwigCPtr, looping);
1448             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1449         }
1450
1451         internal void SetLoopCount(int count)
1452         {
1453             Interop.Animation.SetLoopCount(SwigCPtr, count);
1454             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1455         }
1456
1457         internal int GetLoopCount()
1458         {
1459             int ret = Interop.Animation.GetLoopCount(SwigCPtr);
1460             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1461             return ret;
1462         }
1463
1464         internal int GetCurrentLoop()
1465         {
1466             int ret = Interop.Animation.GetCurrentLoop(SwigCPtr);
1467             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1468             return ret;
1469         }
1470
1471         internal bool IsLooping()
1472         {
1473             bool ret = Interop.Animation.IsLooping(SwigCPtr);
1474             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1475             return ret;
1476         }
1477
1478         internal void SetEndAction(Animation.EndActions action)
1479         {
1480             Interop.Animation.SetEndAction(SwigCPtr, (int)action);
1481             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1482         }
1483
1484         internal Animation.EndActions GetEndAction()
1485         {
1486             Animation.EndActions ret = (Animation.EndActions)Interop.Animation.GetEndAction(SwigCPtr);
1487             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1488             return ret;
1489         }
1490
1491         internal void SetDisconnectAction(Animation.EndActions disconnectAction)
1492         {
1493             Interop.Animation.SetDisconnectAction(SwigCPtr, (int)disconnectAction);
1494             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1495         }
1496
1497         internal Animation.EndActions GetDisconnectAction()
1498         {
1499             Animation.EndActions ret = (Animation.EndActions)Interop.Animation.GetDisconnectAction(SwigCPtr);
1500             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1501             return ret;
1502         }
1503
1504         internal void SetDefaultAlphaFunction(AlphaFunction alpha)
1505         {
1506             Interop.Animation.SetDefaultAlphaFunction(SwigCPtr, AlphaFunction.getCPtr(alpha));
1507             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1508         }
1509
1510         internal AlphaFunction GetDefaultAlphaFunction()
1511         {
1512             AlphaFunction ret = new AlphaFunction(Interop.Animation.GetDefaultAlphaFunction(SwigCPtr), true);
1513             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1514             return ret;
1515         }
1516
1517         internal void SetCurrentProgress(float progress)
1518         {
1519             Interop.Animation.SetCurrentProgress(SwigCPtr, progress);
1520             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1521         }
1522
1523         internal float GetCurrentProgress()
1524         {
1525             float ret = Interop.Animation.GetCurrentProgress(SwigCPtr);
1526             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1527             return ret;
1528         }
1529
1530         internal void SetSpeedFactor(float factor)
1531         {
1532             Interop.Animation.SetSpeedFactor(SwigCPtr, factor);
1533             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1534         }
1535
1536         internal float GetSpeedFactor()
1537         {
1538             float ret = Interop.Animation.GetSpeedFactor(SwigCPtr);
1539             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1540             return ret;
1541         }
1542
1543         internal void SetPlayRange(Vector2 range)
1544         {
1545             Interop.Animation.SetPlayRange(SwigCPtr, Vector2.getCPtr(range));
1546             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1547         }
1548
1549         internal Vector2 GetPlayRange()
1550         {
1551             Vector2 ret = new Vector2(Interop.Animation.GetPlayRange(SwigCPtr), true);
1552             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1553             return ret;
1554         }
1555
1556         internal Animation.States GetState()
1557         {
1558             Animation.States ret = (Animation.States)Interop.Animation.GetState(SwigCPtr);
1559             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1560             return ret;
1561         }
1562
1563         internal AnimationSignal FinishedSignal()
1564         {
1565             AnimationSignal ret = new AnimationSignal(Interop.Animation.FinishedSignal(SwigCPtr), false);
1566             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1567             return ret;
1568         }
1569
1570         internal AnimationSignal ProgressReachedSignal()
1571         {
1572             AnimationSignal ret = new AnimationSignal(Interop.Animation.ProgressReachedSignal(SwigCPtr), false);
1573             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1574             return ret;
1575         }
1576
1577         internal void AnimateBy(Property target, PropertyValue relativeValue, AlphaFunction alpha)
1578         {
1579             if (alpha == null)
1580             {
1581                 Interop.Animation.AnimateBy(SwigCPtr, Property.getCPtr(target), PropertyValue.getCPtr(relativeValue));
1582             }
1583             else
1584             {
1585                 Interop.Animation.AnimateByAlphaFunction(SwigCPtr, Property.getCPtr(target), PropertyValue.getCPtr(relativeValue), AlphaFunction.getCPtr(alpha));
1586             }
1587             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1588         }
1589
1590         internal void AnimateBy(Property target, PropertyValue relativeValue, AlphaFunction alpha, TimePeriod period)
1591         {
1592             if (alpha == null)
1593             {
1594                 Interop.Animation.AnimateByTimePeriod(SwigCPtr, Property.getCPtr(target), PropertyValue.getCPtr(relativeValue), TimePeriod.getCPtr(period));
1595             }
1596             else
1597             {
1598                 Interop.Animation.AnimateBy(SwigCPtr, Property.getCPtr(target), PropertyValue.getCPtr(relativeValue), AlphaFunction.getCPtr(alpha), TimePeriod.getCPtr(period));
1599             }
1600             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1601         }
1602
1603         internal void AnimateTo(Property target, PropertyValue destinationValue, AlphaFunction alpha)
1604         {
1605             if (alpha == null)
1606             {
1607                 Interop.Animation.AnimateTo(SwigCPtr, Property.getCPtr(target), PropertyValue.getCPtr(destinationValue));
1608             }
1609             else
1610             {
1611                 Interop.Animation.AnimateToAlphaFunction(SwigCPtr, Property.getCPtr(target), PropertyValue.getCPtr(destinationValue), AlphaFunction.getCPtr(alpha));
1612             }
1613             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1614         }
1615
1616         internal void AnimateTo(Property target, PropertyValue destinationValue, AlphaFunction alpha, TimePeriod period)
1617         {
1618             if (alpha == null)
1619             {
1620                 Interop.Animation.AnimateToTimePeriod(SwigCPtr, Property.getCPtr(target), PropertyValue.getCPtr(destinationValue), TimePeriod.getCPtr(period));
1621             }
1622             else
1623             {
1624                 Interop.Animation.AnimateTo(SwigCPtr, Property.getCPtr(target), PropertyValue.getCPtr(destinationValue), AlphaFunction.getCPtr(alpha), TimePeriod.getCPtr(period));
1625             }
1626             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1627         }
1628
1629
1630         internal void AnimateByIntPtr(Property target, global::System.IntPtr relativeValueIntPtr, AlphaFunction alpha)
1631         {
1632             if (alpha == null)
1633             {
1634                 Interop.Animation.AnimateBy(SwigCPtr, Property.getCPtr(target), relativeValueIntPtr);
1635             }
1636             else
1637             {
1638                 Interop.Animation.AnimateByAlphaFunction(SwigCPtr, Property.getCPtr(target), relativeValueIntPtr, AlphaFunction.getCPtr(alpha));
1639             }
1640             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1641         }
1642
1643         internal void AnimateByIntPtr(Property target, global::System.IntPtr relativeValueIntPtr, AlphaFunction alpha, TimePeriod period)
1644         {
1645             if (alpha == null)
1646             {
1647                 Interop.Animation.AnimateByTimePeriod(SwigCPtr, Property.getCPtr(target), relativeValueIntPtr, TimePeriod.getCPtr(period));
1648             }
1649             else
1650             {
1651                 Interop.Animation.AnimateBy(SwigCPtr, Property.getCPtr(target), relativeValueIntPtr, AlphaFunction.getCPtr(alpha), TimePeriod.getCPtr(period));
1652             }
1653             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1654         }
1655
1656         internal void AnimateToIntPtr(Property target, global::System.IntPtr destinationValueIntPtr, AlphaFunction alpha)
1657         {
1658             if (alpha == null)
1659             {
1660                 Interop.Animation.AnimateTo(SwigCPtr, Property.getCPtr(target), destinationValueIntPtr);
1661             }
1662             else
1663             {
1664                 Interop.Animation.AnimateToAlphaFunction(SwigCPtr, Property.getCPtr(target), destinationValueIntPtr, AlphaFunction.getCPtr(alpha));
1665             }
1666             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1667         }
1668
1669         internal void AnimateToIntPtr(Property target, global::System.IntPtr destinationValueIntPtr, AlphaFunction alpha, TimePeriod period)
1670         {
1671             if (alpha == null)
1672             {
1673                 Interop.Animation.AnimateToTimePeriod(SwigCPtr, Property.getCPtr(target), destinationValueIntPtr, TimePeriod.getCPtr(period));
1674             }
1675             else
1676             {
1677                 Interop.Animation.AnimateTo(SwigCPtr, Property.getCPtr(target), destinationValueIntPtr, AlphaFunction.getCPtr(alpha), TimePeriod.getCPtr(period));
1678             }
1679             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1680         }
1681
1682         internal void AnimateBetween(Property target, KeyFrames keyFrames)
1683         {
1684             Interop.Animation.AnimateBetween(SwigCPtr, Property.getCPtr(target), KeyFrames.getCPtr(keyFrames));
1685             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1686         }
1687
1688         internal void AnimateBetween(Property target, KeyFrames keyFrames, AlphaFunction alpha)
1689         {
1690             Interop.Animation.AnimateBetweenAlphaFunction(SwigCPtr, Property.getCPtr(target), KeyFrames.getCPtr(keyFrames), AlphaFunction.getCPtr(alpha));
1691             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1692         }
1693
1694         internal void AnimateBetween(Property target, KeyFrames keyFrames, AlphaFunction alpha, Animation.Interpolation interpolation)
1695         {
1696             if (alpha == null)
1697             {
1698                 Interop.Animation.AnimateBetween(SwigCPtr, Property.getCPtr(target), KeyFrames.getCPtr(keyFrames), (int)interpolation);
1699             }
1700             else
1701             {
1702                 Interop.Animation.AnimateBetweenAlphaFunctionInterpolation(SwigCPtr, Property.getCPtr(target), KeyFrames.getCPtr(keyFrames), AlphaFunction.getCPtr(alpha), (int)interpolation);
1703             }
1704             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1705         }
1706
1707         internal void AnimateBetween(Property target, KeyFrames keyFrames, TimePeriod period)
1708         {
1709             Interop.Animation.AnimateBetweenTimePeriod(SwigCPtr, Property.getCPtr(target), KeyFrames.getCPtr(keyFrames), TimePeriod.getCPtr(period));
1710             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1711         }
1712
1713         internal void AnimateBetween(Property target, KeyFrames keyFrames, AlphaFunction alpha, TimePeriod period)
1714         {
1715             Interop.Animation.AnimateBetween(SwigCPtr, Property.getCPtr(target), KeyFrames.getCPtr(keyFrames), AlphaFunction.getCPtr(alpha), TimePeriod.getCPtr(period));
1716             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1717         }
1718
1719         internal void AnimateBetween(Property target, KeyFrames keyFrames, AlphaFunction alpha, TimePeriod period, Animation.Interpolation interpolation)
1720         {
1721             if (alpha == null)
1722             {
1723                 Interop.Animation.AnimateBetweenTimePeriodInterpolation(SwigCPtr, Property.getCPtr(target), KeyFrames.getCPtr(keyFrames), TimePeriod.getCPtr(period), (int)interpolation);
1724             }
1725             else
1726             {
1727                 Interop.Animation.AnimateBetween(SwigCPtr, Property.getCPtr(target), KeyFrames.getCPtr(keyFrames), AlphaFunction.getCPtr(alpha), TimePeriod.getCPtr(period), (int)interpolation);
1728             }
1729             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1730         }
1731
1732         internal void Animate(View view, Path path, Vector3 forward)
1733         {
1734             Interop.Animation.Animate(SwigCPtr, View.getCPtr(view), Path.getCPtr(path), Vector3.getCPtr(forward));
1735             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1736         }
1737
1738         internal void Animate(View view, Path path, Vector3 forward, AlphaFunction alpha)
1739         {
1740             Interop.Animation.AnimateAlphaFunction(SwigCPtr, View.getCPtr(view), Path.getCPtr(path), Vector3.getCPtr(forward), AlphaFunction.getCPtr(alpha));
1741             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1742         }
1743
1744         internal void Animate(View view, Path path, Vector3 forward, TimePeriod period)
1745         {
1746             Interop.Animation.AnimateTimePeriod(SwigCPtr, View.getCPtr(view), Path.getCPtr(path), Vector3.getCPtr(forward), TimePeriod.getCPtr(period));
1747             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1748         }
1749
1750         internal void Animate(View view, Path path, Vector3 forward, AlphaFunction alpha, TimePeriod period)
1751         {
1752             Interop.Animation.Animate(SwigCPtr, View.getCPtr(view), Path.getCPtr(path), Vector3.getCPtr(forward), AlphaFunction.getCPtr(alpha), TimePeriod.getCPtr(period));
1753             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1754         }
1755
1756         internal void Show(View view, float delaySeconds)
1757         {
1758             Interop.Animation.Show(SwigCPtr, View.getCPtr(view), delaySeconds);
1759             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1760         }
1761
1762         internal void Hide(View view, float delaySeconds)
1763         {
1764             Interop.Animation.Hide(SwigCPtr, View.getCPtr(view), delaySeconds);
1765             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1766         }
1767
1768         /// <summary>
1769         /// To make animation instance be disposed.
1770         /// </summary>
1771         /// <since_tizen> 3 </since_tizen>
1772         protected override void Dispose(DisposeTypes type)
1773         {
1774             if (disposed)
1775             {
1776                 return;
1777             }
1778
1779             if (animationFinishedEventHandler != null)
1780             {
1781                 AnimationSignal finishedSignal = FinishedSignal();
1782                 finishedSignal?.Disconnect(finishedCallbackOfNative);
1783                 finishedSignal?.Dispose();
1784                 animationFinishedEventHandler = null;
1785             }
1786
1787             if (animationProgressReachedEventCallback != null)
1788             {
1789                 AnimationSignal progressReachedSignal = ProgressReachedSignal();
1790                 progressReachedSignal?.Disconnect(animationProgressReachedEventCallback);
1791                 progressReachedSignal?.Dispose();
1792                 animationProgressReachedEventCallback = null;
1793             }
1794
1795             base.Dispose(type);
1796         }
1797
1798         /// This will not be public opened.
1799         [EditorBrowsable(EditorBrowsableState.Never)]
1800         protected override void ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef swigCPtr)
1801         {
1802             if (swigCPtr.Handle == IntPtr.Zero || Disposed)
1803             {
1804                 Tizen.Log.Fatal("NUI", $"[ERROR] Animation ReleaseSwigCPtr()! IntPtr=0x{swigCPtr.Handle:X} Disposed={Disposed}");
1805                 return;
1806             }
1807             Interop.Animation.DeleteAnimation(swigCPtr);
1808         }
1809
1810         private void OnFinished(IntPtr data)
1811         {
1812             if (animationFinishedEventHandler != null)
1813             {
1814                 //here we send all data to user event handlers
1815                 animationFinishedEventHandler(this, null);
1816             }
1817         }
1818
1819         private void OnProgressReached(IntPtr data)
1820         {
1821             if (animationProgressReachedEventHandler != null)
1822             {
1823                 //here we send all data to user event handlers
1824                 animationProgressReachedEventHandler(this, null);
1825             }
1826         }
1827
1828         private float MilliSecondsToSeconds(int millisec)
1829         {
1830             return (float)millisec / 1000.0f;
1831         }
1832
1833         private int SecondsToMilliSeconds(float sec)
1834         {
1835             return (int)(sec * 1000);
1836         }
1837     }
1838 }