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