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