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.
22 using System.ComponentModel;
23 using System.Runtime.InteropServices;
24 using Tizen.NUI.BaseComponents;
26 using System.Collections;
27 using System.Collections.Generic;
29 using System.Reflection;
31 using Tizen.NUI.Binding.Internals;
32 using Tizen.NUI.Binding;
33 using System.Globalization;
34 using Tizen.NUI.Xaml.Internals;
37 /// Animation can be used to animate the properties of any number of objects, typically view.<br />
38 /// If the "Finished" event is connected to a member function of an object, it must be disconnected before the object is destroyed.<br />
39 /// This is typically done in the object destructor, and requires either the animation handle to be stored.<br />
40 /// 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 />
41 /// If any of the individual calls to those functions exceeds the overall animation time (Duration), then the overall animation time is automatically extended.<br />
43 /// <since_tizen> 3 </since_tizen>
44 public class Animation : BaseHandle
46 private static bool? disableAnimation = null;
48 private global::System.Runtime.InteropServices.HandleRef swigCPtr;
50 private AnimationFinishedEventCallbackType _animationFinishedEventCallback;
51 private System.IntPtr _finishedCallbackOfNative;
53 private AnimationProgressReachedEventCallbackType _animationProgressReachedEventCallback;
55 private string[] _properties = null;
56 private string[] _destValue = null;
57 private int[] _startTime = null;
58 private int[] _endTime = null;
61 /// Creates an initialized animation.<br />
62 /// The animation will not loop.<br />
63 /// The default end action is "Cancel".<br />
64 /// The default alpha function is linear.<br />
66 /// <remarks>DurationmSeconds must be greater than zero.</remarks>
67 /// <param name="durationMilliSeconds">The duration in milliseconds.</param>
68 /// <since_tizen> 3 </since_tizen>
69 public Animation(int durationMilliSeconds) : this(NDalicPINVOKE.Animation_New((float)durationMilliSeconds / 1000.0f), true)
71 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
74 internal Animation(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicPINVOKE.Animation_SWIGUpcast(cPtr), cMemoryOwn)
76 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
78 _animationFinishedEventCallback = OnFinished;
79 _finishedCallbackOfNative = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate<System.Delegate>(_animationFinishedEventCallback);
82 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
83 private delegate void AnimationFinishedEventCallbackType(IntPtr data);
85 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
86 private delegate void AnimationProgressReachedEventCallbackType(IntPtr data);
88 private event EventHandler _animationFinishedEventHandler;
91 * @brief Event for the finished signal which can be used to subscribe or unsubscribe the event handler.
92 * The finished signal is emitted when an animation's animations have finished.
94 /// <since_tizen> 3 </since_tizen>
95 public event EventHandler Finished
99 if (_animationFinishedEventHandler == null && disposed == false)
101 FinishedSignal().Connect(_finishedCallbackOfNative);
103 _animationFinishedEventHandler += value;
107 _animationFinishedEventHandler -= value;
109 if (_animationFinishedEventHandler == null && FinishedSignal().Empty() == false)
111 FinishedSignal().Disconnect(_finishedCallbackOfNative);
116 private event EventHandler _animationProgressReachedEventHandler;
119 * @brief Event for the ProgressReached signal, which can be used to subscribe or unsubscribe the event handler.
120 * The ProgressReached signal is emitted when the animation has reached a given progress percentage, this is set in the api SetProgressNotification.
122 /// <since_tizen> 3 </since_tizen>
123 public event EventHandler ProgressReached
127 if (_animationProgressReachedEventHandler == null)
129 _animationProgressReachedEventCallback = OnProgressReached;
130 ProgressReachedSignal().Connect(_animationProgressReachedEventCallback);
133 _animationProgressReachedEventHandler += value;
137 _animationProgressReachedEventHandler -= value;
139 if (_animationProgressReachedEventHandler == null && ProgressReachedSignal().Empty() == false)
141 ProgressReachedSignal().Disconnect(_animationProgressReachedEventCallback);
147 /// Enumeration for what to do when the animation ends, stopped, or destroyed.
149 /// <since_tizen> 3 </since_tizen>
150 public enum EndActions
153 /// When the animation ends, the animated property values are saved.
157 /// When the animation ends, the animated property values are forgotten.
161 /// If the animation is stopped, the animated property values are saved as if the animation had run to completion, otherwise behaves like cancel.
167 /// Enumeration for what interpolation method to use on key-frame animations.
169 /// <since_tizen> 3 </since_tizen>
170 public enum Interpolation
173 /// Values in between key frames are interpolated using a linear polynomial. (Default)
177 /// Values in between key frames are interpolated using a cubic polynomial.
183 /// Enumeration for what state the animation is in.
185 /// <remarks>Calling Reset() on this class will not reset the animation. It will call the BaseHandle.Reset() which drops the object handle.</remarks>
186 /// <since_tizen> 3 </since_tizen>
190 /// The animation has stopped.
194 /// The animation is playing.
198 /// The animation is paused.
204 /// Gets or sets the duration in milliseconds of the animation.
206 /// <since_tizen> 3 </since_tizen>
211 SetDuration(MilliSecondsToSeconds(value));
215 return SecondsToMilliSeconds(GetDuration());
220 /// Gets or sets the default alpha function for the animation.
222 /// <since_tizen> 3 </since_tizen>
223 public AlphaFunction DefaultAlphaFunction
227 SetDefaultAlphaFunction(value);
231 AlphaFunction ret = GetDefaultAlphaFunction();
237 /// Queries the state of the animation.
239 /// <since_tizen> 3 </since_tizen>
249 /// Set: Enables looping for a specified number of repeats. A zero is the same as Looping = true; i.e., repeat forever.<br />
250 /// This property resets the looping value and should not be used with the Looping property.<br />
251 /// Setting this parameter does not cause the animation to Play().<br />
252 /// Get: Gets the loop count. A zero is the same as Looping = true; i.e., repeat forever.<br />
253 /// The loop count is initially 1 for play once.<br />
255 /// <since_tizen> 3 </since_tizen>
264 int ret = GetLoopCount();
270 /// Gets or sets the status of whether the animation will loop.<br />
271 /// This property resets the loop count and should not be used with the LoopCount property.<br />
272 /// Setting this parameter does not cause the animation to Play().<br />
274 /// <since_tizen> 3 </since_tizen>
283 bool ret = IsLooping();
290 /// Gets or sets the end action of the animation.<br />
291 /// This action is performed when the animation ends or if it is stopped.<br />
292 /// The default end action is cancel.<br />
294 /// <since_tizen> 3 </since_tizen>
295 public EndActions EndAction
303 return GetEndAction();
308 /// Gets the current loop count.<br />
309 /// A value 0 indicating the current loop count when looping.<br />
311 /// <since_tizen> 3 </since_tizen>
312 public int CurrentLoop
316 return GetCurrentLoop();
321 /// Gets or sets the disconnect action.<br />
322 /// If any of the animated property owners are disconnected from the stage while the animation is being played, then this action is performed.<br />
323 /// The default action is cancel.<br />
325 /// <since_tizen> 3 </since_tizen>
326 public EndActions DisconnectAction
330 NDalicPINVOKE.Animation_SetDisconnectAction(swigCPtr, (int)value);
331 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
335 Animation.EndActions ret = (Animation.EndActions)NDalicPINVOKE.Animation_GetDisconnectAction(swigCPtr);
336 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
343 /// Gets or sets the progress of the animation.<br />
344 /// The animation will play (or continue playing) from this point.<br />
345 /// The progress must be in the 0-1 interval or in the play range interval if defined<br />
346 /// otherwise, it will be ignored.<br />
348 /// <since_tizen> 3 </since_tizen>
349 public float CurrentProgress
353 NDalicPINVOKE.Animation_SetCurrentProgress(swigCPtr, value);
354 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
358 float ret = NDalicPINVOKE.Animation_GetCurrentProgress(swigCPtr);
359 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
365 /// Gets or sets specificifications of a speed factor for the animation.<br />
366 /// The speed factor is a multiplier of the normal velocity of the animation.<br />
367 /// Values between [0, 1] will slow down the animation and values above one will speed up the animation.<br />
368 /// It is also possible to specify a negative multiplier to play the animation in reverse.<br />
370 /// <since_tizen> 3 </since_tizen>
371 public float SpeedFactor
375 NDalicPINVOKE.Animation_SetSpeedFactor(swigCPtr, value);
376 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
380 float ret = NDalicPINVOKE.Animation_GetSpeedFactor(swigCPtr);
381 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
387 /// Gets or sets the playing range.<br />
388 /// Animation will play between the values specified. Both values (range.x and range.y ) should be between 0-1,
389 /// otherwise they will be ignored. If the range provided is not in proper order (minimum, maximum ), it will be reordered.<br />
391 /// <since_tizen> 3 </since_tizen>
392 public RelativeVector2 PlayRange
396 NDalicPINVOKE.Animation_SetPlayRange(swigCPtr, Vector2.getCPtr(value));
397 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
401 Vector2 ret = new Vector2(NDalicPINVOKE.Animation_GetPlayRange(swigCPtr), true);
402 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
409 /// Gets or sets the progress notification marker which triggers the ProgressReachedSignal.<br />
410 /// Percentage of animation progress should be greater than 0 and less than 1, for example, 0.3 for 30% <br />
411 /// One notification can be set on each animation.
413 /// <since_tizen> 3 </since_tizen>
414 public float ProgressNotification
418 NDalicPINVOKE.Animation_SetProgressNotification(swigCPtr, value);
419 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
423 float ret = NDalicPINVOKE.Animation_GetProgressNotification(swigCPtr);
424 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
430 /// Gets or sets the properties of the animation.
432 public string[] Properties
445 /// Gets or sets the destination value for each property of the animation.
447 public string[] DestValue
460 /// Gets or sets the start time for each property of the animation.
462 public int[] StartTime
475 /// Gets or sets the end time for each property of the animation.
489 private bool DisableAnimation
493 if (disableAnimation.HasValue == false)
495 string type = Environment.GetEnvironmentVariable("PlatformSmartType");
497 disableAnimation = true;
499 disableAnimation = false;
501 return disableAnimation.Value;
506 /// Downcasts a handle to animation handle.<br />
507 /// If handle points to an animation object, the downcast produces a valid handle.<br />
508 /// If not, the returned handle is left uninitialized.<br />
510 /// <param name="handle">Handle to an object.</param>
511 /// <returns>Handle to an animation object or an uninitialized handle.</returns>
512 /// <since_tizen> 3 </since_tizen>
513 public static Animation DownCast(BaseHandle handle)
515 Animation ret = Registry.GetManagedBaseHandleFromNativePtr(handle) as Animation;
516 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
521 /// Stops the animation.
523 /// <param name="action">The end action can be set.</param>
524 /// <since_tizen> 3 </since_tizen>
525 public void Stop(EndActions action = EndActions.Cancel)
527 SetEndAction(action);
528 NDalicPINVOKE.Animation_Stop(swigCPtr);
529 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
533 /// Animates a property value by a relative amount.<br />
535 /// <param name="target">The target object to animate.</param>
536 /// <param name="property">The target property to animate.</param>
537 /// <param name="relativeValue">The property value will change by this amount.</param>
538 /// <param name="alphaFunction">The alpha function to apply.</param>
539 /// <since_tizen> 3 </since_tizen>
540 public void AnimateBy(View target, string property, object relativeValue, AlphaFunction alphaFunction = null)
542 Property _prop = PropertyHelper.GetPropertyFromString(target, property);
544 PropertyType propertyType = target.GetPropertyType(_prop.propertyIndex);
545 if (propertyType.Equals(PropertyType.Float))
547 System.Type type = relativeValue.GetType();
548 if (type.Equals(typeof(System.Int32)) || type.Equals(typeof(int)))
550 int num = (int)relativeValue;
551 relativeValue = (float)num;
555 PropertyValue val = PropertyValue.CreateFromObject(relativeValue);
557 if (alphaFunction != null)
559 AnimateBy(_prop, val, alphaFunction);
563 AnimateBy(_prop, val);
568 /// Animates a property value by a relative amount.<br />
570 /// <param name="target">The target object to animate.</param>
571 /// <param name="property">The target property to animate.</param>
572 /// <param name="relativeValue">The property value will change by this amount.</param>
573 /// <param name="startTime">The start time of the animation.</param>
574 /// <param name="endTime">The end time of the animation.</param>
575 /// <param name="alphaFunction">The alpha function to apply.</param>
576 /// <since_tizen> 3 </since_tizen>
577 public void AnimateBy(View target, string property, object relativeValue, int startTime, int endTime, AlphaFunction alphaFunction = null)
579 Property _prop = PropertyHelper.GetPropertyFromString(target, property);
581 PropertyType propertyType = target.GetPropertyType(_prop.propertyIndex);
582 if (propertyType.Equals(PropertyType.Float))
584 System.Type type = relativeValue.GetType();
585 if (type.Equals(typeof(System.Int32)) || type.Equals(typeof(int)))
587 int num = (int)relativeValue;
588 relativeValue = (float)num;
592 PropertyValue val = PropertyValue.CreateFromObject(relativeValue);
594 if (alphaFunction != null)
596 Tizen.NUI.TimePeriod time = new Tizen.NUI.TimePeriod(MilliSecondsToSeconds(startTime), MilliSecondsToSeconds(endTime - startTime));
597 AnimateBy(_prop, val, alphaFunction, time);
601 Tizen.NUI.TimePeriod time = new Tizen.NUI.TimePeriod(MilliSecondsToSeconds(startTime), MilliSecondsToSeconds(endTime - startTime));
602 AnimateBy(_prop, val, time);
607 /// Animates a property to a destination value.<br />
609 /// <param name="target">The target object to animate.</param>
610 /// <param name="property">The target property to animate.</param>
611 /// <param name="destinationValue">The destination value.</param>
612 /// <param name="alphaFunction">The alpha function to apply.</param>
613 /// <since_tizen> 3 </since_tizen>
614 public void AnimateTo(View target, string property, object destinationValue, AlphaFunction alphaFunction = null)
616 Property _prop = PropertyHelper.GetPropertyFromString(target, property);
618 PropertyType propertyType = target.GetPropertyType(_prop.propertyIndex);
619 if (propertyType.Equals(PropertyType.Float))
621 System.Type type = destinationValue.GetType();
622 if (type.Equals(typeof(System.Int32)) || type.Equals(typeof(int)))
624 int num = (int)destinationValue;
625 destinationValue = (float)num;
629 PropertyValue val = PropertyValue.CreateFromObject(destinationValue);
631 if (alphaFunction != null)
633 AnimateTo(_prop, val, alphaFunction);
637 AnimateTo(_prop, val);
642 /// Animates one or more properties to a destination value.<br />
644 /// <param name="target">The target object to animate.</param>
645 public void PlayAnimateTo(View target)
648 if (_properties.Length == _destValue.Length && _startTime.Length == _endTime.Length && _properties.Length == _startTime.Length)
650 int length = _properties.Length;
651 for (int index = 0; index < length; index++)
653 //object destinationValue = _destValue[index];
654 var elementType = target.GetType();
655 PropertyInfo propertyInfo = elementType.GetProperties().FirstOrDefault(fi => fi.Name == _properties[index]);
656 //var propertyInfo = elementType.GetRuntimeProperties().FirstOrDefault(p => p.Name == localName);
657 if (propertyInfo != null)
659 object destinationValue = ConvertTo(_destValue[index], propertyInfo.PropertyType);
661 if (destinationValue != null)
663 AnimateTo(target, _properties[index], destinationValue, _startTime[index], _endTime[index]);
672 /// Animates a property to a destination value.<br />
674 /// <param name="target">The target object to animate.</param>
675 /// <param name="property">The target property to animate.</param>
676 /// <param name="destinationValue">The destination value.</param>
677 /// <param name="startTime">The start time of the animation.</param>
678 /// <param name="endTime">The end time of the animation.</param>
679 /// <param name="alphaFunction">The alpha function to apply.</param>
680 /// <since_tizen> 3 </since_tizen>
681 public void AnimateTo(View target, string property, object destinationValue, int startTime, int endTime, AlphaFunction alphaFunction = null)
683 Property _prop = PropertyHelper.GetPropertyFromString(target, property);
685 PropertyType propertyType = target.GetPropertyType(_prop.propertyIndex);
686 if (propertyType.Equals(PropertyType.Float))
688 System.Type type = destinationValue.GetType();
689 if (type.Equals(typeof(System.Int32)) || type.Equals(typeof(int)))
691 int num = (int)destinationValue;
692 destinationValue = (float)num;
696 PropertyValue val = PropertyValue.CreateFromObject(destinationValue);
698 if (alphaFunction != null)
700 Tizen.NUI.TimePeriod time = new Tizen.NUI.TimePeriod(MilliSecondsToSeconds(startTime), MilliSecondsToSeconds(endTime - startTime));
701 AnimateTo(_prop, val, alphaFunction, time);
705 Tizen.NUI.TimePeriod time = new Tizen.NUI.TimePeriod(MilliSecondsToSeconds(startTime), MilliSecondsToSeconds(endTime - startTime));
706 AnimateTo(_prop, val, time);
711 /// Animates a property between keyframes.
713 /// <param name="target">The target object to animate.</param>
714 /// <param name="property">The target property to animate.</param>
715 /// <param name="keyFrames">The set of time or value pairs between which to animate.</param>
716 /// <param name="interpolation">The method used to interpolate between values.</param>
717 /// <param name="alphaFunction">The alpha function to apply.</param>
718 /// <since_tizen> 3 </since_tizen>
719 public void AnimateBetween(View target, string property, KeyFrames keyFrames, Interpolation interpolation = Interpolation.Linear, AlphaFunction alphaFunction = null)
721 Property _prop = PropertyHelper.GetPropertyFromString(target, property);
723 if (_prop.propertyIndex == Property.INVALID_INDEX)
725 throw new System.ArgumentException("second argument string property is invalid parameter!");
728 if (alphaFunction != null)
730 AnimateBetween(_prop, keyFrames, alphaFunction, interpolation);
734 AnimateBetween(_prop, keyFrames, interpolation);
739 /// Animates a property between keyframes.
741 /// <param name="target">The target object to animate</param>
742 /// <param name="property">The target property to animate</param>
743 /// <param name="keyFrames">The set of time/value pairs between which to animate</param>
744 /// <param name="startTime">The start time of animation in milliseconds.</param>
745 /// <param name="endTime">The end time of animation in milliseconds.</param>
746 /// <param name="interpolation">The method used to interpolate between values.</param>
747 /// <param name="alphaFunction">The alpha function to apply.</param>
748 /// <since_tizen> 3 </since_tizen>
749 public void AnimateBetween(View target, string property, KeyFrames keyFrames, int startTime, int endTime, Interpolation interpolation = Interpolation.Linear, AlphaFunction alphaFunction = null)
751 Property _prop = PropertyHelper.GetPropertyFromString(target, property);
753 Tizen.NUI.TimePeriod time = new Tizen.NUI.TimePeriod(MilliSecondsToSeconds(startTime), MilliSecondsToSeconds(endTime - startTime));
754 if (alphaFunction != null)
756 AnimateBetween(_prop, keyFrames, alphaFunction, time, interpolation);
760 AnimateBetween(_prop, keyFrames, time, interpolation);
765 /// Animates the view's position and orientation through a predefined path.<br />
766 /// The view will rotate to orient the supplied forward vector with the path's tangent.<br />
767 /// If forward is the zero vector then no rotation will happen.<br />
769 /// <param name="view">The view to animate.</param>
770 /// <param name="path">It defines position and orientation.</param>
771 /// <param name="forward">The vector (in local space coordinate system) will be oriented with the path's tangent direction.</param>
772 /// <param name="alphaFunction">The alpha function to apply.</param>
773 /// <since_tizen> 3 </since_tizen>
774 public void AnimatePath(View view, Path path, Vector3 forward, AlphaFunction alphaFunction = null)
776 if (alphaFunction == null)
778 Animate(view, path, forward);
782 Animate(view, path, forward, alphaFunction);
787 /// Animates the view's position and orientation through a predefined path.<br />
788 /// The view will rotate to orient the supplied forward vector with the path's tangent.<br />
789 /// If forward is the zero vector then no rotation will happen.<br />
791 /// <param name="view">The view to animate.</param>
792 /// <param name="path">It defines position and orientation.</param>
793 /// <param name="forward">The vector (in local space coordinate system) will be oriented with the path's tangent direction.</param>
794 /// <param name="startTime">The start time of the animation.</param>
795 /// <param name="endTime">The end time of the animation.</param>
796 /// <param name="alphaFunction">The alpha function to apply.</param>
797 /// <since_tizen> 3 </since_tizen>
798 public void AnimatePath(View view, Path path, Vector3 forward, int startTime, int endTime, AlphaFunction alphaFunction = null)
800 TimePeriod time = new TimePeriod(MilliSecondsToSeconds(startTime), MilliSecondsToSeconds(endTime - startTime));
801 if (alphaFunction == null)
803 Animate(view, path, forward, time);
807 Animate(view, path, forward, alphaFunction, time);
812 /// Creates an initialized animation.<br />
813 /// The animation will not loop.<br />
814 /// The default end action is "Cancel".<br />
815 /// The default alpha function is linear.<br />
817 /// <since_tizen> 3 </since_tizen>
818 public Animation() : this(NDalicPINVOKE.Animation_New(0.0f), true)
820 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
824 /// Plays the animation.
826 /// <since_tizen> 3 </since_tizen>
829 NDalicPINVOKE.Animation_Play(swigCPtr);
830 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
832 if (DisableAnimation == true)
833 Stop(EndActions.StopFinal);
837 /// Plays the animation from a given point.<br />
838 /// The progress must be in the 0-1 interval or in the play range interval if defined,
839 /// otherwise, it will be ignored.<br />
841 /// <param name="progress">A value between [0,1], or between the play range if specified, from where the animation should start playing.</param>
842 /// <since_tizen> 3 </since_tizen>
843 public void PlayFrom(float progress)
845 NDalicPINVOKE.Animation_PlayFrom(swigCPtr, progress);
846 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
850 /// Plays the animation after a given delay time.<br/>
851 /// The delay time is not included in the looping time.<br/>
852 /// When the delay time is a negative value, it would treat as play immediately.<br/>
854 /// <param name="delayMilliseconds">The delay time.</param>
855 /// <since_tizen> 4 </since_tizen>
856 public void PlayAfter(int delayMilliseconds)
858 NDalicPINVOKE.Animation_PlayAfter(swigCPtr, MilliSecondsToSeconds(delayMilliseconds));
859 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
863 /// Pauses the animation.
865 /// <since_tizen> 3 </since_tizen>
868 NDalicPINVOKE.Animation_Pause(swigCPtr);
869 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
873 /// Stops the animation.
875 /// <since_tizen> 3 </since_tizen>
878 NDalicPINVOKE.Animation_Stop(swigCPtr);
879 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
883 /// Clears the animation.<br />
884 /// This disconnects any objects that were being animated, effectively stopping the animation.<br />
886 /// <since_tizen> 3 </since_tizen>
889 NDalicPINVOKE.Animation_Clear(swigCPtr);
890 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
893 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Animation obj)
895 return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
898 internal object ConvertTo(object value, Type toType)
900 Func<object> getConverter = () =>
902 string converterTypeName = GetTypeConverterTypeName(toType.GetTypeInfo().CustomAttributes);
903 if (converterTypeName == null)
906 Type convertertype = Type.GetType(converterTypeName);
907 return Activator.CreateInstance(convertertype);
910 return ConvertTo(value, toType, getConverter);
913 internal object ConvertTo(object value, Type toType, Func<object> getConverter)
918 var str = value as string;
921 //If there's a [TypeConverter], use it
922 object converter = getConverter?.Invoke();
923 var xfTypeConverter = converter as Tizen.NUI.Binding.TypeConverter;
924 if (xfTypeConverter != null)
925 return value = xfTypeConverter.ConvertFromInvariantString(str);
926 var converterType = converter?.GetType();
927 if (converterType != null)
929 var convertFromStringInvariant = converterType.GetRuntimeMethod("ConvertFromInvariantString",
930 new[] { typeof(string) });
931 if (convertFromStringInvariant != null)
932 return value = convertFromStringInvariant.Invoke(converter, new object[] { str });
935 //If the type is nullable, as the value is not null, it's safe to assume we want the built-in conversion
936 if (toType.GetTypeInfo().IsGenericType && toType.GetGenericTypeDefinition() == typeof(Nullable<>))
937 toType = Nullable.GetUnderlyingType(toType);
939 //Obvious Built-in conversions
940 if (toType.GetTypeInfo().IsEnum)
941 return Enum.Parse(toType, str, true);
942 if (toType == typeof(SByte))
943 return SByte.Parse(str, CultureInfo.InvariantCulture);
944 if (toType == typeof(Int16))
945 return Int16.Parse(str, CultureInfo.InvariantCulture);
946 if (toType == typeof(Int32))
947 return Int32.Parse(str, CultureInfo.InvariantCulture);
948 if (toType == typeof(Int64))
949 return Int64.Parse(str, CultureInfo.InvariantCulture);
950 if (toType == typeof(Byte))
951 return Byte.Parse(str, CultureInfo.InvariantCulture);
952 if (toType == typeof(UInt16))
953 return UInt16.Parse(str, CultureInfo.InvariantCulture);
954 if (toType == typeof(UInt32))
955 return UInt32.Parse(str, CultureInfo.InvariantCulture);
956 if (toType == typeof(UInt64))
957 return UInt64.Parse(str, CultureInfo.InvariantCulture);
958 if (toType == typeof(Single))
959 return Single.Parse(str, CultureInfo.InvariantCulture);
960 if (toType == typeof(Double))
961 return Double.Parse(str, CultureInfo.InvariantCulture);
962 if (toType == typeof(Boolean))
963 return Boolean.Parse(str);
964 if (toType == typeof(TimeSpan))
965 return TimeSpan.Parse(str, CultureInfo.InvariantCulture);
966 if (toType == typeof(DateTime))
967 return DateTime.Parse(str, CultureInfo.InvariantCulture);
968 if (toType == typeof(Char))
971 Char.TryParse(str, out c);
974 if (toType == typeof(String) && str.StartsWith("{}", StringComparison.Ordinal))
975 return str.Substring(2);
976 if (toType == typeof(String))
978 if (toType == typeof(Decimal))
979 return Decimal.Parse(str, CultureInfo.InvariantCulture);
982 //if the value is not assignable and there's an implicit conversion, convert
983 if (value != null && !toType.IsAssignableFrom(value.GetType()))
985 var opImplicit = GetImplicitConversionOperator(value.GetType(), value.GetType(), toType)
986 ?? GetImplicitConversionOperator(toType, value.GetType(), toType);
987 //var opImplicit = value.GetType().GetImplicitConversionOperator(fromType: value.GetType(), toType: toType)
988 // ?? toType.GetImplicitConversionOperator(fromType: value.GetType(), toType: toType);
990 if (opImplicit != null)
992 value = opImplicit.Invoke(null, new[] { value });
997 var nativeValueConverterService = DependencyService.Get<INativeValueConverterService>();
999 object nativeValue = null;
1000 if (nativeValueConverterService != null && nativeValueConverterService.ConvertTo(value, toType, out nativeValue))
1006 internal string GetTypeConverterTypeName(IEnumerable<CustomAttributeData> attributes)
1008 var converterAttribute =
1009 attributes.FirstOrDefault(cad => Tizen.NUI.Binding.TypeConverterAttribute.TypeConvertersType.Contains(cad.AttributeType.FullName));
1010 if (converterAttribute == null)
1012 if (converterAttribute.ConstructorArguments[0].ArgumentType == typeof(string))
1013 return (string)converterAttribute.ConstructorArguments[0].Value;
1014 if (converterAttribute.ConstructorArguments[0].ArgumentType == typeof(Type))
1015 return ((Type)converterAttribute.ConstructorArguments[0].Value).AssemblyQualifiedName;
1019 internal MethodInfo GetImplicitConversionOperator(Type onType, Type fromType, Type toType)
1022 var mi = onType.GetRuntimeMethod("op_Implicit", new[] { fromType });
1024 var bindingFlags = BindingFlags.Public | BindingFlags.Static | BindingFlags.FlattenHierarchy;
1025 var mi = onType.GetMethod("op_Implicit", bindingFlags, null, new[] { fromType }, null);
1027 if (mi == null) return null;
1028 if (!mi.IsSpecialName) return null;
1029 if (!mi.IsPublic) return null;
1030 if (!mi.IsStatic) return null;
1031 if (!toType.IsAssignableFrom(mi.ReturnType)) return null;
1036 internal Animation(float durationSeconds) : this(NDalicPINVOKE.Animation_New(durationSeconds), true)
1038 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1042 internal Animation(Animation handle) : this(NDalicPINVOKE.new_Animation__SWIG_1(Animation.getCPtr(handle)), true)
1044 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1047 internal Animation Assign(Animation rhs)
1049 Animation ret = new Animation(NDalicPINVOKE.Animation_Assign(swigCPtr, Animation.getCPtr(rhs)), false);
1050 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1054 internal void SetDuration(float seconds)
1056 NDalicPINVOKE.Animation_SetDuration(swigCPtr, seconds);
1057 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1060 internal float GetDuration()
1062 float ret = NDalicPINVOKE.Animation_GetDuration(swigCPtr);
1063 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1067 internal void SetLooping(bool looping)
1069 NDalicPINVOKE.Animation_SetLooping(swigCPtr, looping);
1070 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1073 internal void SetLoopCount(int count)
1075 NDalicPINVOKE.Animation_SetLoopCount(swigCPtr, count);
1076 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1079 internal int GetLoopCount()
1081 int ret = NDalicPINVOKE.Animation_GetLoopCount(swigCPtr);
1082 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1086 internal int GetCurrentLoop()
1088 int ret = NDalicPINVOKE.Animation_GetCurrentLoop(swigCPtr);
1089 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1093 internal bool IsLooping()
1095 bool ret = NDalicPINVOKE.Animation_IsLooping(swigCPtr);
1096 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1100 internal void SetEndAction(Animation.EndActions action)
1102 NDalicPINVOKE.Animation_SetEndAction(swigCPtr, (int)action);
1103 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1106 internal Animation.EndActions GetEndAction()
1108 Animation.EndActions ret = (Animation.EndActions)NDalicPINVOKE.Animation_GetEndAction(swigCPtr);
1109 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1113 internal void SetDisconnectAction(Animation.EndActions disconnectAction)
1115 NDalicPINVOKE.Animation_SetDisconnectAction(swigCPtr, (int)disconnectAction);
1116 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1119 internal Animation.EndActions GetDisconnectAction()
1121 Animation.EndActions ret = (Animation.EndActions)NDalicPINVOKE.Animation_GetDisconnectAction(swigCPtr);
1122 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1126 internal void SetDefaultAlphaFunction(AlphaFunction alpha)
1128 NDalicPINVOKE.Animation_SetDefaultAlphaFunction(swigCPtr, AlphaFunction.getCPtr(alpha));
1129 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1132 internal AlphaFunction GetDefaultAlphaFunction()
1134 AlphaFunction ret = new AlphaFunction(NDalicPINVOKE.Animation_GetDefaultAlphaFunction(swigCPtr), true);
1135 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1139 internal void SetCurrentProgress(float progress)
1141 NDalicPINVOKE.Animation_SetCurrentProgress(swigCPtr, progress);
1142 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1145 internal float GetCurrentProgress()
1147 float ret = NDalicPINVOKE.Animation_GetCurrentProgress(swigCPtr);
1148 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1152 internal void SetSpeedFactor(float factor)
1154 NDalicPINVOKE.Animation_SetSpeedFactor(swigCPtr, factor);
1155 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1158 internal float GetSpeedFactor()
1160 float ret = NDalicPINVOKE.Animation_GetSpeedFactor(swigCPtr);
1161 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1165 internal void SetPlayRange(Vector2 range)
1167 NDalicPINVOKE.Animation_SetPlayRange(swigCPtr, Vector2.getCPtr(range));
1168 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1171 internal Vector2 GetPlayRange()
1173 Vector2 ret = new Vector2(NDalicPINVOKE.Animation_GetPlayRange(swigCPtr), true);
1174 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1178 internal Animation.States GetState()
1180 Animation.States ret = (Animation.States)NDalicPINVOKE.Animation_GetState(swigCPtr);
1181 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1185 internal AnimationSignal FinishedSignal()
1187 AnimationSignal ret = new AnimationSignal(NDalicPINVOKE.Animation_FinishedSignal(swigCPtr), false);
1188 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1192 internal AnimationSignal ProgressReachedSignal()
1194 AnimationSignal ret = new AnimationSignal(NDalicPINVOKE.Animation_ProgressReachedSignal(swigCPtr), false);
1195 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1199 internal void AnimateBy(Property target, PropertyValue relativeValue)
1201 NDalicPINVOKE.Animation_AnimateBy__SWIG_0(swigCPtr, Property.getCPtr(target), PropertyValue.getCPtr(relativeValue));
1202 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1205 internal void AnimateBy(Property target, PropertyValue relativeValue, AlphaFunction alpha)
1207 NDalicPINVOKE.Animation_AnimateBy__SWIG_1(swigCPtr, Property.getCPtr(target), PropertyValue.getCPtr(relativeValue), AlphaFunction.getCPtr(alpha));
1208 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1211 internal void AnimateBy(Property target, PropertyValue relativeValue, TimePeriod period)
1213 NDalicPINVOKE.Animation_AnimateBy__SWIG_2(swigCPtr, Property.getCPtr(target), PropertyValue.getCPtr(relativeValue), TimePeriod.getCPtr(period));
1214 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1217 internal void AnimateBy(Property target, PropertyValue relativeValue, AlphaFunction alpha, TimePeriod period)
1219 NDalicPINVOKE.Animation_AnimateBy__SWIG_3(swigCPtr, Property.getCPtr(target), PropertyValue.getCPtr(relativeValue), AlphaFunction.getCPtr(alpha), TimePeriod.getCPtr(period));
1220 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1223 internal void AnimateTo(Property target, PropertyValue destinationValue)
1225 NDalicPINVOKE.Animation_AnimateTo__SWIG_0(swigCPtr, Property.getCPtr(target), PropertyValue.getCPtr(destinationValue));
1226 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1229 internal void AnimateTo(Property target, PropertyValue destinationValue, AlphaFunction alpha)
1231 NDalicPINVOKE.Animation_AnimateTo__SWIG_1(swigCPtr, Property.getCPtr(target), PropertyValue.getCPtr(destinationValue), AlphaFunction.getCPtr(alpha));
1232 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1235 internal void AnimateTo(Property target, PropertyValue destinationValue, TimePeriod period)
1237 NDalicPINVOKE.Animation_AnimateTo__SWIG_2(swigCPtr, Property.getCPtr(target), PropertyValue.getCPtr(destinationValue), TimePeriod.getCPtr(period));
1238 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1241 internal void AnimateTo(Property target, PropertyValue destinationValue, AlphaFunction alpha, TimePeriod period)
1243 NDalicPINVOKE.Animation_AnimateTo__SWIG_3(swigCPtr, Property.getCPtr(target), PropertyValue.getCPtr(destinationValue), AlphaFunction.getCPtr(alpha), TimePeriod.getCPtr(period));
1244 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1247 internal void AnimateBetween(Property target, KeyFrames keyFrames)
1249 NDalicPINVOKE.Animation_AnimateBetween__SWIG_0(swigCPtr, Property.getCPtr(target), KeyFrames.getCPtr(keyFrames));
1250 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1253 internal void AnimateBetween(Property target, KeyFrames keyFrames, Animation.Interpolation interpolation)
1255 NDalicPINVOKE.Animation_AnimateBetween__SWIG_1(swigCPtr, Property.getCPtr(target), KeyFrames.getCPtr(keyFrames), (int)interpolation);
1256 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1259 internal void AnimateBetween(Property target, KeyFrames keyFrames, AlphaFunction alpha)
1261 NDalicPINVOKE.Animation_AnimateBetween__SWIG_2(swigCPtr, Property.getCPtr(target), KeyFrames.getCPtr(keyFrames), AlphaFunction.getCPtr(alpha));
1262 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1265 internal void AnimateBetween(Property target, KeyFrames keyFrames, AlphaFunction alpha, Animation.Interpolation interpolation)
1267 NDalicPINVOKE.Animation_AnimateBetween__SWIG_3(swigCPtr, Property.getCPtr(target), KeyFrames.getCPtr(keyFrames), AlphaFunction.getCPtr(alpha), (int)interpolation);
1268 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1271 internal void AnimateBetween(Property target, KeyFrames keyFrames, TimePeriod period)
1273 NDalicPINVOKE.Animation_AnimateBetween__SWIG_4(swigCPtr, Property.getCPtr(target), KeyFrames.getCPtr(keyFrames), TimePeriod.getCPtr(period));
1274 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1277 internal void AnimateBetween(Property target, KeyFrames keyFrames, TimePeriod period, Animation.Interpolation interpolation)
1279 NDalicPINVOKE.Animation_AnimateBetween__SWIG_5(swigCPtr, Property.getCPtr(target), KeyFrames.getCPtr(keyFrames), TimePeriod.getCPtr(period), (int)interpolation);
1280 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1283 internal void AnimateBetween(Property target, KeyFrames keyFrames, AlphaFunction alpha, TimePeriod period)
1285 NDalicPINVOKE.Animation_AnimateBetween__SWIG_6(swigCPtr, Property.getCPtr(target), KeyFrames.getCPtr(keyFrames), AlphaFunction.getCPtr(alpha), TimePeriod.getCPtr(period));
1286 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1289 internal void AnimateBetween(Property target, KeyFrames keyFrames, AlphaFunction alpha, TimePeriod period, Animation.Interpolation interpolation)
1291 NDalicPINVOKE.Animation_AnimateBetween__SWIG_7(swigCPtr, Property.getCPtr(target), KeyFrames.getCPtr(keyFrames), AlphaFunction.getCPtr(alpha), TimePeriod.getCPtr(period), (int)interpolation);
1292 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1295 internal void Animate(View view, Path path, Vector3 forward)
1297 NDalicPINVOKE.Animation_Animate__SWIG_0(swigCPtr, View.getCPtr(view), Path.getCPtr(path), Vector3.getCPtr(forward));
1298 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1301 internal void Animate(View view, Path path, Vector3 forward, AlphaFunction alpha)
1303 NDalicPINVOKE.Animation_Animate__SWIG_1(swigCPtr, View.getCPtr(view), Path.getCPtr(path), Vector3.getCPtr(forward), AlphaFunction.getCPtr(alpha));
1304 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1307 internal void Animate(View view, Path path, Vector3 forward, TimePeriod period)
1309 NDalicPINVOKE.Animation_Animate__SWIG_2(swigCPtr, View.getCPtr(view), Path.getCPtr(path), Vector3.getCPtr(forward), TimePeriod.getCPtr(period));
1310 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1313 internal void Animate(View view, Path path, Vector3 forward, AlphaFunction alpha, TimePeriod period)
1315 NDalicPINVOKE.Animation_Animate__SWIG_3(swigCPtr, View.getCPtr(view), Path.getCPtr(path), Vector3.getCPtr(forward), AlphaFunction.getCPtr(alpha), TimePeriod.getCPtr(period));
1316 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1319 internal void Show(View view, float delaySeconds)
1321 NDalicPINVOKE.Animation_Show(swigCPtr, View.getCPtr(view), delaySeconds);
1322 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1325 internal void Hide(View view, float delaySeconds)
1327 NDalicPINVOKE.Animation_Hide(swigCPtr, View.getCPtr(view), delaySeconds);
1328 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1332 /// To make animation instance be disposed.
1334 /// <since_tizen> 3 </since_tizen>
1335 protected override void Dispose(DisposeTypes type)
1339 if (_animationFinishedEventCallback != null)
1341 FinishedSignal().Disconnect(_finishedCallbackOfNative);
1344 if (_animationProgressReachedEventCallback != null)
1347 ProgressReachedSignal().Disconnect(_animationProgressReachedEventCallback);
1355 if(type == DisposeTypes.Explicit)
1358 //Release your own managed resources here.
1359 //You should release all of your own disposable objects here.
1362 else if(type == DisposeTypes.Implicit)
1372 //Release your own unmanaged resources here.
1373 //You should not access any managed member here except static instance.
1374 //because the execution order of Finalizes is non-deterministic.
1376 if (swigCPtr.Handle != global::System.IntPtr.Zero)
1380 swigCMemOwn = false;
1381 NDalicPINVOKE.delete_Animation(swigCPtr);
1383 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
1389 private void OnFinished(IntPtr data)
1391 if (_animationFinishedEventHandler != null)
1393 //here we send all data to user event handlers
1394 _animationFinishedEventHandler(this, null);
1398 private void OnProgressReached(IntPtr data)
1400 if (_animationProgressReachedEventHandler != null)
1402 //here we send all data to user event handlers
1403 _animationProgressReachedEventHandler(this, null);
1407 private float MilliSecondsToSeconds(int millisec)
1409 return (float)millisec / 1000.0f;
1412 private int SecondsToMilliSeconds(float sec)
1414 return (int)(sec * 1000);