[NUI-252] change string type of property to enum type of property
[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 Duration property 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         /// Precodition : DurationmSeconds must be greater than zero.<br>
84         /// </summary>
85         /// <param name="durationMilliSeconds">The duration in milli seconds (int).</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 of 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 an 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 to CurrentLoop 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         /// The default alpha function will be used.<br>
373         /// The effect will start & end when the animation begins & ends.<br>
374         /// </summary>
375         /// <param name="target">The target object to animate</param>
376         /// <param name="property">The target property to animate</param>
377         /// <param name="relativeValue">The property value will change by this amount</param>
378         /// <param name="alphaFunction">The alpha function to apply</param>
379         public void AnimateBy(Actor target, string property, object relativeValue, AlphaFunction alphaFunction = null)
380         {
381             string _str1 = property.Substring(0, 1);
382             string _str2 = property.Substring(1);
383             string _str = _str1.ToLower() + _str2;
384
385             Property _prop = new Property(target, _str);
386             if (_prop.propertyIndex == Property.INVALID_INDEX)
387             {
388                 throw new System.Exception("second argument string property is invalid parameter!");
389             }
390
391             //dynamic obj = (object)relativeValue;
392             PropertyValue val = PropertyValue.CreateFromObject(relativeValue);
393
394             if (alphaFunction != null)
395             {
396                 AnimateBy(_prop, new PropertyValue(val), alphaFunction);
397             }
398             else
399             {
400                 AnimateBy(_prop, new PropertyValue(val));
401             }
402         }
403
404         /// <summary>
405         /// Animates a property value by a relative amount.<br>
406         /// The default alpha function will be used.<br>
407         /// The effect will start & end when the animation begins & ends.<br>
408         /// </summary>
409         /// <param name="target">The target object to animate</param>
410         /// <param name="property">The target property to animate</param>
411         /// <param name="relativeValue">The property value will change by this amount</param>
412         /// <param name="startTime">Start time of animation</param>
413         /// <param name="endTime">End time of animation</param>
414         /// <param name="alphaFunction">The alpha function to apply</param>
415         public void AnimateBy(Actor target, string property, object relativeValue, int startTime, int endTime, AlphaFunction alphaFunction = null)
416         {
417             string _str1 = property.Substring(0, 1);
418             string _str2 = property.Substring(1);
419             string _str = _str1.ToLower() + _str2;
420
421             Property _prop = new Property(target, _str);
422             if (_prop.propertyIndex == Property.INVALID_INDEX)
423             {
424                 throw new System.Exception("second argument string property is invalid parameter!");
425             }
426
427             //dynamic obj = (object)relativeValue;
428             PropertyValue val = PropertyValue.CreateFromObject(relativeValue);
429
430             if (alphaFunction != null)
431             {
432                 Tizen.NUI.TimePeriod time = new Tizen.NUI.TimePeriod(MilliSecondsToSeconds(startTime), MilliSecondsToSeconds(endTime - startTime));
433                 AnimateBy(_prop, new PropertyValue(val), alphaFunction, time);
434             }
435             else
436             {
437                 Tizen.NUI.TimePeriod time = new Tizen.NUI.TimePeriod(MilliSecondsToSeconds(startTime), MilliSecondsToSeconds(endTime - startTime));
438                 AnimateBy(_prop, new PropertyValue(val), time);
439             }
440         }
441
442         /// <summary>
443         /// Animates a property to a destination value.<br>
444         /// The default alpha function will be used.<br>
445         /// The effect will start & end when the animation begins & ends.<br>
446         /// </summary>
447         /// <param name="target">The target object to animate</param>
448         /// <param name="property">The target property to animate</param>
449         /// <param name="destinationValue">The destination value</param>
450         /// <param name="alphaFunction">The alpha function to apply</param>
451         public void AnimateTo(Actor target, string property, object destinationValue, AlphaFunction alphaFunction = null)
452         {
453             string _str1 = property.Substring(0, 1);
454             string _str2 = property.Substring(1);
455             string _str = _str1.ToLower() + _str2;
456
457             Property _prop = new Property(target, _str);
458             if (_prop.propertyIndex == Property.INVALID_INDEX)
459             {
460                 throw new System.Exception("second argument string property is invalid parameter!");
461             }
462
463             //dynamic obj = (object)destinationValue;
464             PropertyValue val = PropertyValue.CreateFromObject(destinationValue);
465
466             if (alphaFunction != null)
467             {
468                 AnimateTo(_prop, new PropertyValue(val), alphaFunction);
469             }
470             else
471             {
472                 AnimateTo(_prop, new PropertyValue(val));
473             }
474         }
475
476         /// <summary>
477         /// Animates a property to a destination value.<br>
478         /// The default alpha function will be used.<br>
479         /// The effect will start & end when the animation begins & ends.<br>
480         /// </summary>
481         /// <param name="target">The target object to animate</param>
482         /// <param name="property">The target property to animate</param>
483         /// <param name="destinationValue">The destination value</param>
484         /// <param name="alphaFunction">The alpha function to apply</param>
485         /// <param name="startTime">Start time of animation</param>
486         /// <param name="endTime">End time of animation</param>
487         /// <param name="alphaFunction"></param>
488         public void AnimateTo(Actor target, string property, object destinationValue, int startTime, int endTime, AlphaFunction alphaFunction = null)
489         {
490             string _str1 = property.Substring(0, 1);
491             string _str2 = property.Substring(1);
492             string _str = _str1.ToLower() + _str2;
493
494             Property _prop = new Property(target, _str);
495             if (_prop.propertyIndex == Property.INVALID_INDEX)
496             {
497                 throw new System.Exception("second argument string property is invalid parameter!");
498             }
499
500             //dynamic obj = (object)destinationValue;
501             PropertyValue val = PropertyValue.CreateFromObject(destinationValue);
502
503             if (alphaFunction != null)
504             {
505                 Tizen.NUI.TimePeriod time = new Tizen.NUI.TimePeriod(MilliSecondsToSeconds(startTime), MilliSecondsToSeconds(endTime - startTime));
506                 AnimateTo(_prop, new PropertyValue(val), alphaFunction, time);
507             }
508             else
509             {
510                 Tizen.NUI.TimePeriod time = new Tizen.NUI.TimePeriod(MilliSecondsToSeconds(startTime), MilliSecondsToSeconds(endTime - startTime));
511                 AnimateTo(_prop, new PropertyValue(val), time);
512             }
513         }
514
515         /// <summary>
516         /// Animates a property between keyframes.
517         /// </summary>
518         /// <param name="target">The target object to animate</param>
519         /// <param name="property">The target property to animate</param>
520         /// <param name="keyFrames">The set of time/value pairs between which to animate</param>
521         /// <param name="interpolation">The method used to interpolate between values</param>
522         /// <param name="alphaFunction">The alpha function to apply</param>
523         public void AnimateBetween(Actor target, string property, KeyFrames keyFrames, Interpolation interpolation = Interpolation.Linear, AlphaFunction alphaFunction = null)
524         {
525             string _str1 = property.Substring(0, 1);
526             string _str2 = property.Substring(1);
527             string _str = _str1.ToLower() + _str2;
528
529             Property _prop = new Property(target, _str);
530             if (_prop.propertyIndex == Property.INVALID_INDEX)
531             {
532                 throw new System.Exception("second argument string property is invalid parameter!");
533             }
534
535             if (alphaFunction != null)
536             {
537                 AnimateBetween(_prop, keyFrames, alphaFunction, interpolation);
538             }
539             else
540             {
541                 AnimateBetween(_prop, keyFrames, interpolation);
542             }
543         }
544
545
546         /// <summary>
547         /// Animates a property between keyframes.
548         /// </summary>
549         /// <param name="target">The target object to animate</param>
550         /// <param name="property">The target property to animate</param>
551         /// <param name="keyFrames">The set of time/value pairs between which to animate</param>
552         /// <param name="startTime">Start time of animation</param>
553         /// <param name="endTime">End time of animation</param>
554         /// <param name="interpolation">The method used to interpolate between values</param>
555         /// <param name="alphaFunction">The alpha function to apply</param>
556         public void AnimateBetween(Actor target, string property, KeyFrames keyFrames, int startTime, int endTime, Interpolation interpolation = Interpolation.Linear, AlphaFunction alphaFunction = null)
557         {
558             string _str1 = property.Substring(0, 1);
559             string _str2 = property.Substring(1);
560             string _str = _str1.ToLower() + _str2;
561
562             Property _prop = new Property(target, _str);
563             if (_prop.propertyIndex == Property.INVALID_INDEX)
564             {
565                 throw new System.Exception("second argument string property is invalid parameter!");
566             }
567
568             Tizen.NUI.TimePeriod time = new Tizen.NUI.TimePeriod(MilliSecondsToSeconds(startTime), MilliSecondsToSeconds(endTime - startTime));
569             if (alphaFunction != null)
570             {
571                 AnimateBetween(_prop, keyFrames, alphaFunction, time, interpolation);
572             }
573             else
574             {
575                 AnimateBetween(_prop, keyFrames, time, interpolation);
576             }
577         }
578
579         /// <summary>
580         /// Animates an actor's position and orientation through a predefined path.<br>
581         /// The actor will rotate to orient the supplied forward vector with the path's tangent.<br>
582         /// If forward is the zero vector then no rotation will happen.<br>
583         /// </summary>
584         /// <param name="actor">The actor to animate</param>
585         /// <param name="path">It defines position and orientation</param>
586         /// <param name="forward">The vector (in local space coordinate system) that will be oriented with the path's tangent direction</param>
587         /// <param name="alphaFunction">The alpha function to apply</param>
588         public void AnimatePath(Actor actor, Path path, Vector3 forward, AlphaFunction alphaFunction = null)
589         {
590             if (alphaFunction == null)
591             {
592                 Animate(actor, path, forward);
593             }
594             else
595             {
596                 Animate(actor, path, forward, alphaFunction);
597             }
598         }
599
600         /// <summary>
601         /// Animates an actor's position and orientation through a predefined path.<br>
602         /// The actor will rotate to orient the supplied forward vector with the path's tangent.<br>
603         /// If forward is the zero vector then no rotation will happen.<br>
604         /// </summary>
605         /// <param name="actor">The actor to animate</param>
606         /// <param name="path">It defines position and orientation</param>
607         /// <param name="forward">The vector (in local space coordinate system) that will be oriented with the path's tangent direction</param>
608         /// <param name="startTime">Start time of animation</param>
609         /// <param name="endTime">End time of animation</param>
610         /// <param name="alphaFunction">The alpha function to apply</param>
611         public void AnimatePath(Actor actor, Path path, Vector3 forward, int startTime, int endTime, AlphaFunction alphaFunction = null)
612         {
613             TimePeriod time = new TimePeriod(MilliSecondsToSeconds(startTime), MilliSecondsToSeconds(endTime - startTime));
614             if (alphaFunction == null)
615             {
616                 Animate(actor, path, forward, time);
617             }
618             else
619             {
620                 Animate(actor, path, forward, alphaFunction, time);
621             }
622         }
623
624         /// <summary>
625         /// Creates an initialized Animation.<br>
626         /// The animation will not loop.<br>
627         /// The default end action is "Cancel".<br>
628         /// The default alpha function is linear.<br>
629         /// </summary>
630         public Animation() : this(NDalicPINVOKE.Animation_New(0.0f), true)
631         {
632             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
633         }
634
635         internal Animation(float durationSeconds) : this(NDalicPINVOKE.Animation_New(durationSeconds), true)
636         {
637             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
638
639         }
640
641         /// <summary>
642         /// Downcasts a handle to Animation handle.<br>
643         /// If handle points to an Animation object, the downcast produces valid handle.<br>
644         /// If not, the returned handle is left uninitialized.<br>
645         /// </summary>
646         /// <param name="handle">Handle to an object</param>
647         /// <returns>Handle to an Animation object or an uninitialized handle</returns>
648         public static Animation DownCast(BaseHandle handle)
649         {
650             Animation ret = new Animation(NDalicPINVOKE.Animation_DownCast(BaseHandle.getCPtr(handle)), true);
651             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
652             return ret;
653         }
654
655         internal Animation(Animation handle) : this(NDalicPINVOKE.new_Animation__SWIG_1(Animation.getCPtr(handle)), true)
656         {
657             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
658         }
659
660         internal Animation Assign(Animation rhs)
661         {
662             Animation ret = new Animation(NDalicPINVOKE.Animation_Assign(swigCPtr, Animation.getCPtr(rhs)), false);
663             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
664             return ret;
665         }
666
667         internal void SetDuration(float seconds)
668         {
669             NDalicPINVOKE.Animation_SetDuration(swigCPtr, seconds);
670             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
671         }
672
673         internal float GetDuration()
674         {
675             float ret = NDalicPINVOKE.Animation_GetDuration(swigCPtr);
676             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
677             return ret;
678         }
679
680         internal void SetLooping(bool looping)
681         {
682             NDalicPINVOKE.Animation_SetLooping(swigCPtr, looping);
683             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
684         }
685
686         internal void SetLoopCount(int count)
687         {
688             NDalicPINVOKE.Animation_SetLoopCount(swigCPtr, count);
689             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
690         }
691
692         internal int GetLoopCount()
693         {
694             int ret = NDalicPINVOKE.Animation_GetLoopCount(swigCPtr);
695             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
696             return ret;
697         }
698
699         internal int GetCurrentLoop()
700         {
701             int ret = NDalicPINVOKE.Animation_GetCurrentLoop(swigCPtr);
702             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
703             return ret;
704         }
705
706         internal bool IsLooping()
707         {
708             bool ret = NDalicPINVOKE.Animation_IsLooping(swigCPtr);
709             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
710             return ret;
711         }
712
713         internal void SetEndAction(Animation.EndActions action)
714         {
715             NDalicPINVOKE.Animation_SetEndAction(swigCPtr, (int)action);
716             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
717         }
718
719         internal Animation.EndActions GetEndAction()
720         {
721             Animation.EndActions ret = (Animation.EndActions)NDalicPINVOKE.Animation_GetEndAction(swigCPtr);
722             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
723             return ret;
724         }
725
726         internal void SetDisconnectAction(Animation.EndActions disconnectAction)
727         {
728             NDalicPINVOKE.Animation_SetDisconnectAction(swigCPtr, (int)disconnectAction);
729             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
730         }
731
732         internal Animation.EndActions GetDisconnectAction()
733         {
734             Animation.EndActions ret = (Animation.EndActions)NDalicPINVOKE.Animation_GetDisconnectAction(swigCPtr);
735             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
736             return ret;
737         }
738
739         internal void SetDefaultAlphaFunction(AlphaFunction alpha)
740         {
741             NDalicPINVOKE.Animation_SetDefaultAlphaFunction(swigCPtr, AlphaFunction.getCPtr(alpha));
742             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
743         }
744
745         internal AlphaFunction GetDefaultAlphaFunction()
746         {
747             AlphaFunction ret = new AlphaFunction(NDalicPINVOKE.Animation_GetDefaultAlphaFunction(swigCPtr), true);
748             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
749             return ret;
750         }
751
752         internal void SetCurrentProgress(float progress)
753         {
754             NDalicPINVOKE.Animation_SetCurrentProgress(swigCPtr, progress);
755             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
756         }
757
758         internal float GetCurrentProgress()
759         {
760             float ret = NDalicPINVOKE.Animation_GetCurrentProgress(swigCPtr);
761             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
762             return ret;
763         }
764
765         internal void SetSpeedFactor(float factor)
766         {
767             NDalicPINVOKE.Animation_SetSpeedFactor(swigCPtr, factor);
768             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
769         }
770
771         internal float GetSpeedFactor()
772         {
773             float ret = NDalicPINVOKE.Animation_GetSpeedFactor(swigCPtr);
774             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
775             return ret;
776         }
777
778         internal void SetPlayRange(Vector2 range)
779         {
780             NDalicPINVOKE.Animation_SetPlayRange(swigCPtr, Vector2.getCPtr(range));
781             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
782         }
783
784         internal Vector2 GetPlayRange()
785         {
786             Vector2 ret = new Vector2(NDalicPINVOKE.Animation_GetPlayRange(swigCPtr), true);
787             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
788             return ret;
789         }
790
791         /// <summary>
792         /// Play the animation.
793         /// </summary>
794         public void Play()
795         {
796             NDalicPINVOKE.Animation_Play(swigCPtr);
797             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
798         }
799
800         /// <summary>
801         /// Plays the animation from a given point.<br>
802         /// The progress must be in the 0-1 interval or in the play range interval if defined,
803         /// otherwise, it will be ignored.<br>
804         /// </summary>
805         /// <param name="progress">A value between [0,1], or between the play range if specified, from where the animation should start playing</param>
806         public void PlayFrom(float progress)
807         {
808             NDalicPINVOKE.Animation_PlayFrom(swigCPtr, progress);
809             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
810         }
811
812         /// <summary>
813         /// Pauses the animation.
814         /// </summary>
815         public void Pause()
816         {
817             NDalicPINVOKE.Animation_Pause(swigCPtr);
818             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
819         }
820
821         internal Animation.States GetState()
822         {
823             Animation.States ret = (Animation.States)NDalicPINVOKE.Animation_GetState(swigCPtr);
824             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
825             return ret;
826         }
827
828         /// <summary>
829         /// Stops the animation.
830         /// </summary>
831         public void Stop()
832         {
833             NDalicPINVOKE.Animation_Stop(swigCPtr);
834             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
835         }
836
837         /// <summary>
838         /// Clears the animation.<br>
839         /// This disconnects any objects that were being animated, effectively stopping the animation.<br>
840         /// </summary>
841         public void Clear()
842         {
843             NDalicPINVOKE.Animation_Clear(swigCPtr);
844             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
845         }
846
847         internal AnimationSignal FinishedSignal()
848         {
849             AnimationSignal ret = new AnimationSignal(NDalicPINVOKE.Animation_FinishedSignal(swigCPtr), false);
850             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
851             return ret;
852         }
853
854         internal void AnimateBy(Property target, PropertyValue relativeValue)
855         {
856             NDalicPINVOKE.Animation_AnimateBy__SWIG_0(swigCPtr, Property.getCPtr(target), PropertyValue.getCPtr(relativeValue));
857             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
858         }
859
860         internal void AnimateBy(Property target, PropertyValue relativeValue, AlphaFunction alpha)
861         {
862             NDalicPINVOKE.Animation_AnimateBy__SWIG_1(swigCPtr, Property.getCPtr(target), PropertyValue.getCPtr(relativeValue), AlphaFunction.getCPtr(alpha));
863             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
864         }
865
866         internal void AnimateBy(Property target, PropertyValue relativeValue, TimePeriod period)
867         {
868             NDalicPINVOKE.Animation_AnimateBy__SWIG_2(swigCPtr, Property.getCPtr(target), PropertyValue.getCPtr(relativeValue), TimePeriod.getCPtr(period));
869             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
870         }
871
872         internal void AnimateBy(Property target, PropertyValue relativeValue, AlphaFunction alpha, TimePeriod period)
873         {
874             NDalicPINVOKE.Animation_AnimateBy__SWIG_3(swigCPtr, Property.getCPtr(target), PropertyValue.getCPtr(relativeValue), AlphaFunction.getCPtr(alpha), TimePeriod.getCPtr(period));
875             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
876         }
877
878         internal void AnimateTo(Property target, PropertyValue destinationValue)
879         {
880             NDalicPINVOKE.Animation_AnimateTo__SWIG_0(swigCPtr, Property.getCPtr(target), PropertyValue.getCPtr(destinationValue));
881             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
882         }
883
884         internal void AnimateTo(Property target, PropertyValue destinationValue, AlphaFunction alpha)
885         {
886             NDalicPINVOKE.Animation_AnimateTo__SWIG_1(swigCPtr, Property.getCPtr(target), PropertyValue.getCPtr(destinationValue), AlphaFunction.getCPtr(alpha));
887             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
888         }
889
890         internal void AnimateTo(Property target, PropertyValue destinationValue, TimePeriod period)
891         {
892             NDalicPINVOKE.Animation_AnimateTo__SWIG_2(swigCPtr, Property.getCPtr(target), PropertyValue.getCPtr(destinationValue), TimePeriod.getCPtr(period));
893             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
894         }
895
896         internal void AnimateTo(Property target, PropertyValue destinationValue, AlphaFunction alpha, TimePeriod period)
897         {
898             NDalicPINVOKE.Animation_AnimateTo__SWIG_3(swigCPtr, Property.getCPtr(target), PropertyValue.getCPtr(destinationValue), AlphaFunction.getCPtr(alpha), TimePeriod.getCPtr(period));
899             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
900         }
901
902         internal void AnimateBetween(Property target, KeyFrames keyFrames)
903         {
904             NDalicPINVOKE.Animation_AnimateBetween__SWIG_0(swigCPtr, Property.getCPtr(target), KeyFrames.getCPtr(keyFrames));
905             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
906         }
907
908         internal void AnimateBetween(Property target, KeyFrames keyFrames, Animation.Interpolation interpolation)
909         {
910             NDalicPINVOKE.Animation_AnimateBetween__SWIG_1(swigCPtr, Property.getCPtr(target), KeyFrames.getCPtr(keyFrames), (int)interpolation);
911             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
912         }
913
914         internal void AnimateBetween(Property target, KeyFrames keyFrames, AlphaFunction alpha)
915         {
916             NDalicPINVOKE.Animation_AnimateBetween__SWIG_2(swigCPtr, Property.getCPtr(target), KeyFrames.getCPtr(keyFrames), AlphaFunction.getCPtr(alpha));
917             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
918         }
919
920         internal void AnimateBetween(Property target, KeyFrames keyFrames, AlphaFunction alpha, Animation.Interpolation interpolation)
921         {
922             NDalicPINVOKE.Animation_AnimateBetween__SWIG_3(swigCPtr, Property.getCPtr(target), KeyFrames.getCPtr(keyFrames), AlphaFunction.getCPtr(alpha), (int)interpolation);
923             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
924         }
925
926         internal void AnimateBetween(Property target, KeyFrames keyFrames, TimePeriod period)
927         {
928             NDalicPINVOKE.Animation_AnimateBetween__SWIG_4(swigCPtr, Property.getCPtr(target), KeyFrames.getCPtr(keyFrames), TimePeriod.getCPtr(period));
929             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
930         }
931
932         internal void AnimateBetween(Property target, KeyFrames keyFrames, TimePeriod period, Animation.Interpolation interpolation)
933         {
934             NDalicPINVOKE.Animation_AnimateBetween__SWIG_5(swigCPtr, Property.getCPtr(target), KeyFrames.getCPtr(keyFrames), TimePeriod.getCPtr(period), (int)interpolation);
935             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
936         }
937
938         internal void AnimateBetween(Property target, KeyFrames keyFrames, AlphaFunction alpha, TimePeriod period)
939         {
940             NDalicPINVOKE.Animation_AnimateBetween__SWIG_6(swigCPtr, Property.getCPtr(target), KeyFrames.getCPtr(keyFrames), AlphaFunction.getCPtr(alpha), TimePeriod.getCPtr(period));
941             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
942         }
943
944         internal void AnimateBetween(Property target, KeyFrames keyFrames, AlphaFunction alpha, TimePeriod period, Animation.Interpolation interpolation)
945         {
946             NDalicPINVOKE.Animation_AnimateBetween__SWIG_7(swigCPtr, Property.getCPtr(target), KeyFrames.getCPtr(keyFrames), AlphaFunction.getCPtr(alpha), TimePeriod.getCPtr(period), (int)interpolation);
947             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
948         }
949
950         internal void Animate(Actor actor, Path path, Vector3 forward)
951         {
952             NDalicPINVOKE.Animation_Animate__SWIG_0(swigCPtr, Actor.getCPtr(actor), Path.getCPtr(path), Vector3.getCPtr(forward));
953             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
954         }
955
956         internal void Animate(Actor actor, Path path, Vector3 forward, AlphaFunction alpha)
957         {
958             NDalicPINVOKE.Animation_Animate__SWIG_1(swigCPtr, Actor.getCPtr(actor), Path.getCPtr(path), Vector3.getCPtr(forward), AlphaFunction.getCPtr(alpha));
959             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
960         }
961
962         internal void Animate(Actor actor, Path path, Vector3 forward, TimePeriod period)
963         {
964             NDalicPINVOKE.Animation_Animate__SWIG_2(swigCPtr, Actor.getCPtr(actor), Path.getCPtr(path), Vector3.getCPtr(forward), TimePeriod.getCPtr(period));
965             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
966         }
967
968         internal void Animate(Actor actor, Path path, Vector3 forward, AlphaFunction alpha, TimePeriod period)
969         {
970             NDalicPINVOKE.Animation_Animate__SWIG_3(swigCPtr, Actor.getCPtr(actor), Path.getCPtr(path), Vector3.getCPtr(forward), AlphaFunction.getCPtr(alpha), TimePeriod.getCPtr(period));
971             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
972         }
973
974         internal void Show(Actor actor, float delaySeconds)
975         {
976             NDalicPINVOKE.Animation_Show(swigCPtr, Actor.getCPtr(actor), delaySeconds);
977             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
978         }
979
980         internal void Hide(Actor actor, float delaySeconds)
981         {
982             NDalicPINVOKE.Animation_Hide(swigCPtr, Actor.getCPtr(actor), delaySeconds);
983             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
984         }
985
986         /// <summary>
987         /// Enumeration for what to do when the animation ends, is stopped, or is destroyed.<br>
988         /// Cancel : When the animation ends, the animated property values are saved.<br>
989         /// Discard : When the animation ends, the animated property values are forgotten.<br>
990         /// StopFinal : If the animation is stopped, the animated property values are saved as if the animation had run to completion, otherwise behaves like Cancel.<br>
991         /// </summary>
992         public enum EndActions
993         {
994             Cancel,
995             Discard,
996             StopFinal
997         }
998
999         /// <summary>
1000         /// Enumeration for what interpolation method to use on key-frame animations.<br>
1001         /// Linear : Values in between key frames are interpolated using a linear polynomial. (Default).<br>
1002         /// Cubic : Values in between key frames are interpolated using a cubic polynomial.<br>
1003         /// </summary>
1004         public enum Interpolation
1005         {
1006             Linear,
1007             Cubic
1008         }
1009
1010         /// <summary>
1011         /// Enumeration for what state the animation is in.<br>
1012         /// Note: Calling Reset() on this class will NOT reset the animation. It will call BaseHandle.Reset() which drops the object handle.<br>
1013         /// </summary>
1014         public enum States
1015         {
1016             Stopped,
1017             Playing,
1018             Paused
1019         }
1020
1021     }
1022
1023 }