2 * Copyright(c) 2018 Samsung Electronics Co., Ltd.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
21 using System.ComponentModel;
22 using System.Runtime.InteropServices;
23 using Tizen.NUI.BaseComponents;
25 using System.Collections;
26 using System.Collections.Generic;
28 using System.Reflection;
30 using System.Globalization;
33 /// Animation can be used to animate the properties of any number of objects, typically view.<br />
34 /// If the "Finished" event is connected to a member function of an object, it must be disconnected before the object is destroyed.<br />
35 /// This is typically done in the object destructor, and requires either the animation handle to be stored.<br />
36 /// The overall animation time is superseded by the values given in the animation time used when calling the AnimateTo(), AnimateBy(), AnimateBetween() and AnimatePath() methods.<br />
37 /// If any of the individual calls to those functions exceeds the overall animation time (Duration), then the overall animation time is automatically extended.<br />
39 /// <since_tizen> 3 </since_tizen>
40 public class Animation : BaseHandle
42 private static bool? disableAnimation = null;
44 private global::System.Runtime.InteropServices.HandleRef swigCPtr;
46 private AnimationFinishedEventCallbackType _animationFinishedEventCallback;
47 private System.IntPtr _finishedCallbackOfNative;
49 private AnimationProgressReachedEventCallbackType _animationProgressReachedEventCallback;
52 /// Creates an initialized animation.<br />
53 /// The animation will not loop.<br />
54 /// The default end action is "Cancel".<br />
55 /// The default alpha function is linear.<br />
57 /// <remarks>DurationmSeconds must be greater than zero.</remarks>
58 /// <param name="durationMilliSeconds">The duration in milliseconds.</param>
59 /// <since_tizen> 3 </since_tizen>
60 public Animation(int durationMilliSeconds) : this(Interop.Animation.Animation_New((float)durationMilliSeconds / 1000.0f), true)
62 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
65 internal Animation(global::System.IntPtr cPtr, bool cMemoryOwn) : base(Interop.Animation.Animation_SWIGUpcast(cPtr), cMemoryOwn)
67 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
69 _animationFinishedEventCallback = OnFinished;
70 _finishedCallbackOfNative = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate<System.Delegate>(_animationFinishedEventCallback);
73 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
74 private delegate void AnimationFinishedEventCallbackType(IntPtr data);
76 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
77 private delegate void AnimationProgressReachedEventCallbackType(IntPtr data);
79 private event EventHandler _animationFinishedEventHandler;
82 * @brief Event for the finished signal which can be used to subscribe or unsubscribe the event handler.
83 * The finished signal is emitted when an animation's animations have finished.
85 /// <since_tizen> 3 </since_tizen>
86 public event EventHandler Finished
90 if (_animationFinishedEventHandler == null && disposed == false)
92 FinishedSignal().Connect(_finishedCallbackOfNative);
94 _animationFinishedEventHandler += value;
98 _animationFinishedEventHandler -= value;
100 if (_animationFinishedEventHandler == null && FinishedSignal().Empty() == false)
102 FinishedSignal().Disconnect(_finishedCallbackOfNative);
107 private event EventHandler _animationProgressReachedEventHandler;
110 * @brief Event for the ProgressReached signal, which can be used to subscribe or unsubscribe the event handler.
111 * The ProgressReached signal is emitted when the animation has reached a given progress percentage, this is set in the api SetProgressNotification.
113 /// <since_tizen> 3 </since_tizen>
114 public event EventHandler ProgressReached
118 if (_animationProgressReachedEventHandler == null)
120 _animationProgressReachedEventCallback = OnProgressReached;
121 ProgressReachedSignal().Connect(_animationProgressReachedEventCallback);
124 _animationProgressReachedEventHandler += value;
128 _animationProgressReachedEventHandler -= value;
130 if (_animationProgressReachedEventHandler == null && ProgressReachedSignal().Empty() == false)
132 ProgressReachedSignal().Disconnect(_animationProgressReachedEventCallback);
138 /// Enumeration for what to do when the animation ends, stopped, or destroyed.
140 /// <since_tizen> 3 </since_tizen>
141 public enum EndActions
144 /// When the animation ends, the animated property values are saved.
148 /// When the animation ends, the animated property values are forgotten.
152 /// If the animation is stopped, the animated property values are saved as if the animation had run to completion, otherwise behaves like cancel.
158 /// Enumeration for what interpolation method to use on key-frame animations.
160 /// <since_tizen> 3 </since_tizen>
161 public enum Interpolation
164 /// Values in between key frames are interpolated using a linear polynomial. (Default)
168 /// Values in between key frames are interpolated using a cubic polynomial.
174 /// Enumeration for what state the animation is in.
176 /// <remarks>Calling Reset() on this class will not reset the animation. It will call the BaseHandle.Reset() which drops the object handle.</remarks>
177 /// <since_tizen> 3 </since_tizen>
181 /// The animation has stopped.
185 /// The animation is playing.
189 /// The animation is paused.
195 /// Gets or sets the duration in milliseconds of the animation.
197 /// <since_tizen> 3 </since_tizen>
202 SetDuration(MilliSecondsToSeconds(value));
206 return SecondsToMilliSeconds(GetDuration());
211 /// Gets or sets the default alpha function for the animation.
213 /// <since_tizen> 3 </since_tizen>
214 public AlphaFunction DefaultAlphaFunction
218 SetDefaultAlphaFunction(value);
222 AlphaFunction ret = GetDefaultAlphaFunction();
228 /// Queries the state of the animation.
230 /// <since_tizen> 3 </since_tizen>
240 /// Set: Enables looping for a specified number of repeats. A zero is the same as Looping = true; i.e., repeat forever.<br />
241 /// This property resets the looping value and should not be used with the Looping property.<br />
242 /// Setting this parameter does not cause the animation to Play().<br />
243 /// Get: Gets the loop count. A zero is the same as Looping = true; i.e., repeat forever.<br />
244 /// The loop count is initially 1 for play once.<br />
246 /// <since_tizen> 3 </since_tizen>
255 int ret = GetLoopCount();
261 /// Gets or sets the status of whether the animation will loop.<br />
262 /// This property resets the loop count and should not be used with the LoopCount property.<br />
263 /// Setting this parameter does not cause the animation to Play().<br />
265 /// <since_tizen> 3 </since_tizen>
274 bool ret = IsLooping();
281 /// Gets or sets the end action of the animation.<br />
282 /// This action is performed when the animation ends or if it is stopped.<br />
283 /// The default end action is cancel.<br />
285 /// <since_tizen> 3 </since_tizen>
286 public EndActions EndAction
294 return GetEndAction();
299 /// Gets the current loop count.<br />
300 /// A value 0 indicating the current loop count when looping.<br />
302 /// <since_tizen> 3 </since_tizen>
303 public int CurrentLoop
307 return GetCurrentLoop();
312 /// Gets or sets the disconnect action.<br />
313 /// If any of the animated property owners are disconnected from the stage while the animation is being played, then this action is performed.<br />
314 /// The default action is cancel.<br />
316 /// <since_tizen> 3 </since_tizen>
317 public EndActions DisconnectAction
321 Interop.Animation.Animation_SetDisconnectAction(swigCPtr, (int)value);
322 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
326 Animation.EndActions ret = (Animation.EndActions)Interop.Animation.Animation_GetDisconnectAction(swigCPtr);
327 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
334 /// Gets or sets the progress of the animation.<br />
335 /// The animation will play (or continue playing) from this point.<br />
336 /// The progress must be in the 0-1 interval or in the play range interval if defined<br />
337 /// otherwise, it will be ignored.<br />
339 /// <since_tizen> 3 </since_tizen>
340 public float CurrentProgress
344 Interop.Animation.Animation_SetCurrentProgress(swigCPtr, value);
345 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
349 float ret = Interop.Animation.Animation_GetCurrentProgress(swigCPtr);
350 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
356 /// Gets or sets specificifications of a speed factor for the animation.<br />
357 /// The speed factor is a multiplier of the normal velocity of the animation.<br />
358 /// Values between [0, 1] will slow down the animation and values above one will speed up the animation.<br />
359 /// It is also possible to specify a negative multiplier to play the animation in reverse.<br />
361 /// <since_tizen> 3 </since_tizen>
362 public float SpeedFactor
366 Interop.Animation.Animation_SetSpeedFactor(swigCPtr, value);
367 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
371 float ret = Interop.Animation.Animation_GetSpeedFactor(swigCPtr);
372 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
378 /// Gets or sets the playing range.<br />
379 /// Animation will play between the values specified. Both values (range.x and range.y ) should be between 0-1,
380 /// otherwise they will be ignored. If the range provided is not in proper order (minimum, maximum ), it will be reordered.<br />
382 /// <since_tizen> 3 </since_tizen>
383 public RelativeVector2 PlayRange
387 Interop.Animation.Animation_SetPlayRange(swigCPtr, Vector2.getCPtr(value));
388 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
392 Vector2 ret = new Vector2(Interop.Animation.Animation_GetPlayRange(swigCPtr), true);
393 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
400 /// Gets or sets the progress notification marker which triggers the ProgressReachedSignal.<br />
401 /// Percentage of animation progress should be greater than 0 and less than 1, for example, 0.3 for 30% <br />
402 /// One notification can be set on each animation.
404 /// <since_tizen> 3 </since_tizen>
405 public float ProgressNotification
409 Interop.Animation.Animation_SetProgressNotification(swigCPtr, value);
410 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
414 float ret = Interop.Animation.Animation_GetProgressNotification(swigCPtr);
415 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
421 /// Gets or sets the properties of the animation.
423 /// Deprecated. Do not use.
424 public string[] Properties
431 /// Gets or sets the destination value for each property of the animation.
433 /// Deprecated. Do not use.
434 public string[] DestValue
441 /// Gets or sets the start time for each property of the animation.
443 /// Deprecated. Do not use.
444 public int[] StartTime
451 /// Gets or sets the end time for each property of the animation.
453 /// Deprecated. Do not use.
460 private bool DisableAnimation
464 if (disableAnimation.HasValue == false)
466 string type = Environment.GetEnvironmentVariable("PlatformSmartType");
468 disableAnimation = true;
470 disableAnimation = false;
472 return disableAnimation.Value;
477 /// Downcasts a handle to animation handle.<br />
478 /// If handle points to an animation object, the downcast produces a valid handle.<br />
479 /// If not, the returned handle is left uninitialized.<br />
481 /// <param name="handle">Handle to an object.</param>
482 /// <returns>Handle to an animation object or an uninitialized handle.</returns>
483 /// <since_tizen> 3 </since_tizen>
484 public static Animation DownCast(BaseHandle handle)
486 Animation ret = Registry.GetManagedBaseHandleFromNativePtr(handle) as Animation;
487 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
492 /// Stops the animation.
494 /// <param name="action">The end action can be set.</param>
495 /// <since_tizen> 3 </since_tizen>
496 public void Stop(EndActions action = EndActions.Cancel)
498 SetEndAction(action);
499 Interop.Animation.Animation_Stop(swigCPtr);
500 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
504 /// Animates a property value by a relative amount.<br />
506 /// <param name="target">The target object to animate.</param>
507 /// <param name="property">The target property to animate.</param>
508 /// <param name="relativeValue">The property value will change by this amount.</param>
509 /// <param name="alphaFunction">The alpha function to apply.</param>
510 /// <since_tizen> 3 </since_tizen>
511 public void AnimateBy(View target, string property, object relativeValue, AlphaFunction alphaFunction = null)
513 Property _prop = PropertyHelper.GetPropertyFromString(target, property);
515 PropertyType propertyType = target.GetPropertyType(_prop.propertyIndex);
516 if (propertyType.Equals(PropertyType.Float))
518 System.Type type = relativeValue.GetType();
519 if (type.Equals(typeof(System.Int32)) || type.Equals(typeof(int)))
521 int num = (int)relativeValue;
522 relativeValue = (float)num;
526 PropertyValue val = PropertyValue.CreateFromObject(relativeValue);
528 if (alphaFunction != null)
530 AnimateBy(_prop, val, alphaFunction);
534 AnimateBy(_prop, val);
539 /// Animates a property value by a relative amount.<br />
541 /// <param name="target">The target object to animate.</param>
542 /// <param name="property">The target property to animate.</param>
543 /// <param name="relativeValue">The property value will change by this amount.</param>
544 /// <param name="startTime">The start time of the animation.</param>
545 /// <param name="endTime">The end time of the animation.</param>
546 /// <param name="alphaFunction">The alpha function to apply.</param>
547 /// <since_tizen> 3 </since_tizen>
548 public void AnimateBy(View target, string property, object relativeValue, int startTime, int endTime, AlphaFunction alphaFunction = null)
550 Property _prop = PropertyHelper.GetPropertyFromString(target, property);
552 PropertyType propertyType = target.GetPropertyType(_prop.propertyIndex);
553 if (propertyType.Equals(PropertyType.Float))
555 System.Type type = relativeValue.GetType();
556 if (type.Equals(typeof(System.Int32)) || type.Equals(typeof(int)))
558 int num = (int)relativeValue;
559 relativeValue = (float)num;
563 PropertyValue val = PropertyValue.CreateFromObject(relativeValue);
565 if (alphaFunction != null)
567 Tizen.NUI.TimePeriod time = new Tizen.NUI.TimePeriod(MilliSecondsToSeconds(startTime), MilliSecondsToSeconds(endTime - startTime));
568 AnimateBy(_prop, val, alphaFunction, time);
572 Tizen.NUI.TimePeriod time = new Tizen.NUI.TimePeriod(MilliSecondsToSeconds(startTime), MilliSecondsToSeconds(endTime - startTime));
573 AnimateBy(_prop, val, time);
578 /// Animates a property to a destination value.<br />
580 /// <param name="target">The target object to animate.</param>
581 /// <param name="property">The target property to animate.</param>
582 /// <param name="destinationValue">The destination value.</param>
583 /// <param name="alphaFunction">The alpha function to apply.</param>
584 /// <since_tizen> 3 </since_tizen>
585 public void AnimateTo(View target, string property, object destinationValue, AlphaFunction alphaFunction = null)
587 Property _prop = PropertyHelper.GetPropertyFromString(target, property);
589 PropertyType propertyType = target.GetPropertyType(_prop.propertyIndex);
590 if (propertyType.Equals(PropertyType.Float))
592 System.Type type = destinationValue.GetType();
593 if (type.Equals(typeof(System.Int32)) || type.Equals(typeof(int)))
595 int num = (int)destinationValue;
596 destinationValue = (float)num;
600 PropertyValue val = PropertyValue.CreateFromObject(destinationValue);
602 if (alphaFunction != null)
604 AnimateTo(_prop, val, alphaFunction);
608 AnimateTo(_prop, val);
613 /// Animates one or more properties to a destination value.<br />
615 /// <param name="target">The target object to animate.</param>
616 /// Deprecated. Do not use.
617 public void PlayAnimateTo(View target)
622 /// Animates a property to a destination value.<br />
624 /// <param name="target">The target object to animate.</param>
625 /// <param name="property">The target property to animate.</param>
626 /// <param name="destinationValue">The destination value.</param>
627 /// <param name="startTime">The start time of the animation.</param>
628 /// <param name="endTime">The end time of the animation.</param>
629 /// <param name="alphaFunction">The alpha function to apply.</param>
630 /// <since_tizen> 3 </since_tizen>
631 public void AnimateTo(View target, string property, object destinationValue, int startTime, int endTime, AlphaFunction alphaFunction = null)
633 Property _prop = PropertyHelper.GetPropertyFromString(target, property);
635 PropertyType propertyType = target.GetPropertyType(_prop.propertyIndex);
636 if (propertyType.Equals(PropertyType.Float))
638 System.Type type = destinationValue.GetType();
639 if (type.Equals(typeof(System.Int32)) || type.Equals(typeof(int)))
641 int num = (int)destinationValue;
642 destinationValue = (float)num;
646 PropertyValue val = PropertyValue.CreateFromObject(destinationValue);
648 if (alphaFunction != null)
650 Tizen.NUI.TimePeriod time = new Tizen.NUI.TimePeriod(MilliSecondsToSeconds(startTime), MilliSecondsToSeconds(endTime - startTime));
651 AnimateTo(_prop, val, alphaFunction, time);
655 Tizen.NUI.TimePeriod time = new Tizen.NUI.TimePeriod(MilliSecondsToSeconds(startTime), MilliSecondsToSeconds(endTime - startTime));
656 AnimateTo(_prop, val, time);
661 /// Animates a property between keyframes.
663 /// <param name="target">The target object to animate.</param>
664 /// <param name="property">The target property to animate.</param>
665 /// <param name="keyFrames">The set of time or value pairs between which to animate.</param>
666 /// <param name="interpolation">The method used to interpolate between values.</param>
667 /// <param name="alphaFunction">The alpha function to apply.</param>
668 /// <since_tizen> 3 </since_tizen>
669 public void AnimateBetween(View target, string property, KeyFrames keyFrames, Interpolation interpolation = Interpolation.Linear, AlphaFunction alphaFunction = null)
671 Property _prop = PropertyHelper.GetPropertyFromString(target, property);
673 if (_prop.propertyIndex == Property.INVALID_INDEX)
675 throw new System.ArgumentException("second argument string property is invalid parameter!");
678 if (alphaFunction != null)
680 AnimateBetween(_prop, keyFrames, alphaFunction, interpolation);
684 AnimateBetween(_prop, keyFrames, interpolation);
689 /// Animates a property between keyframes.
691 /// <param name="target">The target object to animate</param>
692 /// <param name="property">The target property to animate</param>
693 /// <param name="keyFrames">The set of time/value pairs between which to animate</param>
694 /// <param name="startTime">The start time of animation in milliseconds.</param>
695 /// <param name="endTime">The end time of animation in milliseconds.</param>
696 /// <param name="interpolation">The method used to interpolate between values.</param>
697 /// <param name="alphaFunction">The alpha function to apply.</param>
698 /// <since_tizen> 3 </since_tizen>
699 public void AnimateBetween(View target, string property, KeyFrames keyFrames, int startTime, int endTime, Interpolation interpolation = Interpolation.Linear, AlphaFunction alphaFunction = null)
701 Property _prop = PropertyHelper.GetPropertyFromString(target, property);
703 Tizen.NUI.TimePeriod time = new Tizen.NUI.TimePeriod(MilliSecondsToSeconds(startTime), MilliSecondsToSeconds(endTime - startTime));
704 if (alphaFunction != null)
706 AnimateBetween(_prop, keyFrames, alphaFunction, time, interpolation);
710 AnimateBetween(_prop, keyFrames, time, interpolation);
715 /// Animates the view's position and orientation through a predefined path.<br />
716 /// The view will rotate to orient the supplied forward vector with the path's tangent.<br />
717 /// If forward is the zero vector then no rotation will happen.<br />
719 /// <param name="view">The view to animate.</param>
720 /// <param name="path">It defines position and orientation.</param>
721 /// <param name="forward">The vector (in local space coordinate system) will be oriented with the path's tangent direction.</param>
722 /// <param name="alphaFunction">The alpha function to apply.</param>
723 /// <since_tizen> 3 </since_tizen>
724 public void AnimatePath(View view, Path path, Vector3 forward, AlphaFunction alphaFunction = null)
726 if (alphaFunction == null)
728 Animate(view, path, forward);
732 Animate(view, path, forward, alphaFunction);
737 /// Animates the view's position and orientation through a predefined path.<br />
738 /// The view will rotate to orient the supplied forward vector with the path's tangent.<br />
739 /// If forward is the zero vector then no rotation will happen.<br />
741 /// <param name="view">The view to animate.</param>
742 /// <param name="path">It defines position and orientation.</param>
743 /// <param name="forward">The vector (in local space coordinate system) will be oriented with the path's tangent direction.</param>
744 /// <param name="startTime">The start time of the animation.</param>
745 /// <param name="endTime">The end time of the animation.</param>
746 /// <param name="alphaFunction">The alpha function to apply.</param>
747 /// <since_tizen> 3 </since_tizen>
748 public void AnimatePath(View view, Path path, Vector3 forward, int startTime, int endTime, AlphaFunction alphaFunction = null)
750 TimePeriod time = new TimePeriod(MilliSecondsToSeconds(startTime), MilliSecondsToSeconds(endTime - startTime));
751 if (alphaFunction == null)
753 Animate(view, path, forward, time);
757 Animate(view, path, forward, alphaFunction, time);
762 /// Creates an initialized animation.<br />
763 /// The animation will not loop.<br />
764 /// The default end action is "Cancel".<br />
765 /// The default alpha function is linear.<br />
767 /// <since_tizen> 3 </since_tizen>
768 public Animation() : this(Interop.Animation.Animation_New(0.0f), true)
770 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
774 /// Plays the animation.
776 /// <since_tizen> 3 </since_tizen>
779 Interop.Animation.Animation_Play(swigCPtr);
780 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
782 if (DisableAnimation == true)
783 Stop(EndActions.StopFinal);
787 /// Plays the animation from a given point.<br />
788 /// The progress must be in the 0-1 interval or in the play range interval if defined,
789 /// otherwise, it will be ignored.<br />
791 /// <param name="progress">A value between [0,1], or between the play range if specified, from where the animation should start playing.</param>
792 /// <since_tizen> 3 </since_tizen>
793 public void PlayFrom(float progress)
795 Interop.Animation.Animation_PlayFrom(swigCPtr, progress);
796 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
800 /// Plays the animation after a given delay time.<br/>
801 /// The delay time is not included in the looping time.<br/>
802 /// When the delay time is a negative value, it would treat as play immediately.<br/>
804 /// <param name="delayMilliseconds">The delay time.</param>
805 /// <since_tizen> 4 </since_tizen>
806 public void PlayAfter(int delayMilliseconds)
808 Interop.Animation.Animation_PlayAfter(swigCPtr, MilliSecondsToSeconds(delayMilliseconds));
809 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
813 /// Pauses the animation.
815 /// <since_tizen> 3 </since_tizen>
818 Interop.Animation.Animation_Pause(swigCPtr);
819 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
823 /// Stops the animation.
825 /// <since_tizen> 3 </since_tizen>
828 Interop.Animation.Animation_Stop(swigCPtr);
829 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
833 /// Clears the animation.<br />
834 /// This disconnects any objects that were being animated, effectively stopping the animation.<br />
836 /// <since_tizen> 3 </since_tizen>
839 Interop.Animation.Animation_Clear(swigCPtr);
840 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
843 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Animation obj)
845 return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
848 internal void SetDuration(float seconds)
850 Interop.Animation.Animation_SetDuration(swigCPtr, seconds);
851 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
854 internal float GetDuration()
856 float ret = Interop.Animation.Animation_GetDuration(swigCPtr);
857 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
861 internal void SetLooping(bool looping)
863 Interop.Animation.Animation_SetLooping(swigCPtr, looping);
864 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
867 internal void SetLoopCount(int count)
869 Interop.Animation.Animation_SetLoopCount(swigCPtr, count);
870 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
873 internal int GetLoopCount()
875 int ret = Interop.Animation.Animation_GetLoopCount(swigCPtr);
876 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
880 internal int GetCurrentLoop()
882 int ret = Interop.Animation.Animation_GetCurrentLoop(swigCPtr);
883 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
887 internal bool IsLooping()
889 bool ret = Interop.Animation.Animation_IsLooping(swigCPtr);
890 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
894 internal void SetEndAction(Animation.EndActions action)
896 Interop.Animation.Animation_SetEndAction(swigCPtr, (int)action);
897 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
900 internal Animation.EndActions GetEndAction()
902 Animation.EndActions ret = (Animation.EndActions)Interop.Animation.Animation_GetEndAction(swigCPtr);
903 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
907 internal void SetDisconnectAction(Animation.EndActions disconnectAction)
909 Interop.Animation.Animation_SetDisconnectAction(swigCPtr, (int)disconnectAction);
910 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
913 internal Animation.EndActions GetDisconnectAction()
915 Animation.EndActions ret = (Animation.EndActions)Interop.Animation.Animation_GetDisconnectAction(swigCPtr);
916 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
920 internal void SetDefaultAlphaFunction(AlphaFunction alpha)
922 Interop.Animation.Animation_SetDefaultAlphaFunction(swigCPtr, AlphaFunction.getCPtr(alpha));
923 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
926 internal AlphaFunction GetDefaultAlphaFunction()
928 AlphaFunction ret = new AlphaFunction(Interop.Animation.Animation_GetDefaultAlphaFunction(swigCPtr), true);
929 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
933 internal void SetCurrentProgress(float progress)
935 Interop.Animation.Animation_SetCurrentProgress(swigCPtr, progress);
936 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
939 internal float GetCurrentProgress()
941 float ret = Interop.Animation.Animation_GetCurrentProgress(swigCPtr);
942 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
946 internal void SetSpeedFactor(float factor)
948 Interop.Animation.Animation_SetSpeedFactor(swigCPtr, factor);
949 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
952 internal float GetSpeedFactor()
954 float ret = Interop.Animation.Animation_GetSpeedFactor(swigCPtr);
955 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
959 internal void SetPlayRange(Vector2 range)
961 Interop.Animation.Animation_SetPlayRange(swigCPtr, Vector2.getCPtr(range));
962 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
965 internal Vector2 GetPlayRange()
967 Vector2 ret = new Vector2(Interop.Animation.Animation_GetPlayRange(swigCPtr), true);
968 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
972 internal Animation.States GetState()
974 Animation.States ret = (Animation.States)Interop.Animation.Animation_GetState(swigCPtr);
975 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
979 internal AnimationSignal FinishedSignal()
981 AnimationSignal ret = new AnimationSignal(Interop.Animation.Animation_FinishedSignal(swigCPtr), false);
982 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
986 internal AnimationSignal ProgressReachedSignal()
988 AnimationSignal ret = new AnimationSignal(Interop.Animation.Animation_ProgressReachedSignal(swigCPtr), false);
989 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
993 internal void AnimateBy(Property target, PropertyValue relativeValue)
995 Interop.Animation.Animation_AnimateBy__SWIG_0(swigCPtr, Property.getCPtr(target), PropertyValue.getCPtr(relativeValue));
996 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
999 internal void AnimateBy(Property target, PropertyValue relativeValue, AlphaFunction alpha)
1001 Interop.Animation.Animation_AnimateBy__SWIG_1(swigCPtr, Property.getCPtr(target), PropertyValue.getCPtr(relativeValue), AlphaFunction.getCPtr(alpha));
1002 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1005 internal void AnimateBy(Property target, PropertyValue relativeValue, TimePeriod period)
1007 Interop.Animation.Animation_AnimateBy__SWIG_2(swigCPtr, Property.getCPtr(target), PropertyValue.getCPtr(relativeValue), TimePeriod.getCPtr(period));
1008 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1011 internal void AnimateBy(Property target, PropertyValue relativeValue, AlphaFunction alpha, TimePeriod period)
1013 Interop.Animation.Animation_AnimateBy__SWIG_3(swigCPtr, Property.getCPtr(target), PropertyValue.getCPtr(relativeValue), AlphaFunction.getCPtr(alpha), TimePeriod.getCPtr(period));
1014 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1017 internal void AnimateTo(Property target, PropertyValue destinationValue)
1019 Interop.Animation.Animation_AnimateTo__SWIG_0(swigCPtr, Property.getCPtr(target), PropertyValue.getCPtr(destinationValue));
1020 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1023 internal void AnimateTo(Property target, PropertyValue destinationValue, AlphaFunction alpha)
1025 Interop.Animation.Animation_AnimateTo__SWIG_1(swigCPtr, Property.getCPtr(target), PropertyValue.getCPtr(destinationValue), AlphaFunction.getCPtr(alpha));
1026 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1029 internal void AnimateTo(Property target, PropertyValue destinationValue, TimePeriod period)
1031 Interop.Animation.Animation_AnimateTo__SWIG_2(swigCPtr, Property.getCPtr(target), PropertyValue.getCPtr(destinationValue), TimePeriod.getCPtr(period));
1032 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1035 internal void AnimateTo(Property target, PropertyValue destinationValue, AlphaFunction alpha, TimePeriod period)
1037 Interop.Animation.Animation_AnimateTo__SWIG_3(swigCPtr, Property.getCPtr(target), PropertyValue.getCPtr(destinationValue), AlphaFunction.getCPtr(alpha), TimePeriod.getCPtr(period));
1038 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1041 internal void AnimateBetween(Property target, KeyFrames keyFrames)
1043 Interop.Animation.Animation_AnimateBetween__SWIG_0(swigCPtr, Property.getCPtr(target), KeyFrames.getCPtr(keyFrames));
1044 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1047 internal void AnimateBetween(Property target, KeyFrames keyFrames, Animation.Interpolation interpolation)
1049 Interop.Animation.Animation_AnimateBetween__SWIG_1(swigCPtr, Property.getCPtr(target), KeyFrames.getCPtr(keyFrames), (int)interpolation);
1050 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1053 internal void AnimateBetween(Property target, KeyFrames keyFrames, AlphaFunction alpha)
1055 Interop.Animation.Animation_AnimateBetween__SWIG_2(swigCPtr, Property.getCPtr(target), KeyFrames.getCPtr(keyFrames), AlphaFunction.getCPtr(alpha));
1056 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1059 internal void AnimateBetween(Property target, KeyFrames keyFrames, AlphaFunction alpha, Animation.Interpolation interpolation)
1061 Interop.Animation.Animation_AnimateBetween__SWIG_3(swigCPtr, Property.getCPtr(target), KeyFrames.getCPtr(keyFrames), AlphaFunction.getCPtr(alpha), (int)interpolation);
1062 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1065 internal void AnimateBetween(Property target, KeyFrames keyFrames, TimePeriod period)
1067 Interop.Animation.Animation_AnimateBetween__SWIG_4(swigCPtr, Property.getCPtr(target), KeyFrames.getCPtr(keyFrames), TimePeriod.getCPtr(period));
1068 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1071 internal void AnimateBetween(Property target, KeyFrames keyFrames, TimePeriod period, Animation.Interpolation interpolation)
1073 Interop.Animation.Animation_AnimateBetween__SWIG_5(swigCPtr, Property.getCPtr(target), KeyFrames.getCPtr(keyFrames), TimePeriod.getCPtr(period), (int)interpolation);
1074 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1077 internal void AnimateBetween(Property target, KeyFrames keyFrames, AlphaFunction alpha, TimePeriod period)
1079 Interop.Animation.Animation_AnimateBetween__SWIG_6(swigCPtr, Property.getCPtr(target), KeyFrames.getCPtr(keyFrames), AlphaFunction.getCPtr(alpha), TimePeriod.getCPtr(period));
1080 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1083 internal void AnimateBetween(Property target, KeyFrames keyFrames, AlphaFunction alpha, TimePeriod period, Animation.Interpolation interpolation)
1085 Interop.Animation.Animation_AnimateBetween__SWIG_7(swigCPtr, Property.getCPtr(target), KeyFrames.getCPtr(keyFrames), AlphaFunction.getCPtr(alpha), TimePeriod.getCPtr(period), (int)interpolation);
1086 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1089 internal void Animate(View view, Path path, Vector3 forward)
1091 Interop.Animation.Animation_Animate__SWIG_0(swigCPtr, View.getCPtr(view), Path.getCPtr(path), Vector3.getCPtr(forward));
1092 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1095 internal void Animate(View view, Path path, Vector3 forward, AlphaFunction alpha)
1097 Interop.Animation.Animation_Animate__SWIG_1(swigCPtr, View.getCPtr(view), Path.getCPtr(path), Vector3.getCPtr(forward), AlphaFunction.getCPtr(alpha));
1098 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1101 internal void Animate(View view, Path path, Vector3 forward, TimePeriod period)
1103 Interop.Animation.Animation_Animate__SWIG_2(swigCPtr, View.getCPtr(view), Path.getCPtr(path), Vector3.getCPtr(forward), TimePeriod.getCPtr(period));
1104 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1107 internal void Animate(View view, Path path, Vector3 forward, AlphaFunction alpha, TimePeriod period)
1109 Interop.Animation.Animation_Animate__SWIG_3(swigCPtr, View.getCPtr(view), Path.getCPtr(path), Vector3.getCPtr(forward), AlphaFunction.getCPtr(alpha), TimePeriod.getCPtr(period));
1110 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1113 internal void Show(View view, float delaySeconds)
1115 Interop.Animation.Animation_Show(swigCPtr, View.getCPtr(view), delaySeconds);
1116 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1119 internal void Hide(View view, float delaySeconds)
1121 Interop.Animation.Animation_Hide(swigCPtr, View.getCPtr(view), delaySeconds);
1122 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1126 /// To make animation instance be disposed.
1128 /// <since_tizen> 3 </since_tizen>
1129 protected override void Dispose(DisposeTypes type)
1133 if (_animationFinishedEventCallback != null)
1135 FinishedSignal().Disconnect(_finishedCallbackOfNative);
1138 if (_animationProgressReachedEventCallback != null)
1141 ProgressReachedSignal().Disconnect(_animationProgressReachedEventCallback);
1149 if(type == DisposeTypes.Explicit)
1152 //Release your own managed resources here.
1153 //You should release all of your own disposable objects here.
1156 else if(type == DisposeTypes.Implicit)
1166 //Release your own unmanaged resources here.
1167 //You should not access any managed member here except static instance.
1168 //because the execution order of Finalizes is non-deterministic.
1170 if (swigCPtr.Handle != global::System.IntPtr.Zero)
1174 swigCMemOwn = false;
1175 Interop.Animation.delete_Animation(swigCPtr);
1177 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
1183 private void OnFinished(IntPtr data)
1185 if (_animationFinishedEventHandler != null)
1187 //here we send all data to user event handlers
1188 _animationFinishedEventHandler(this, null);
1192 private void OnProgressReached(IntPtr data)
1194 if (_animationProgressReachedEventHandler != null)
1196 //here we send all data to user event handlers
1197 _animationProgressReachedEventHandler(this, null);
1201 private float MilliSecondsToSeconds(int millisec)
1203 return (float)millisec / 1000.0f;
1206 private int SecondsToMilliSeconds(float sec)
1208 return (int)(sec * 1000);