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