2 * Copyright(c) 2021 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 System.Collections.Generic;
25 using System.Reflection;
26 using System.Globalization;
27 using System.Diagnostics.CodeAnalysis;
29 using Tizen.NUI.BaseComponents;
32 /// Animation can be used to animate the properties of any number of objects, typically view.<br />
33 /// If the "Finished" event is connected to a member function of an object, it must be disconnected before the object is destroyed.<br />
34 /// This is typically done in the object destructor, and requires either the animation handle to be stored.<br />
35 /// 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 />
36 /// If any of the individual calls to those functions exceeds the overall animation time (Duration), then the overall animation time is automatically extended.<br />
38 /// <since_tizen> 3 </since_tizen>
39 public class Animation : BaseHandle
41 private static bool? disableAnimation = null;
43 private AnimationFinishedEventCallbackType animationFinishedEventCallback;
44 private System.IntPtr finishedCallbackOfNative;
46 private AnimationProgressReachedEventCallbackType animationProgressReachedEventCallback;
48 private string[] properties = null;
49 private string[] destValue = null;
50 private int[] startTime = null;
51 private int[] endTime = null;
53 private List<string> propertyList = null;
54 private List<string> destValueList = null;
55 private List<int> startTimeList = null;
56 private List<int> endTimeList = null;
59 /// Creates an initialized animation.<br />
60 /// The animation will not loop.<br />
61 /// The default end action is "Cancel".<br />
62 /// The default alpha function is linear.<br />
64 /// <remarks>DurationmSeconds must be greater than zero.</remarks>
65 /// <param name="durationMilliSeconds">The duration in milliseconds.</param>
66 /// <since_tizen> 3 </since_tizen>
67 public Animation(int durationMilliSeconds) : this(Interop.Animation.New((float)durationMilliSeconds / 1000.0f), true)
69 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
72 internal Animation(global::System.IntPtr cPtr, bool cMemoryOwn) : base(cPtr, cMemoryOwn)
74 animationFinishedEventCallback = OnFinished;
75 finishedCallbackOfNative = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate<System.Delegate>(animationFinishedEventCallback);
78 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
79 private delegate void AnimationFinishedEventCallbackType(IntPtr data);
81 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
82 private delegate void AnimationProgressReachedEventCallbackType(IntPtr data);
84 private event EventHandler animationFinishedEventHandler;
87 * @brief Event for the finished signal which can be used to subscribe or unsubscribe the event handler.
88 * The finished signal is emitted when an animation's animations have finished.
90 /// <since_tizen> 3 </since_tizen>
91 public event EventHandler Finished
95 if (animationFinishedEventHandler == null && disposed == false)
97 AnimationSignal finishedSignal = FinishedSignal();
98 finishedSignal.Connect(finishedCallbackOfNative);
99 finishedSignal.Dispose();
101 animationFinishedEventHandler += value;
105 animationFinishedEventHandler -= value;
107 AnimationSignal finishedSignal = FinishedSignal();
108 if (animationFinishedEventHandler == null && finishedSignal.Empty() == false)
110 finishedSignal.Disconnect(finishedCallbackOfNative);
112 finishedSignal.Dispose();
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 AnimationSignal progressReachedSignal = ProgressReachedSignal();
131 progressReachedSignal?.Connect(animationProgressReachedEventCallback);
132 progressReachedSignal?.Dispose();
135 animationProgressReachedEventHandler += value;
139 animationProgressReachedEventHandler -= value;
141 AnimationSignal progressReachedSignal = ProgressReachedSignal();
142 if (animationProgressReachedEventHandler == null && progressReachedSignal?.Empty() == false)
144 progressReachedSignal?.Disconnect(animationProgressReachedEventCallback);
146 progressReachedSignal.Dispose();
151 /// Enumeration for what to do when the animation ends, stopped, or destroyed.
153 /// <since_tizen> 3 </since_tizen>
154 [System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1717:Only FlagsAttribute enums should have plural names")]
155 public enum EndActions
158 /// When the animation ends, the animated property values are saved.
162 /// When the animation ends, the animated property values are forgotten.
166 /// If the animation is stopped, the animated property values are saved as if the animation had run to completion, otherwise behaves like cancel.
172 /// Enumeration for what interpolation method to use on key-frame animations.
174 /// <since_tizen> 3 </since_tizen>
175 public enum Interpolation
178 /// Values in between key frames are interpolated using a linear polynomial. (Default)
182 /// Values in between key frames are interpolated using a cubic polynomial.
188 /// Enumeration for what state the animation is in.
190 /// <remarks>Calling Reset() on this class will not reset the animation. It will call the BaseHandle.Reset() which drops the object handle.</remarks>
191 /// <since_tizen> 3 </since_tizen>
192 [System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1717:Only FlagsAttribute enums should have plural names")]
196 /// The animation has stopped.
200 /// The animation is playing.
204 /// The animation is paused.
210 /// Gets or sets the duration in milliseconds of the animation.
212 /// <since_tizen> 3 </since_tizen>
217 SetDuration(MilliSecondsToSeconds(value));
221 return SecondsToMilliSeconds(GetDuration());
226 /// Gets or sets the default alpha function for the animation.
228 /// <since_tizen> 3 </since_tizen>
229 public AlphaFunction DefaultAlphaFunction
233 SetDefaultAlphaFunction(value);
237 AlphaFunction ret = GetDefaultAlphaFunction();
243 /// Queries the state of the animation.
245 /// <since_tizen> 3 </since_tizen>
255 /// Set: Enables looping for a specified number of repeats. A zero is the same as Looping = true; i.e., repeat forever.<br />
256 /// This property resets the looping value and should not be used with the Looping property.<br />
257 /// Setting this parameter does not cause the animation to Play().<br />
258 /// Get: Gets the loop count. A zero is the same as Looping = true; i.e., repeat forever.<br />
259 /// The loop count is initially 1 for play once.<br />
261 /// <since_tizen> 3 </since_tizen>
270 int ret = GetLoopCount();
276 /// Gets or sets the status of whether the animation will loop.<br />
277 /// This property resets the loop count and should not be used with the LoopCount property.<br />
278 /// Setting this parameter does not cause the animation to Play().<br />
280 /// <since_tizen> 3 </since_tizen>
289 bool ret = IsLooping();
296 /// Gets or sets the end action of the animation.<br />
297 /// This action is performed when the animation ends or if it is stopped.<br />
298 /// The default end action is cancel.<br />
300 /// <since_tizen> 3 </since_tizen>
301 public EndActions EndAction
309 return GetEndAction();
314 /// Gets the current loop count.<br />
315 /// A value 0 indicating the current loop count when looping.<br />
317 /// <since_tizen> 3 </since_tizen>
318 public int CurrentLoop
322 return GetCurrentLoop();
327 /// Gets or sets the disconnect action.<br />
328 /// If any of the animated property owners are disconnected from the stage while the animation is being played, then this action is performed.<br />
329 /// The default action is cancel.<br />
331 /// <since_tizen> 3 </since_tizen>
332 public EndActions DisconnectAction
336 Interop.Animation.SetDisconnectAction(SwigCPtr, (int)value);
337 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
341 Animation.EndActions ret = (Animation.EndActions)Interop.Animation.GetDisconnectAction(SwigCPtr);
342 if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve());
349 /// Gets or sets the progress of the animation.<br />
350 /// The animation will play (or continue playing) from this point.<br />
351 /// The progress must be in the 0-1 interval or in the play range interval if defined<br />
352 /// otherwise, it will be ignored.<br />
354 /// <since_tizen> 3 </since_tizen>
355 public float CurrentProgress
359 Interop.Animation.SetCurrentProgress(SwigCPtr, value);
360 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
364 float ret = Interop.Animation.GetCurrentProgress(SwigCPtr);
365 if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve());
371 /// Gets or sets specifications of a speed factor for the animation.<br />
372 /// The speed factor is a multiplier of the normal velocity of the animation.<br />
373 /// Values between [0, 1] will slow down the animation and values above one will speed up the animation.<br />
374 /// It is also possible to specify a negative multiplier to play the animation in reverse.<br />
376 /// <since_tizen> 3 </since_tizen>
377 public float SpeedFactor
381 Interop.Animation.SetSpeedFactor(SwigCPtr, value);
382 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
386 float ret = Interop.Animation.GetSpeedFactor(SwigCPtr);
387 if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve());
393 /// Gets or sets the playing range.<br />
394 /// Animation will play between the values specified. Both values (range.x and range.y ) should be between 0-1,
395 /// otherwise they will be ignored. If the range provided is not in proper order (minimum, maximum ), it will be reordered.<br />
397 /// <since_tizen> 3 </since_tizen>
398 public RelativeVector2 PlayRange
402 Interop.Animation.SetPlayRange(SwigCPtr, Vector2.getCPtr(value));
403 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
407 Vector2 ret = new Vector2(Interop.Animation.GetPlayRange(SwigCPtr), true);
408 if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve());
415 /// Gets or sets the progress notification marker which triggers the ProgressReachedSignal.<br />
416 /// Percentage of animation progress should be greater than 0 and less than 1, for example, 0.3 for 30% <br />
417 /// One notification can be set on each animation.
419 /// <since_tizen> 3 </since_tizen>
420 public float ProgressNotification
424 Interop.Animation.SetProgressNotification(SwigCPtr, value);
425 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
429 float ret = Interop.Animation.GetProgressNotification(SwigCPtr);
430 if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve());
436 /// Gets or sets the properties of the animation.
438 //ToDo : will raise deprecated-ACR, [Obsolete("Deprecated in API9, Will be removed in API11, Please use PropertyList instead")]
439 [SuppressMessage("Microsoft.Performance", "CA1819:PropertiesShouldNotReturnArrays", Justification = "This API will be deprecated, so suppressing the warning for now")]
440 public string[] Properties
453 /// Gets or sets the destination value for each property of the animation.
455 //ToDo : will raise deprecated-ACR, [Obsolete("Deprecated in API9, Will be removed in API11, Please use DestValueList instead")]
456 [SuppressMessage("Microsoft.Performance", "CA1819:PropertiesShouldNotReturnArrays", Justification = "This API will be deprecated, so suppressing the warning for now")]
457 public string[] DestValue
470 /// Gets or sets the start time for each property of the animation.
472 //ToDo : will raise deprecated-ACR, [Obsolete("Deprecated in API9, Will be removed in API11, Please use StartTimeList instead")]
473 [SuppressMessage("Microsoft.Performance", "CA1819:PropertiesShouldNotReturnArrays", Justification = "This API will be deprecated, so suppressing the warning for now")]
474 public int[] StartTime
487 /// Gets or sets the end time for each property of the animation.
489 //ToDo : will raise deprecated-ACR, [Obsolete("Deprecated in API9, Will be removed in API11, Please use EndTimeList instead")]
490 [SuppressMessage("Microsoft.Performance", "CA1819:PropertiesShouldNotReturnArrays", Justification = "This API will be deprecated, so suppressing the warning for now")]
504 /// Get the list of the properties of the animation.
506 [EditorBrowsable(EditorBrowsableState.Never)]
507 public IList<string> PropertyList
511 if (null == propertyList)
513 propertyList = new List<string>();
521 /// Get the list of the destination value for each property of the animation.
523 [EditorBrowsable(EditorBrowsableState.Never)]
524 public IList<string> DestValueList
528 if (null == destValueList)
530 destValueList = new List<string>();
533 return destValueList;
538 /// Get the list of the start time for each property of the animation.
540 [EditorBrowsable(EditorBrowsableState.Never)]
541 public IList<int> StartTimeList
545 if (null == startTimeList)
547 startTimeList = new List<int>();
550 return startTimeList;
555 /// Get the list of end time for each property of the animation.
557 [EditorBrowsable(EditorBrowsableState.Never)]
558 public IList<int> EndTimeList
562 if (null == endTimeList)
564 endTimeList = new List<int>();
571 private bool DisableAnimation
575 if (disableAnimation.HasValue == false)
577 string type = Environment.GetEnvironmentVariable("PlatformSmartType");
579 disableAnimation = true;
581 disableAnimation = false;
583 return disableAnimation.Value;
588 /// Downcasts a handle to animation handle.<br />
589 /// If handle points to an animation object, the downcast produces a valid handle.<br />
590 /// If not, the returned handle is left uninitialized.<br />
592 /// <param name="handle">Handle to an object.</param>
593 /// <returns>Handle to an animation object or an uninitialized handle.</returns>
594 /// <exception cref="ArgumentNullException"> Thrown when handle is null. </exception>
595 internal static Animation DownCast(BaseHandle handle)
599 throw new ArgumentNullException(nameof(handle));
601 Animation ret = Registry.GetManagedBaseHandleFromNativePtr(handle) as Animation;
602 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
607 /// Stops the animation.
609 /// <param name="action">The end action can be set.</param>
610 /// <since_tizen> 3 </since_tizen>
611 public void Stop(EndActions action = EndActions.Cancel)
613 SetEndAction(action);
614 Interop.Animation.Stop(SwigCPtr);
615 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
619 /// Animates a property value by a relative amount.<br />
621 /// <param name="target">The target object to animate.</param>
622 /// <param name="property">The target property to animate.</param>
623 /// <param name="relativeValue">The property value will change by this amount.</param>
624 /// <param name="alphaFunction">The alpha function to apply.</param>
625 /// <exception cref="ArgumentNullException"> Thrown when target or property or relativeValue is null. </exception>
626 /// <exception cref="ArgumentException"> Thrown when it failed to find a property from given string or the given relativeValue is invalid format. </exception>
627 /// <since_tizen> 3 </since_tizen>
628 public void AnimateBy(View target, string property, object relativeValue, AlphaFunction alphaFunction = null)
632 throw new ArgumentNullException(nameof(target));
634 if (property == null)
636 throw new ArgumentNullException(nameof(property));
638 if (relativeValue == null)
640 throw new ArgumentNullException(nameof(relativeValue));
643 using (var result = PropertyHelper.Search(target, property))
647 throw new ArgumentException("string property is invalid");
650 var current = result;
651 while (current != null)
653 var targetValue = current.RefineValue(relativeValue) ?? throw new ArgumentException("Invalid " + nameof(relativeValue));
654 AnimateBy(current.Property, targetValue, alphaFunction);
655 targetValue.Dispose();
656 current = current.NextResult;
662 /// Animates a property value by a relative amount.<br />
664 /// <param name="target">The target object to animate.</param>
665 /// <param name="property">The target property to animate.</param>
666 /// <param name="relativeValue">The property value will change by this amount.</param>
667 /// <param name="startTime">The start time of the animation.</param>
668 /// <param name="endTime">The end time of the animation.</param>
669 /// <param name="alphaFunction">The alpha function to apply.</param>
670 /// <exception cref="ArgumentNullException"> Thrown when target or property or relativeValue is null. </exception>
671 /// <exception cref="ArgumentException"> Thrown when it failed to find a property from given string or the given relativeValue is invalid format. </exception>
672 /// <since_tizen> 3 </since_tizen>
673 public void AnimateBy(View target, string property, object relativeValue, int startTime, int endTime, AlphaFunction alphaFunction = null)
677 throw new ArgumentNullException(nameof(target));
679 if (property == null)
681 throw new ArgumentNullException(nameof(property));
683 if (relativeValue == null)
685 throw new ArgumentNullException(nameof(relativeValue));
688 using (var result = PropertyHelper.Search(target, property))
692 throw new ArgumentException("string property is invalid");
695 var current = result;
696 using (var time = new TimePeriod(startTime, endTime - startTime))
697 while (current != null)
699 var targetValue = current.RefineValue(relativeValue) ?? throw new ArgumentException("Invalid " + nameof(relativeValue));
700 AnimateBy(current.Property, targetValue, alphaFunction, time);
701 targetValue.Dispose();
702 current = current.NextResult;
708 /// Animates a property to a destination value.<br />
710 /// <param name="target">The target object to animate.</param>
711 /// <param name="property">The target property to animate.</param>
712 /// <param name="destinationValue">The destination value.</param>
713 /// <param name="alphaFunction">The alpha function to apply.</param>
714 /// <exception cref="ArgumentNullException"> Thrown when target or property or destinationValue is null. </exception>
715 /// <exception cref="ArgumentException"> Thrown when it failed to find a property from given string or the given destinationValue is invalid format. </exception>
716 /// <since_tizen> 3 </since_tizen>
717 public void AnimateTo(View target, string property, object destinationValue, AlphaFunction alphaFunction = null)
721 throw new ArgumentNullException(nameof(target));
723 if (property == null)
725 throw new ArgumentNullException(nameof(property));
727 if (destinationValue == null)
729 throw new ArgumentNullException(nameof(destinationValue));
732 using (var result = PropertyHelper.Search(target, property))
736 throw new ArgumentException("string property is invalid");
739 var current = result;
740 while (current != null)
742 var targetValue = current.RefineValue(destinationValue) ?? throw new ArgumentException("Invalid " + nameof(destinationValue));
743 AnimateTo(current.Property, targetValue, alphaFunction);
744 targetValue.Dispose();
745 current = current.NextResult;
751 /// Animates one or more properties to a destination value.<br />
753 /// <param name="target">The target object to animate.</param>
754 /// <exception cref="ArgumentNullException"> Thrown when target is null. </exception>
755 public void PlayAnimateTo(View target)
759 throw new ArgumentNullException(nameof(target));
764 if (null != propertyList && null != destValueList && null != startTimeList && null != endTimeList)
766 if (propertyList.Count == destValueList.Count
768 startTimeList.Count == endTimeList.Count
770 propertyList.Count == startTimeList.Count)
772 int count = propertyList.Count;
773 for (int index = 0; index < count; index++)
775 var elementType = target.GetType();
776 PropertyInfo propertyInfo = elementType.GetProperties().FirstOrDefault(fi => fi.Name == propertyList[index]);
778 if (propertyInfo != null)
780 object destinationValue = ConvertTo(destValueList[index], propertyInfo.PropertyType);
782 if (destinationValue != null)
784 AnimateTo(target, propertyList[index], destinationValue, startTimeList[index], endTimeList[index]);
793 if (properties.Length == destValue.Length && startTime.Length == endTime.Length && properties.Length == startTime.Length)
795 int length = properties.Length;
796 for (int index = 0; index < length; index++)
798 //object destinationValue = _destValue[index];
799 var elementType = target.GetType();
800 PropertyInfo propertyInfo = elementType.GetProperties().FirstOrDefault(fi => fi.Name == properties[index]);
801 //var propertyInfo = elementType.GetRuntimeProperties().FirstOrDefault(p => p.Name == localName);
802 if (propertyInfo != null)
804 object destinationValue = ConvertTo(destValue[index], propertyInfo.PropertyType);
806 if (destinationValue != null)
808 AnimateTo(target, properties[index], destinationValue, startTime[index], endTime[index]);
818 /// Animates a property to a destination value.<br />
820 /// <param name="target">The target object to animate.</param>
821 /// <param name="property">The target property to animate.</param>
822 /// <param name="destinationValue">The destination value.</param>
823 /// <param name="startTime">The start time of the animation.</param>
824 /// <param name="endTime">The end time of the animation.</param>
825 /// <param name="alphaFunction">The alpha function to apply.</param>
826 /// <exception cref="ArgumentNullException"> Thrown when target or property or destinationValue is null. </exception>
827 /// <exception cref="ArgumentException"> Thrown when it failed to find a property from given string or the given destinationValue is invalid format. </exception>
828 /// <since_tizen> 3 </since_tizen>
829 public void AnimateTo(View target, string property, object destinationValue, int startTime, int endTime, AlphaFunction alphaFunction = null)
833 throw new ArgumentNullException(nameof(target));
835 if (property == null)
837 throw new ArgumentNullException(nameof(property));
839 if (destinationValue == null)
841 throw new ArgumentNullException(nameof(destinationValue));
844 using (var result = PropertyHelper.Search(target, property))
848 throw new ArgumentException("string property is invalid");
851 var current = result;
852 using (var time = new TimePeriod(startTime, endTime - startTime))
853 while (current != null)
855 var targetValue = current.RefineValue(destinationValue) ?? throw new ArgumentException("Invalid " + nameof(destinationValue));
856 AnimateTo(current.Property, targetValue, alphaFunction, time);
857 targetValue.Dispose();
858 current = current.NextResult;
864 /// Animates a property between keyframes.
866 /// <param name="target">The target object to animate.</param>
867 /// <param name="property">The target property to animate.</param>
868 /// <param name="keyFrames">The set of time or value pairs between which to animate.</param>
869 /// <param name="interpolation">The method used to interpolate between values.</param>
870 /// <param name="alphaFunction">The alpha function to apply.</param>
871 /// <exception cref="ArgumentNullException"> Thrown when target or property or keyFrames is null. </exception>
872 /// <exception cref="ArgumentException"> Thrown when it failed to find a property from given string or the given keyFrames has invalid value. </exception>
873 /// <since_tizen> 3 </since_tizen>
874 public void AnimateBetween(View target, string property, KeyFrames keyFrames, Interpolation interpolation = Interpolation.Linear, AlphaFunction alphaFunction = null)
878 throw new ArgumentNullException(nameof(target));
880 if (property == null)
882 throw new ArgumentNullException(nameof(property));
884 if (keyFrames == null)
886 throw new ArgumentNullException(nameof(keyFrames));
889 using (var result = PropertyHelper.Search(target, property))
893 throw new ArgumentException("string property is invalid");
896 var current = result;
897 while (current != null)
899 // NOTE Do not dispose keyFrames object returned by GetRefinedKeyFrames() here.
900 AnimateBetween(current.Property, current.RefineKeyFrames(keyFrames) ?? throw new ArgumentException("Invalid " + nameof(keyFrames)), alphaFunction, interpolation);
901 current = current.NextResult;
907 /// Animates a property between keyframes.
909 /// <param name="target">The target object to animate</param>
910 /// <param name="property">The target property to animate</param>
911 /// <param name="keyFrames">The set of time/value pairs between which to animate</param>
912 /// <param name="startTime">The start time of animation in milliseconds.</param>
913 /// <param name="endTime">The end time of animation in milliseconds.</param>
914 /// <param name="interpolation">The method used to interpolate between values.</param>
915 /// <param name="alphaFunction">The alpha function to apply.</param>
916 /// <exception cref="ArgumentNullException"> Thrown when target or property or keyFrames is null. </exception>
917 /// <exception cref="ArgumentException"> Thrown when it failed to find a property from given string or the given keyFrames has invalid value. </exception>
918 /// <since_tizen> 3 </since_tizen>
919 public void AnimateBetween(View target, string property, KeyFrames keyFrames, int startTime, int endTime, Interpolation interpolation = Interpolation.Linear, AlphaFunction alphaFunction = null)
923 throw new ArgumentNullException(nameof(target));
925 if (property == null)
927 throw new ArgumentNullException(nameof(property));
929 if (keyFrames == null)
931 throw new ArgumentNullException(nameof(keyFrames));
934 using (var result = PropertyHelper.Search(target, property))
938 throw new ArgumentException("string property is invalid");
941 var current = result;
942 using (var time = new TimePeriod(startTime, endTime - startTime))
943 while (current != null)
945 // NOTE Do not dispose keyFrames object returned by GetRefinedKeyFrames() here.
946 AnimateBetween(current.Property, current.RefineKeyFrames(keyFrames) ?? throw new ArgumentException("Invalid " + nameof(keyFrames)), alphaFunction, time, interpolation);
947 current = current.NextResult;
953 /// Animates the view's position and orientation through a predefined path.<br />
954 /// The view will rotate to orient the supplied forward vector with the path's tangent.<br />
955 /// If forward is the zero vector then no rotation will happen.<br />
957 /// <param name="view">The view to animate.</param>
958 /// <param name="path">It defines position and orientation.</param>
959 /// <param name="forward">The vector (in local space coordinate system) will be oriented with the path's tangent direction.</param>
960 /// <param name="alphaFunction">The alpha function to apply.</param>
961 /// <since_tizen> 3 </since_tizen>
962 public void AnimatePath(View view, Path path, Vector3 forward, AlphaFunction alphaFunction = null)
964 if (alphaFunction == null)
966 Animate(view, path, forward);
970 Animate(view, path, forward, alphaFunction);
975 /// Animates the view's position and orientation through a predefined path.<br />
976 /// The view will rotate to orient the supplied forward vector with the path's tangent.<br />
977 /// If forward is the zero vector then no rotation will happen.<br />
979 /// <param name="view">The view to animate.</param>
980 /// <param name="path">It defines position and orientation.</param>
981 /// <param name="forward">The vector (in local space coordinate system) will be oriented with the path's tangent direction.</param>
982 /// <param name="startTime">The start time of the animation.</param>
983 /// <param name="endTime">The end time of the animation.</param>
984 /// <param name="alphaFunction">The alpha function to apply.</param>
985 /// <since_tizen> 3 </since_tizen>
986 public void AnimatePath(View view, Path path, Vector3 forward, int startTime, int endTime, AlphaFunction alphaFunction = null)
988 TimePeriod time = new TimePeriod(startTime, endTime - startTime);
989 if (alphaFunction == null)
991 Animate(view, path, forward, time);
995 Animate(view, path, forward, alphaFunction, time);
1001 /// Creates an initialized animation.<br />
1002 /// The animation will not loop.<br />
1003 /// The default end action is "Cancel".<br />
1004 /// The default alpha function is linear.<br />
1006 /// <since_tizen> 3 </since_tizen>
1007 public Animation() : this(Interop.Animation.New(0.0f), true)
1009 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1013 /// Plays the animation.
1015 /// <since_tizen> 3 </since_tizen>
1018 Interop.Animation.Play(SwigCPtr);
1019 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1021 if (DisableAnimation == true)
1022 Stop(EndActions.StopFinal);
1026 /// Plays the animation from a given point.<br />
1027 /// The progress must be in the 0-1 interval or in the play range interval if defined,
1028 /// otherwise, it will be ignored.<br />
1030 /// <param name="progress">A value between [0,1], or between the play range if specified, from where the animation should start playing.</param>
1031 /// <since_tizen> 3 </since_tizen>
1032 public void PlayFrom(float progress)
1034 Interop.Animation.PlayFrom(SwigCPtr, progress);
1035 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1039 /// Plays the animation after a given delay time.<br/>
1040 /// The delay time is not included in the looping time.<br/>
1041 /// When the delay time is a negative value, it would treat as play immediately.<br/>
1043 /// <param name="delayMilliseconds">The delay time.</param>
1044 /// <since_tizen> 4 </since_tizen>
1045 public void PlayAfter(int delayMilliseconds)
1047 Interop.Animation.PlayAfter(SwigCPtr, MilliSecondsToSeconds(delayMilliseconds));
1048 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1052 /// Pauses the animation.
1054 /// <since_tizen> 3 </since_tizen>
1057 Interop.Animation.Pause(SwigCPtr);
1058 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1062 /// Stops the animation.
1064 /// <since_tizen> 3 </since_tizen>
1067 Interop.Animation.Stop(SwigCPtr);
1068 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1072 /// Clears the animation.<br />
1073 /// This disconnects any objects that were being animated, effectively stopping the animation.<br />
1075 /// <since_tizen> 3 </since_tizen>
1078 Interop.Animation.Clear(SwigCPtr);
1079 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1082 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Animation obj)
1084 return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.SwigCPtr;
1087 internal object ConvertTo(object value, Type toType)
1089 Func<object> getConverter = () =>
1091 string converterTypeName = GetTypeConverterTypeName(toType.GetTypeInfo().CustomAttributes);
1092 if (converterTypeName == null)
1095 Type convertertype = Type.GetType(converterTypeName);
1096 return Activator.CreateInstance(convertertype);
1099 return ConvertTo(value, toType, getConverter);
1102 internal object ConvertTo(object value, Type toType, Func<object> getConverter)
1107 var str = value as string;
1110 //If there's a [TypeConverter], use it
1111 object converter = getConverter?.Invoke();
1112 var xfTypeConverter = converter as Tizen.NUI.Binding.TypeConverter;
1113 if (xfTypeConverter != null)
1114 return value = xfTypeConverter.ConvertFromInvariantString(str);
1115 var converterType = converter?.GetType();
1116 if (converterType != null)
1118 var convertFromStringInvariant = converterType.GetRuntimeMethod("ConvertFromInvariantString",
1119 new[] { typeof(string) });
1120 if (convertFromStringInvariant != null)
1121 return value = convertFromStringInvariant.Invoke(converter, new object[] { str });
1124 //If the type is nullable, as the value is not null, it's safe to assume we want the built-in conversion
1125 if (toType.GetTypeInfo().IsGenericType && toType.GetGenericTypeDefinition() == typeof(Nullable<>))
1126 toType = Nullable.GetUnderlyingType(toType);
1128 //Obvious Built-in conversions
1129 if (toType.GetTypeInfo().IsEnum)
1130 return Enum.Parse(toType, str, true);
1131 if (toType == typeof(SByte))
1132 return SByte.Parse(str, CultureInfo.InvariantCulture);
1133 if (toType == typeof(Int16))
1134 return Int16.Parse(str, CultureInfo.InvariantCulture);
1135 if (toType == typeof(Int32))
1136 return Int32.Parse(str, CultureInfo.InvariantCulture);
1137 if (toType == typeof(Int64))
1138 return Int64.Parse(str, CultureInfo.InvariantCulture);
1139 if (toType == typeof(Byte))
1140 return Byte.Parse(str, CultureInfo.InvariantCulture);
1141 if (toType == typeof(UInt16))
1142 return UInt16.Parse(str, CultureInfo.InvariantCulture);
1143 if (toType == typeof(UInt32))
1144 return UInt32.Parse(str, CultureInfo.InvariantCulture);
1145 if (toType == typeof(UInt64))
1146 return UInt64.Parse(str, CultureInfo.InvariantCulture);
1147 if (toType == typeof(Single))
1148 return Single.Parse(str, CultureInfo.InvariantCulture);
1149 if (toType == typeof(Double))
1150 return Double.Parse(str, CultureInfo.InvariantCulture);
1151 if (toType == typeof(Boolean))
1152 return Boolean.Parse(str);
1153 if (toType == typeof(TimeSpan))
1154 return TimeSpan.Parse(str, CultureInfo.InvariantCulture);
1155 if (toType == typeof(DateTime))
1156 return DateTime.Parse(str, CultureInfo.InvariantCulture);
1157 if (toType == typeof(Char))
1160 _ = Char.TryParse(str, out c);
1163 if (toType == typeof(String) && str.StartsWith("{}", StringComparison.Ordinal))
1164 return str.Substring(2);
1165 if (toType == typeof(String))
1167 if (toType == typeof(Decimal))
1168 return Decimal.Parse(str, CultureInfo.InvariantCulture);
1171 //if the value is not assignable and there's an implicit conversion, convert
1172 if (value != null && !toType.IsAssignableFrom(value.GetType()))
1174 var opImplicit = GetImplicitConversionOperator(value.GetType(), value.GetType(), toType)
1175 ?? GetImplicitConversionOperator(toType, value.GetType(), toType);
1176 //var opImplicit = value.GetType().GetImplicitConversionOperator(fromType: value.GetType(), toType: toType)
1177 // ?? toType.GetImplicitConversionOperator(fromType: value.GetType(), toType: toType);
1179 if (opImplicit != null)
1181 value = opImplicit.Invoke(null, new[] { value });
1189 internal string GetTypeConverterTypeName(IEnumerable<CustomAttributeData> attributes)
1191 var converterAttribute =
1192 attributes.FirstOrDefault(cad => Tizen.NUI.Binding.TypeConverterAttribute.TypeConvertersType.Contains(cad.AttributeType.FullName));
1193 if (converterAttribute == null)
1195 if (converterAttribute.ConstructorArguments[0].ArgumentType == typeof(string))
1196 return (string)converterAttribute.ConstructorArguments[0].Value;
1197 if (converterAttribute.ConstructorArguments[0].ArgumentType == typeof(Type))
1198 return ((Type)converterAttribute.ConstructorArguments[0].Value).AssemblyQualifiedName;
1202 internal MethodInfo GetImplicitConversionOperator(Type onType, Type fromType, Type toType)
1205 var mi = onType.GetRuntimeMethod("op_Implicit", new[] { fromType });
1207 var bindingFlags = BindingFlags.Public | BindingFlags.Static | BindingFlags.FlattenHierarchy;
1208 var mi = onType.GetMethod("op_Implicit", bindingFlags, null, new[] { fromType }, null);
1210 if (mi == null) return null;
1211 if (!mi.IsSpecialName) return null;
1212 if (!mi.IsPublic) return null;
1213 if (!mi.IsStatic) return null;
1214 if (!toType.IsAssignableFrom(mi.ReturnType)) return null;
1219 internal Animation(float durationSeconds) : this(Interop.Animation.New(durationSeconds), true)
1221 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1225 internal Animation(Animation handle) : this(Interop.Animation.NewAnimation(Animation.getCPtr(handle)), true)
1227 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1230 internal Animation Assign(Animation rhs)
1232 Animation ret = new Animation(Interop.Animation.Assign(SwigCPtr, Animation.getCPtr(rhs)), false);
1233 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1237 internal void SetDuration(float seconds)
1239 Interop.Animation.SetDuration(SwigCPtr, seconds);
1240 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1243 internal float GetDuration()
1245 float ret = Interop.Animation.GetDuration(SwigCPtr);
1246 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1250 internal void SetLooping(bool looping)
1252 Interop.Animation.SetLooping(SwigCPtr, looping);
1253 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1256 internal void SetLoopCount(int count)
1258 Interop.Animation.SetLoopCount(SwigCPtr, count);
1259 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1262 internal int GetLoopCount()
1264 int ret = Interop.Animation.GetLoopCount(SwigCPtr);
1265 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1269 internal int GetCurrentLoop()
1271 int ret = Interop.Animation.GetCurrentLoop(SwigCPtr);
1272 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1276 internal bool IsLooping()
1278 bool ret = Interop.Animation.IsLooping(SwigCPtr);
1279 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1283 internal void SetEndAction(Animation.EndActions action)
1285 Interop.Animation.SetEndAction(SwigCPtr, (int)action);
1286 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1289 internal Animation.EndActions GetEndAction()
1291 Animation.EndActions ret = (Animation.EndActions)Interop.Animation.GetEndAction(SwigCPtr);
1292 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1296 internal void SetDisconnectAction(Animation.EndActions disconnectAction)
1298 Interop.Animation.SetDisconnectAction(SwigCPtr, (int)disconnectAction);
1299 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1302 internal Animation.EndActions GetDisconnectAction()
1304 Animation.EndActions ret = (Animation.EndActions)Interop.Animation.GetDisconnectAction(SwigCPtr);
1305 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1309 internal void SetDefaultAlphaFunction(AlphaFunction alpha)
1311 Interop.Animation.SetDefaultAlphaFunction(SwigCPtr, AlphaFunction.getCPtr(alpha));
1312 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1315 internal AlphaFunction GetDefaultAlphaFunction()
1317 AlphaFunction ret = new AlphaFunction(Interop.Animation.GetDefaultAlphaFunction(SwigCPtr), true);
1318 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1322 internal void SetCurrentProgress(float progress)
1324 Interop.Animation.SetCurrentProgress(SwigCPtr, progress);
1325 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1328 internal float GetCurrentProgress()
1330 float ret = Interop.Animation.GetCurrentProgress(SwigCPtr);
1331 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1335 internal void SetSpeedFactor(float factor)
1337 Interop.Animation.SetSpeedFactor(SwigCPtr, factor);
1338 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1341 internal float GetSpeedFactor()
1343 float ret = Interop.Animation.GetSpeedFactor(SwigCPtr);
1344 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1348 internal void SetPlayRange(Vector2 range)
1350 Interop.Animation.SetPlayRange(SwigCPtr, Vector2.getCPtr(range));
1351 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1354 internal Vector2 GetPlayRange()
1356 Vector2 ret = new Vector2(Interop.Animation.GetPlayRange(SwigCPtr), true);
1357 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1361 internal Animation.States GetState()
1363 Animation.States ret = (Animation.States)Interop.Animation.GetState(SwigCPtr);
1364 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1368 internal AnimationSignal FinishedSignal()
1370 AnimationSignal ret = new AnimationSignal(Interop.Animation.FinishedSignal(SwigCPtr), false);
1371 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1375 internal AnimationSignal ProgressReachedSignal()
1377 AnimationSignal ret = new AnimationSignal(Interop.Animation.ProgressReachedSignal(SwigCPtr), false);
1378 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1382 internal void AnimateBy(Property target, PropertyValue relativeValue, AlphaFunction alpha)
1386 Interop.Animation.AnimateBy(SwigCPtr, Property.getCPtr(target), PropertyValue.getCPtr(relativeValue));
1390 Interop.Animation.AnimateByAlphaFunction(SwigCPtr, Property.getCPtr(target), PropertyValue.getCPtr(relativeValue), AlphaFunction.getCPtr(alpha));
1392 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1395 internal void AnimateBy(Property target, PropertyValue relativeValue, AlphaFunction alpha, TimePeriod period)
1399 Interop.Animation.AnimateByTimePeriod(SwigCPtr, Property.getCPtr(target), PropertyValue.getCPtr(relativeValue), TimePeriod.getCPtr(period));
1403 Interop.Animation.AnimateBy(SwigCPtr, Property.getCPtr(target), PropertyValue.getCPtr(relativeValue), AlphaFunction.getCPtr(alpha), TimePeriod.getCPtr(period));
1405 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1408 internal void AnimateTo(Property target, PropertyValue destinationValue, AlphaFunction alpha)
1412 Interop.Animation.AnimateTo(SwigCPtr, Property.getCPtr(target), PropertyValue.getCPtr(destinationValue));
1416 Interop.Animation.AnimateToAlphaFunction(SwigCPtr, Property.getCPtr(target), PropertyValue.getCPtr(destinationValue), AlphaFunction.getCPtr(alpha));
1418 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1421 internal void AnimateTo(Property target, PropertyValue destinationValue, AlphaFunction alpha, TimePeriod period)
1425 Interop.Animation.AnimateToTimePeriod(SwigCPtr, Property.getCPtr(target), PropertyValue.getCPtr(destinationValue), TimePeriod.getCPtr(period));
1429 Interop.Animation.AnimateTo(SwigCPtr, Property.getCPtr(target), PropertyValue.getCPtr(destinationValue), AlphaFunction.getCPtr(alpha), TimePeriod.getCPtr(period));
1431 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1434 internal void AnimateBetween(Property target, KeyFrames keyFrames)
1436 Interop.Animation.AnimateBetween(SwigCPtr, Property.getCPtr(target), KeyFrames.getCPtr(keyFrames));
1437 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1440 internal void AnimateBetween(Property target, KeyFrames keyFrames, AlphaFunction alpha)
1442 Interop.Animation.AnimateBetweenAlphaFunction(SwigCPtr, Property.getCPtr(target), KeyFrames.getCPtr(keyFrames), AlphaFunction.getCPtr(alpha));
1443 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1446 internal void AnimateBetween(Property target, KeyFrames keyFrames, AlphaFunction alpha, Animation.Interpolation interpolation)
1450 Interop.Animation.AnimateBetween(SwigCPtr, Property.getCPtr(target), KeyFrames.getCPtr(keyFrames), (int)interpolation);
1454 Interop.Animation.AnimateBetweenAlphaFunctionInterpolation(SwigCPtr, Property.getCPtr(target), KeyFrames.getCPtr(keyFrames), AlphaFunction.getCPtr(alpha), (int)interpolation);
1456 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1459 internal void AnimateBetween(Property target, KeyFrames keyFrames, TimePeriod period)
1461 Interop.Animation.AnimateBetweenTimePeriod(SwigCPtr, Property.getCPtr(target), KeyFrames.getCPtr(keyFrames), TimePeriod.getCPtr(period));
1462 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1465 internal void AnimateBetween(Property target, KeyFrames keyFrames, AlphaFunction alpha, TimePeriod period)
1467 Interop.Animation.AnimateBetween(SwigCPtr, Property.getCPtr(target), KeyFrames.getCPtr(keyFrames), AlphaFunction.getCPtr(alpha), TimePeriod.getCPtr(period));
1468 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1471 internal void AnimateBetween(Property target, KeyFrames keyFrames, AlphaFunction alpha, TimePeriod period, Animation.Interpolation interpolation)
1475 Interop.Animation.AnimateBetweenTimePeriodInterpolation(SwigCPtr, Property.getCPtr(target), KeyFrames.getCPtr(keyFrames), TimePeriod.getCPtr(period), (int)interpolation);
1479 Interop.Animation.AnimateBetween(SwigCPtr, Property.getCPtr(target), KeyFrames.getCPtr(keyFrames), AlphaFunction.getCPtr(alpha), TimePeriod.getCPtr(period), (int)interpolation);
1481 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1484 internal void Animate(View view, Path path, Vector3 forward)
1486 Interop.Animation.Animate(SwigCPtr, View.getCPtr(view), Path.getCPtr(path), Vector3.getCPtr(forward));
1487 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1490 internal void Animate(View view, Path path, Vector3 forward, AlphaFunction alpha)
1492 Interop.Animation.AnimateAlphaFunction(SwigCPtr, View.getCPtr(view), Path.getCPtr(path), Vector3.getCPtr(forward), AlphaFunction.getCPtr(alpha));
1493 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1496 internal void Animate(View view, Path path, Vector3 forward, TimePeriod period)
1498 Interop.Animation.AnimateTimePeriod(SwigCPtr, View.getCPtr(view), Path.getCPtr(path), Vector3.getCPtr(forward), TimePeriod.getCPtr(period));
1499 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1502 internal void Animate(View view, Path path, Vector3 forward, AlphaFunction alpha, TimePeriod period)
1504 Interop.Animation.Animate(SwigCPtr, View.getCPtr(view), Path.getCPtr(path), Vector3.getCPtr(forward), AlphaFunction.getCPtr(alpha), TimePeriod.getCPtr(period));
1505 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1508 internal void Show(View view, float delaySeconds)
1510 Interop.Animation.Show(SwigCPtr, View.getCPtr(view), delaySeconds);
1511 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1514 internal void Hide(View view, float delaySeconds)
1516 Interop.Animation.Hide(SwigCPtr, View.getCPtr(view), delaySeconds);
1517 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1521 /// To make animation instance be disposed.
1523 /// <since_tizen> 3 </since_tizen>
1524 protected override void Dispose(DisposeTypes type)
1531 if (animationFinishedEventHandler != null)
1533 AnimationSignal finishedSignal = FinishedSignal();
1534 finishedSignal?.Disconnect(finishedCallbackOfNative);
1535 finishedSignal?.Dispose();
1536 animationFinishedEventHandler = null;
1539 if (animationProgressReachedEventCallback != null)
1541 AnimationSignal progressReachedSignal = ProgressReachedSignal();
1542 progressReachedSignal?.Disconnect(animationProgressReachedEventCallback);
1543 progressReachedSignal?.Dispose();
1544 animationProgressReachedEventCallback = null;
1550 /// This will not be public opened.
1551 [EditorBrowsable(EditorBrowsableState.Never)]
1552 protected override void ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef swigCPtr)
1554 if (swigCPtr.Handle == IntPtr.Zero || this.HasBody() == false)
1556 Tizen.Log.Fatal("NUI", $"[ERROR] Animation ReleaseSwigCPtr()! IntPtr=0x{swigCPtr.Handle:X} HasBody={this.HasBody()}");
1559 Interop.Animation.DeleteAnimation(swigCPtr);
1562 private void OnFinished(IntPtr data)
1564 if (animationFinishedEventHandler != null)
1566 //here we send all data to user event handlers
1567 animationFinishedEventHandler(this, null);
1571 private void OnProgressReached(IntPtr data)
1573 if (animationProgressReachedEventHandler != null)
1575 //here we send all data to user event handlers
1576 animationProgressReachedEventHandler(this, null);
1580 private float MilliSecondsToSeconds(int millisec)
1582 return (float)millisec / 1000.0f;
1585 private int SecondsToMilliSeconds(float sec)
1587 return (int)(sec * 1000);