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 Tizen.NUI.BaseComponents;
25 using System.Collections;
26 using System.Collections.Generic;
28 using System.Reflection;
30 using Tizen.NUI.Binding.Internals;
31 using Tizen.NUI.Binding;
32 using System.Globalization;
33 using Tizen.NUI.Xaml.Internals;
34 using System.Diagnostics.CodeAnalysis;
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;
49 private AnimationFinishedEventCallbackType _animationFinishedEventCallback;
50 private System.IntPtr _finishedCallbackOfNative;
52 private AnimationProgressReachedEventCallbackType _animationProgressReachedEventCallback;
54 private string[] _properties = null;
55 private string[] _destValue = null;
56 private int[] _startTime = null;
57 private int[] _endTime = null;
59 private List<string> propertyList = null;
60 private List<string> destValueList = null;
61 private List<int> startTimeList = null;
62 private List<int> endTimeList = null;
65 /// Creates an initialized animation.<br />
66 /// The animation will not loop.<br />
67 /// The default end action is "Cancel".<br />
68 /// The default alpha function is linear.<br />
70 /// <remarks>DurationmSeconds must be greater than zero.</remarks>
71 /// <param name="durationMilliSeconds">The duration in milliseconds.</param>
72 /// <since_tizen> 3 </since_tizen>
73 public Animation(int durationMilliSeconds) : this(Interop.Animation.New((float)durationMilliSeconds / 1000.0f), true)
75 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
78 internal Animation(global::System.IntPtr cPtr, bool cMemoryOwn) : base(cPtr, cMemoryOwn)
81 _animationFinishedEventCallback = OnFinished;
82 _finishedCallbackOfNative = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate<System.Delegate>(_animationFinishedEventCallback);
85 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
86 private delegate void AnimationFinishedEventCallbackType(IntPtr data);
88 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
89 private delegate void AnimationProgressReachedEventCallbackType(IntPtr data);
91 private event EventHandler _animationFinishedEventHandler;
94 * @brief Event for the finished signal which can be used to subscribe or unsubscribe the event handler.
95 * The finished signal is emitted when an animation's animations have finished.
97 /// <since_tizen> 3 </since_tizen>
98 public event EventHandler Finished
102 if (_animationFinishedEventHandler == null && disposed == false)
104 AnimationSignal finishedSignal = FinishedSignal();
105 finishedSignal.Connect(_finishedCallbackOfNative);
106 finishedSignal.Dispose();
108 _animationFinishedEventHandler += value;
112 _animationFinishedEventHandler -= value;
114 AnimationSignal finishedSignal = FinishedSignal();
115 if (_animationFinishedEventHandler == null && finishedSignal.Empty() == false)
117 finishedSignal.Disconnect(_finishedCallbackOfNative);
119 finishedSignal.Dispose();
123 private event EventHandler _animationProgressReachedEventHandler;
126 * @brief Event for the ProgressReached signal, which can be used to subscribe or unsubscribe the event handler.
127 * The ProgressReached signal is emitted when the animation has reached a given progress percentage, this is set in the api SetProgressNotification.
129 /// <since_tizen> 3 </since_tizen>
130 public event EventHandler ProgressReached
134 if (_animationProgressReachedEventHandler == null)
136 _animationProgressReachedEventCallback = OnProgressReached;
137 AnimationSignal progressReachedSignal = ProgressReachedSignal();
138 progressReachedSignal?.Connect(_animationProgressReachedEventCallback);
139 progressReachedSignal?.Dispose();
142 _animationProgressReachedEventHandler += value;
146 _animationProgressReachedEventHandler -= value;
148 AnimationSignal progressReachedSignal = ProgressReachedSignal();
149 if (_animationProgressReachedEventHandler == null && progressReachedSignal?.Empty() == false)
151 progressReachedSignal?.Disconnect(_animationProgressReachedEventCallback);
153 progressReachedSignal.Dispose();
158 /// Enumeration for what to do when the animation ends, stopped, or destroyed.
160 /// <since_tizen> 3 </since_tizen>
161 [System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1717:Only FlagsAttribute enums should have plural names")]
162 public enum EndActions
165 /// When the animation ends, the animated property values are saved.
169 /// When the animation ends, the animated property values are forgotten.
173 /// If the animation is stopped, the animated property values are saved as if the animation had run to completion, otherwise behaves like cancel.
179 /// Enumeration for what interpolation method to use on key-frame animations.
181 /// <since_tizen> 3 </since_tizen>
182 public enum Interpolation
185 /// Values in between key frames are interpolated using a linear polynomial. (Default)
189 /// Values in between key frames are interpolated using a cubic polynomial.
195 /// Enumeration for what state the animation is in.
197 /// <remarks>Calling Reset() on this class will not reset the animation. It will call the BaseHandle.Reset() which drops the object handle.</remarks>
198 /// <since_tizen> 3 </since_tizen>
199 [System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1717:Only FlagsAttribute enums should have plural names")]
203 /// The animation has stopped.
207 /// The animation is playing.
211 /// The animation is paused.
217 /// Gets or sets the duration in milliseconds of the animation.
219 /// <since_tizen> 3 </since_tizen>
224 SetDuration(MilliSecondsToSeconds(value));
228 return SecondsToMilliSeconds(GetDuration());
233 /// Gets or sets the default alpha function for the animation.
235 /// <since_tizen> 3 </since_tizen>
236 public AlphaFunction DefaultAlphaFunction
240 SetDefaultAlphaFunction(value);
244 AlphaFunction ret = GetDefaultAlphaFunction();
250 /// Queries the state of the animation.
252 /// <since_tizen> 3 </since_tizen>
262 /// Set: Enables looping for a specified number of repeats. A zero is the same as Looping = true; i.e., repeat forever.<br />
263 /// This property resets the looping value and should not be used with the Looping property.<br />
264 /// Setting this parameter does not cause the animation to Play().<br />
265 /// Get: Gets the loop count. A zero is the same as Looping = true; i.e., repeat forever.<br />
266 /// The loop count is initially 1 for play once.<br />
268 /// <since_tizen> 3 </since_tizen>
277 int ret = GetLoopCount();
283 /// Gets or sets the status of whether the animation will loop.<br />
284 /// This property resets the loop count and should not be used with the LoopCount property.<br />
285 /// Setting this parameter does not cause the animation to Play().<br />
287 /// <since_tizen> 3 </since_tizen>
296 bool ret = IsLooping();
303 /// Gets or sets the end action of the animation.<br />
304 /// This action is performed when the animation ends or if it is stopped.<br />
305 /// The default end action is cancel.<br />
307 /// <since_tizen> 3 </since_tizen>
308 public EndActions EndAction
316 return GetEndAction();
321 /// Gets the current loop count.<br />
322 /// A value 0 indicating the current loop count when looping.<br />
324 /// <since_tizen> 3 </since_tizen>
325 public int CurrentLoop
329 return GetCurrentLoop();
334 /// Gets or sets the disconnect action.<br />
335 /// If any of the animated property owners are disconnected from the stage while the animation is being played, then this action is performed.<br />
336 /// The default action is cancel.<br />
338 /// <since_tizen> 3 </since_tizen>
339 public EndActions DisconnectAction
343 Interop.Animation.SetDisconnectAction(SwigCPtr, (int)value);
344 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
348 Animation.EndActions ret = (Animation.EndActions)Interop.Animation.GetDisconnectAction(SwigCPtr);
349 if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve());
356 /// Gets or sets the progress of the animation.<br />
357 /// The animation will play (or continue playing) from this point.<br />
358 /// The progress must be in the 0-1 interval or in the play range interval if defined<br />
359 /// otherwise, it will be ignored.<br />
361 /// <since_tizen> 3 </since_tizen>
362 public float CurrentProgress
366 Interop.Animation.SetCurrentProgress(SwigCPtr, value);
367 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
371 float ret = Interop.Animation.GetCurrentProgress(SwigCPtr);
372 if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve());
378 /// Gets or sets specificifications of a speed factor for the animation.<br />
379 /// The speed factor is a multiplier of the normal velocity of the animation.<br />
380 /// Values between [0, 1] will slow down the animation and values above one will speed up the animation.<br />
381 /// It is also possible to specify a negative multiplier to play the animation in reverse.<br />
383 /// <since_tizen> 3 </since_tizen>
384 public float SpeedFactor
388 Interop.Animation.SetSpeedFactor(SwigCPtr, value);
389 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
393 float ret = Interop.Animation.GetSpeedFactor(SwigCPtr);
394 if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve());
400 /// Gets or sets the playing range.<br />
401 /// Animation will play between the values specified. Both values (range.x and range.y ) should be between 0-1,
402 /// otherwise they will be ignored. If the range provided is not in proper order (minimum, maximum ), it will be reordered.<br />
404 /// <since_tizen> 3 </since_tizen>
405 public RelativeVector2 PlayRange
409 Interop.Animation.SetPlayRange(SwigCPtr, Vector2.getCPtr(value));
410 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
414 Vector2 ret = new Vector2(Interop.Animation.GetPlayRange(SwigCPtr), true);
415 if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve());
422 /// Gets or sets the progress notification marker which triggers the ProgressReachedSignal.<br />
423 /// Percentage of animation progress should be greater than 0 and less than 1, for example, 0.3 for 30% <br />
424 /// One notification can be set on each animation.
426 /// <since_tizen> 3 </since_tizen>
427 public float ProgressNotification
431 Interop.Animation.SetProgressNotification(SwigCPtr, value);
432 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
436 float ret = Interop.Animation.GetProgressNotification(SwigCPtr);
437 if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve());
443 /// Gets or sets the properties of the animation.
445 //ToDo : will raise deprecated-ACR, [Obsolete("Deprecated in API9, Will be removed in API11, Please use PropertyList instead")]
446 [SuppressMessage("Microsoft.Performance", "CA1819:PropertiesShouldNotReturnArrays", Justification = "This API will be deprecated, so suppressing the warning for now")]
447 public string[] Properties
460 /// Gets or sets the destination value for each property of the animation.
462 //ToDo : will raise deprecated-ACR, [Obsolete("Deprecated in API9, Will be removed in API11, Please use DestValueList instead")]
463 [SuppressMessage("Microsoft.Performance", "CA1819:PropertiesShouldNotReturnArrays", Justification = "This API will be deprecated, so suppressing the warning for now")]
464 public string[] DestValue
477 /// Gets or sets the start time for each property of the animation.
479 //ToDo : will raise deprecated-ACR, [Obsolete("Deprecated in API9, Will be removed in API11, Please use StartTimeList instead")]
480 [SuppressMessage("Microsoft.Performance", "CA1819:PropertiesShouldNotReturnArrays", Justification = "This API will be deprecated, so suppressing the warning for now")]
481 public int[] StartTime
494 /// Gets or sets the end time for each property of the animation.
496 //ToDo : will raise deprecated-ACR, [Obsolete("Deprecated in API9, Will be removed in API11, Please use EndTimeList instead")]
497 [SuppressMessage("Microsoft.Performance", "CA1819:PropertiesShouldNotReturnArrays", Justification = "This API will be deprecated, so suppressing the warning for now")]
511 /// Get the list of the properties of the animation.
513 [EditorBrowsable(EditorBrowsableState.Never)]
514 public IList<string> PropertyList
518 if (null == propertyList)
520 propertyList = new List<string>();
528 /// Get the list of the destination value for each property of the animation.
530 [EditorBrowsable(EditorBrowsableState.Never)]
531 public IList<string> DestValueList
535 if (null == destValueList)
537 destValueList = new List<string>();
540 return destValueList;
545 /// Get the list of the start time for each property of the animation.
547 [EditorBrowsable(EditorBrowsableState.Never)]
548 public IList<int> StartTimeList
552 if (null == startTimeList)
554 startTimeList = new List<int>();
557 return startTimeList;
562 /// Get the list of end time for each property of the animation.
564 [EditorBrowsable(EditorBrowsableState.Never)]
565 public IList<int> EndTimeList
569 if (null == endTimeList)
571 endTimeList = new List<int>();
578 private bool DisableAnimation
582 if (disableAnimation.HasValue == false)
584 string type = Environment.GetEnvironmentVariable("PlatformSmartType");
586 disableAnimation = true;
588 disableAnimation = false;
590 return disableAnimation.Value;
595 /// Downcasts a handle to animation handle.<br />
596 /// If handle points to an animation object, the downcast produces a valid handle.<br />
597 /// If not, the returned handle is left uninitialized.<br />
599 /// <param name="handle">Handle to an object.</param>
600 /// <returns>Handle to an animation object or an uninitialized handle.</returns>
601 /// <exception cref="ArgumentNullException"> Thrown when handle is null. </exception>
602 internal static Animation DownCast(BaseHandle handle)
606 throw new ArgumentNullException(nameof(handle));
608 Animation ret = Registry.GetManagedBaseHandleFromNativePtr(handle) as Animation;
609 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
614 /// Stops the animation.
616 /// <param name="action">The end action can be set.</param>
617 /// <since_tizen> 3 </since_tizen>
618 public void Stop(EndActions action = EndActions.Cancel)
620 SetEndAction(action);
621 Interop.Animation.Stop(SwigCPtr);
622 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
626 /// Animates a property value by a relative amount.<br />
628 /// <param name="target">The target object to animate.</param>
629 /// <param name="property">The target property to animate.</param>
630 /// <param name="relativeValue">The property value will change by this amount.</param>
631 /// <param name="alphaFunction">The alpha function to apply.</param>
632 /// <exception cref="ArgumentNullException"> Thrown when target or property or relativeValue is null. </exception>
633 /// <exception cref="ArgumentException"> Thrown when it failed to find a property from given string or the given relativeValue is invalid format. </exception>
634 /// <since_tizen> 3 </since_tizen>
635 public void AnimateBy(View target, string property, object relativeValue, AlphaFunction alphaFunction = null)
639 throw new ArgumentNullException(nameof(target));
641 if (property == null)
643 throw new ArgumentNullException(nameof(property));
645 if (relativeValue == null)
647 throw new ArgumentNullException(nameof(relativeValue));
650 using (var result = PropertyHelper.Search(target, property))
654 throw new ArgumentException("string property is invalid");
657 var current = result;
658 while (current != null)
660 var targetValue = current.RefineValue(relativeValue) ?? throw new ArgumentException("Invalid " + nameof(relativeValue));
661 AnimateBy(current.Property, targetValue, alphaFunction);
662 targetValue.Dispose();
663 current = current.NextResult;
669 /// Animates a property value by a relative amount.<br />
671 /// <param name="target">The target object to animate.</param>
672 /// <param name="property">The target property to animate.</param>
673 /// <param name="relativeValue">The property value will change by this amount.</param>
674 /// <param name="startTime">The start time of the animation.</param>
675 /// <param name="endTime">The end time of the animation.</param>
676 /// <param name="alphaFunction">The alpha function to apply.</param>
677 /// <exception cref="ArgumentNullException"> Thrown when target or property or relativeValue is null. </exception>
678 /// <exception cref="ArgumentException"> Thrown when it failed to find a property from given string or the given relativeValue is invalid format. </exception>
679 /// <since_tizen> 3 </since_tizen>
680 public void AnimateBy(View target, string property, object relativeValue, int startTime, int endTime, AlphaFunction alphaFunction = null)
684 throw new ArgumentNullException(nameof(target));
686 if (property == null)
688 throw new ArgumentNullException(nameof(property));
690 if (relativeValue == null)
692 throw new ArgumentNullException(nameof(relativeValue));
695 using (var result = PropertyHelper.Search(target, property))
699 throw new ArgumentException("string property is invalid");
702 var current = result;
703 using (var time = new TimePeriod(MilliSecondsToSeconds(startTime), MilliSecondsToSeconds(endTime - startTime)))
704 while (current != null)
706 var targetValue = current.RefineValue(relativeValue) ?? throw new ArgumentException("Invalid " + nameof(relativeValue));
707 AnimateBy(current.Property, targetValue, alphaFunction, time);
708 targetValue.Dispose();
709 current = current.NextResult;
715 /// Animates a property to a destination value.<br />
717 /// <param name="target">The target object to animate.</param>
718 /// <param name="property">The target property to animate.</param>
719 /// <param name="destinationValue">The destination value.</param>
720 /// <param name="alphaFunction">The alpha function to apply.</param>
721 /// <exception cref="ArgumentNullException"> Thrown when target or property or destinationValue is null. </exception>
722 /// <exception cref="ArgumentException"> Thrown when it failed to find a property from given string or the given destinationValue is invalid format. </exception>
723 /// <since_tizen> 3 </since_tizen>
724 public void AnimateTo(View target, string property, object destinationValue, AlphaFunction alphaFunction = null)
728 throw new ArgumentNullException(nameof(target));
730 if (property == null)
732 throw new ArgumentNullException(nameof(property));
734 if (destinationValue == null)
736 throw new ArgumentNullException(nameof(destinationValue));
739 using (var result = PropertyHelper.Search(target, property))
743 throw new ArgumentException("string property is invalid");
746 var current = result;
747 while (current != null)
749 var targetValue = current.RefineValue(destinationValue) ?? throw new ArgumentException("Invalid " + nameof(destinationValue));
750 AnimateTo(current.Property, targetValue, alphaFunction);
751 targetValue.Dispose();
752 current = current.NextResult;
758 /// Animates one or more properties to a destination value.<br />
760 /// <param name="target">The target object to animate.</param>
761 /// <exception cref="ArgumentNullException"> Thrown when target is null. </exception>
762 public void PlayAnimateTo(View target)
766 throw new ArgumentNullException(nameof(target));
771 if (null != propertyList && null != destValueList && null != startTimeList && null != endTimeList)
773 if (propertyList.Count == destValueList.Count
775 startTimeList.Count == endTimeList.Count
777 propertyList.Count == startTimeList.Count)
779 int count = propertyList.Count;
780 for (int index = 0; index < count; index++)
782 var elementType = target.GetType();
783 PropertyInfo propertyInfo = elementType.GetProperties().FirstOrDefault(fi => fi.Name == propertyList[index]);
785 if (propertyInfo != null)
787 object destinationValue = ConvertTo(destValueList[index], propertyInfo.PropertyType);
789 if (destinationValue != null)
791 AnimateTo(target, propertyList[index], destinationValue, startTimeList[index], endTimeList[index]);
800 if (_properties.Length == _destValue.Length && _startTime.Length == _endTime.Length && _properties.Length == _startTime.Length)
802 int length = _properties.Length;
803 for (int index = 0; index < length; index++)
805 //object destinationValue = _destValue[index];
806 var elementType = target.GetType();
807 PropertyInfo propertyInfo = elementType.GetProperties().FirstOrDefault(fi => fi.Name == _properties[index]);
808 //var propertyInfo = elementType.GetRuntimeProperties().FirstOrDefault(p => p.Name == localName);
809 if (propertyInfo != null)
811 object destinationValue = ConvertTo(_destValue[index], propertyInfo.PropertyType);
813 if (destinationValue != null)
815 AnimateTo(target, _properties[index], destinationValue, _startTime[index], _endTime[index]);
825 /// Animates a property to a destination value.<br />
827 /// <param name="target">The target object to animate.</param>
828 /// <param name="property">The target property to animate.</param>
829 /// <param name="destinationValue">The destination value.</param>
830 /// <param name="startTime">The start time of the animation.</param>
831 /// <param name="endTime">The end time of the animation.</param>
832 /// <param name="alphaFunction">The alpha function to apply.</param>
833 /// <exception cref="ArgumentNullException"> Thrown when target or property or destinationValue is null. </exception>
834 /// <exception cref="ArgumentException"> Thrown when it failed to find a property from given string or the given destinationValue is invalid format. </exception>
835 /// <since_tizen> 3 </since_tizen>
836 public void AnimateTo(View target, string property, object destinationValue, int startTime, int endTime, AlphaFunction alphaFunction = null)
840 throw new ArgumentNullException(nameof(target));
842 if (property == null)
844 throw new ArgumentNullException(nameof(property));
846 if (destinationValue == null)
848 throw new ArgumentNullException(nameof(destinationValue));
851 using (var result = PropertyHelper.Search(target, property))
855 throw new ArgumentException("string property is invalid");
858 var current = result;
859 using (var time = new TimePeriod(MilliSecondsToSeconds(startTime), MilliSecondsToSeconds(endTime - startTime)))
860 while (current != null)
862 var targetValue = current.RefineValue(destinationValue) ?? throw new ArgumentException("Invalid " + nameof(destinationValue));
863 AnimateTo(current.Property, targetValue, alphaFunction, time);
864 targetValue.Dispose();
865 current = current.NextResult;
871 /// Animates a property between keyframes.
873 /// <param name="target">The target object to animate.</param>
874 /// <param name="property">The target property to animate.</param>
875 /// <param name="keyFrames">The set of time or value pairs between which to animate.</param>
876 /// <param name="interpolation">The method used to interpolate between values.</param>
877 /// <param name="alphaFunction">The alpha function to apply.</param>
878 /// <exception cref="ArgumentNullException"> Thrown when target or property or keyFrames is null. </exception>
879 /// <exception cref="ArgumentException"> Thrown when it failed to find a property from given string or the given keyFrames has invalid value. </exception>
880 /// <since_tizen> 3 </since_tizen>
881 public void AnimateBetween(View target, string property, KeyFrames keyFrames, Interpolation interpolation = Interpolation.Linear, AlphaFunction alphaFunction = null)
885 throw new ArgumentNullException(nameof(target));
887 if (property == null)
889 throw new ArgumentNullException(nameof(property));
891 if (keyFrames == null)
893 throw new ArgumentNullException(nameof(keyFrames));
896 using (var result = PropertyHelper.Search(target, property))
900 throw new ArgumentException("string property is invalid");
903 var current = result;
904 while (current != null)
906 // NOTE Do not dispose keyFrames object returned by GetRefinedKeyFrames() here.
907 AnimateBetween(current.Property, current.RefineKeyFrames(keyFrames) ?? throw new ArgumentException("Invalid " + nameof(keyFrames)), alphaFunction, interpolation);
908 current = current.NextResult;
914 /// Animates a property between keyframes.
916 /// <param name="target">The target object to animate</param>
917 /// <param name="property">The target property to animate</param>
918 /// <param name="keyFrames">The set of time/value pairs between which to animate</param>
919 /// <param name="startTime">The start time of animation in milliseconds.</param>
920 /// <param name="endTime">The end time of animation in milliseconds.</param>
921 /// <param name="interpolation">The method used to interpolate between values.</param>
922 /// <param name="alphaFunction">The alpha function to apply.</param>
923 /// <exception cref="ArgumentNullException"> Thrown when target or property or keyFrames is null. </exception>
924 /// <exception cref="ArgumentException"> Thrown when it failed to find a property from given string or the given keyFrames has invalid value. </exception>
925 /// <since_tizen> 3 </since_tizen>
926 public void AnimateBetween(View target, string property, KeyFrames keyFrames, int startTime, int endTime, Interpolation interpolation = Interpolation.Linear, AlphaFunction alphaFunction = null)
930 throw new ArgumentNullException(nameof(target));
932 if (property == null)
934 throw new ArgumentNullException(nameof(property));
936 if (keyFrames == null)
938 throw new ArgumentNullException(nameof(keyFrames));
941 using (var result = PropertyHelper.Search(target, property))
945 throw new ArgumentException("string property is invalid");
948 var current = result;
949 using (var time = new TimePeriod(MilliSecondsToSeconds(startTime), MilliSecondsToSeconds(endTime - startTime)))
950 while (current != null)
952 // NOTE Do not dispose keyFrames object returned by GetRefinedKeyFrames() here.
953 AnimateBetween(current.Property, current.RefineKeyFrames(keyFrames) ?? throw new ArgumentException("Invalid " + nameof(keyFrames)), alphaFunction, time, interpolation);
954 current = current.NextResult;
960 /// Animates the view's position and orientation through a predefined path.<br />
961 /// The view will rotate to orient the supplied forward vector with the path's tangent.<br />
962 /// If forward is the zero vector then no rotation will happen.<br />
964 /// <param name="view">The view to animate.</param>
965 /// <param name="path">It defines position and orientation.</param>
966 /// <param name="forward">The vector (in local space coordinate system) will be oriented with the path's tangent direction.</param>
967 /// <param name="alphaFunction">The alpha function to apply.</param>
968 /// <since_tizen> 3 </since_tizen>
969 public void AnimatePath(View view, Path path, Vector3 forward, AlphaFunction alphaFunction = null)
971 if (alphaFunction == null)
973 Animate(view, path, forward);
977 Animate(view, path, forward, alphaFunction);
982 /// Animates the view's position and orientation through a predefined path.<br />
983 /// The view will rotate to orient the supplied forward vector with the path's tangent.<br />
984 /// If forward is the zero vector then no rotation will happen.<br />
986 /// <param name="view">The view to animate.</param>
987 /// <param name="path">It defines position and orientation.</param>
988 /// <param name="forward">The vector (in local space coordinate system) will be oriented with the path's tangent direction.</param>
989 /// <param name="startTime">The start time of the animation.</param>
990 /// <param name="endTime">The end time of the animation.</param>
991 /// <param name="alphaFunction">The alpha function to apply.</param>
992 /// <since_tizen> 3 </since_tizen>
993 public void AnimatePath(View view, Path path, Vector3 forward, int startTime, int endTime, AlphaFunction alphaFunction = null)
995 TimePeriod time = new TimePeriod(MilliSecondsToSeconds(startTime), MilliSecondsToSeconds(endTime - startTime));
996 if (alphaFunction == null)
998 Animate(view, path, forward, time);
1002 Animate(view, path, forward, alphaFunction, time);
1008 /// Creates an initialized animation.<br />
1009 /// The animation will not loop.<br />
1010 /// The default end action is "Cancel".<br />
1011 /// The default alpha function is linear.<br />
1013 /// <since_tizen> 3 </since_tizen>
1014 public Animation() : this(Interop.Animation.New(0.0f), true)
1016 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1020 /// Plays the animation.
1022 /// <since_tizen> 3 </since_tizen>
1025 Interop.Animation.Play(SwigCPtr);
1026 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1028 if (DisableAnimation == true)
1029 Stop(EndActions.StopFinal);
1033 /// Plays the animation from a given point.<br />
1034 /// The progress must be in the 0-1 interval or in the play range interval if defined,
1035 /// otherwise, it will be ignored.<br />
1037 /// <param name="progress">A value between [0,1], or between the play range if specified, from where the animation should start playing.</param>
1038 /// <since_tizen> 3 </since_tizen>
1039 public void PlayFrom(float progress)
1041 Interop.Animation.PlayFrom(SwigCPtr, progress);
1042 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1046 /// Plays the animation after a given delay time.<br/>
1047 /// The delay time is not included in the looping time.<br/>
1048 /// When the delay time is a negative value, it would treat as play immediately.<br/>
1050 /// <param name="delayMilliseconds">The delay time.</param>
1051 /// <since_tizen> 4 </since_tizen>
1052 public void PlayAfter(int delayMilliseconds)
1054 Interop.Animation.PlayAfter(SwigCPtr, MilliSecondsToSeconds(delayMilliseconds));
1055 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1059 /// Pauses the animation.
1061 /// <since_tizen> 3 </since_tizen>
1064 Interop.Animation.Pause(SwigCPtr);
1065 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1069 /// Stops the animation.
1071 /// <since_tizen> 3 </since_tizen>
1074 Interop.Animation.Stop(SwigCPtr);
1075 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1079 /// Clears the animation.<br />
1080 /// This disconnects any objects that were being animated, effectively stopping the animation.<br />
1082 /// <since_tizen> 3 </since_tizen>
1085 Interop.Animation.Clear(SwigCPtr);
1086 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1089 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Animation obj)
1091 return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.SwigCPtr;
1094 internal object ConvertTo(object value, Type toType)
1096 Func<object> getConverter = () =>
1098 string converterTypeName = GetTypeConverterTypeName(toType.GetTypeInfo().CustomAttributes);
1099 if (converterTypeName == null)
1102 Type convertertype = Type.GetType(converterTypeName);
1103 return Activator.CreateInstance(convertertype);
1106 return ConvertTo(value, toType, getConverter);
1109 internal object ConvertTo(object value, Type toType, Func<object> getConverter)
1114 var str = value as string;
1117 //If there's a [TypeConverter], use it
1118 object converter = getConverter?.Invoke();
1119 var xfTypeConverter = converter as Tizen.NUI.Binding.TypeConverter;
1120 if (xfTypeConverter != null)
1121 return value = xfTypeConverter.ConvertFromInvariantString(str);
1122 var converterType = converter?.GetType();
1123 if (converterType != null)
1125 var convertFromStringInvariant = converterType.GetRuntimeMethod("ConvertFromInvariantString",
1126 new[] { typeof(string) });
1127 if (convertFromStringInvariant != null)
1128 return value = convertFromStringInvariant.Invoke(converter, new object[] { str });
1131 //If the type is nullable, as the value is not null, it's safe to assume we want the built-in conversion
1132 if (toType.GetTypeInfo().IsGenericType && toType.GetGenericTypeDefinition() == typeof(Nullable<>))
1133 toType = Nullable.GetUnderlyingType(toType);
1135 //Obvious Built-in conversions
1136 if (toType.GetTypeInfo().IsEnum)
1137 return Enum.Parse(toType, str, true);
1138 if (toType == typeof(SByte))
1139 return SByte.Parse(str, CultureInfo.InvariantCulture);
1140 if (toType == typeof(Int16))
1141 return Int16.Parse(str, CultureInfo.InvariantCulture);
1142 if (toType == typeof(Int32))
1143 return Int32.Parse(str, CultureInfo.InvariantCulture);
1144 if (toType == typeof(Int64))
1145 return Int64.Parse(str, CultureInfo.InvariantCulture);
1146 if (toType == typeof(Byte))
1147 return Byte.Parse(str, CultureInfo.InvariantCulture);
1148 if (toType == typeof(UInt16))
1149 return UInt16.Parse(str, CultureInfo.InvariantCulture);
1150 if (toType == typeof(UInt32))
1151 return UInt32.Parse(str, CultureInfo.InvariantCulture);
1152 if (toType == typeof(UInt64))
1153 return UInt64.Parse(str, CultureInfo.InvariantCulture);
1154 if (toType == typeof(Single))
1155 return Single.Parse(str, CultureInfo.InvariantCulture);
1156 if (toType == typeof(Double))
1157 return Double.Parse(str, CultureInfo.InvariantCulture);
1158 if (toType == typeof(Boolean))
1159 return Boolean.Parse(str);
1160 if (toType == typeof(TimeSpan))
1161 return TimeSpan.Parse(str, CultureInfo.InvariantCulture);
1162 if (toType == typeof(DateTime))
1163 return DateTime.Parse(str, CultureInfo.InvariantCulture);
1164 if (toType == typeof(Char))
1167 _ = Char.TryParse(str, out c);
1170 if (toType == typeof(String) && str.StartsWith("{}", StringComparison.Ordinal))
1171 return str.Substring(2);
1172 if (toType == typeof(String))
1174 if (toType == typeof(Decimal))
1175 return Decimal.Parse(str, CultureInfo.InvariantCulture);
1178 //if the value is not assignable and there's an implicit conversion, convert
1179 if (value != null && !toType.IsAssignableFrom(value.GetType()))
1181 var opImplicit = GetImplicitConversionOperator(value.GetType(), value.GetType(), toType)
1182 ?? GetImplicitConversionOperator(toType, value.GetType(), toType);
1183 //var opImplicit = value.GetType().GetImplicitConversionOperator(fromType: value.GetType(), toType: toType)
1184 // ?? toType.GetImplicitConversionOperator(fromType: value.GetType(), toType: toType);
1186 if (opImplicit != null)
1188 value = opImplicit.Invoke(null, new[] { value });
1196 internal string GetTypeConverterTypeName(IEnumerable<CustomAttributeData> attributes)
1198 var converterAttribute =
1199 attributes.FirstOrDefault(cad => Tizen.NUI.Binding.TypeConverterAttribute.TypeConvertersType.Contains(cad.AttributeType.FullName));
1200 if (converterAttribute == null)
1202 if (converterAttribute.ConstructorArguments[0].ArgumentType == typeof(string))
1203 return (string)converterAttribute.ConstructorArguments[0].Value;
1204 if (converterAttribute.ConstructorArguments[0].ArgumentType == typeof(Type))
1205 return ((Type)converterAttribute.ConstructorArguments[0].Value).AssemblyQualifiedName;
1209 internal MethodInfo GetImplicitConversionOperator(Type onType, Type fromType, Type toType)
1212 var mi = onType.GetRuntimeMethod("op_Implicit", new[] { fromType });
1214 var bindingFlags = BindingFlags.Public | BindingFlags.Static | BindingFlags.FlattenHierarchy;
1215 var mi = onType.GetMethod("op_Implicit", bindingFlags, null, new[] { fromType }, null);
1217 if (mi == null) return null;
1218 if (!mi.IsSpecialName) return null;
1219 if (!mi.IsPublic) return null;
1220 if (!mi.IsStatic) return null;
1221 if (!toType.IsAssignableFrom(mi.ReturnType)) return null;
1226 internal Animation(float durationSeconds) : this(Interop.Animation.New(durationSeconds), true)
1228 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1232 internal Animation(Animation handle) : this(Interop.Animation.NewAnimation(Animation.getCPtr(handle)), true)
1234 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1237 internal Animation Assign(Animation rhs)
1239 Animation ret = new Animation(Interop.Animation.Assign(SwigCPtr, Animation.getCPtr(rhs)), false);
1240 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1244 internal void SetDuration(float seconds)
1246 Interop.Animation.SetDuration(SwigCPtr, seconds);
1247 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1250 internal float GetDuration()
1252 float ret = Interop.Animation.GetDuration(SwigCPtr);
1253 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1257 internal void SetLooping(bool looping)
1259 Interop.Animation.SetLooping(SwigCPtr, looping);
1260 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1263 internal void SetLoopCount(int count)
1265 Interop.Animation.SetLoopCount(SwigCPtr, count);
1266 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1269 internal int GetLoopCount()
1271 int ret = Interop.Animation.GetLoopCount(SwigCPtr);
1272 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1276 internal int GetCurrentLoop()
1278 int ret = Interop.Animation.GetCurrentLoop(SwigCPtr);
1279 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1283 internal bool IsLooping()
1285 bool ret = Interop.Animation.IsLooping(SwigCPtr);
1286 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1290 internal void SetEndAction(Animation.EndActions action)
1292 Interop.Animation.SetEndAction(SwigCPtr, (int)action);
1293 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1296 internal Animation.EndActions GetEndAction()
1298 Animation.EndActions ret = (Animation.EndActions)Interop.Animation.GetEndAction(SwigCPtr);
1299 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1303 internal void SetDisconnectAction(Animation.EndActions disconnectAction)
1305 Interop.Animation.SetDisconnectAction(SwigCPtr, (int)disconnectAction);
1306 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1309 internal Animation.EndActions GetDisconnectAction()
1311 Animation.EndActions ret = (Animation.EndActions)Interop.Animation.GetDisconnectAction(SwigCPtr);
1312 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1316 internal void SetDefaultAlphaFunction(AlphaFunction alpha)
1318 Interop.Animation.SetDefaultAlphaFunction(SwigCPtr, AlphaFunction.getCPtr(alpha));
1319 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1322 internal AlphaFunction GetDefaultAlphaFunction()
1324 AlphaFunction ret = new AlphaFunction(Interop.Animation.GetDefaultAlphaFunction(SwigCPtr), true);
1325 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1329 internal void SetCurrentProgress(float progress)
1331 Interop.Animation.SetCurrentProgress(SwigCPtr, progress);
1332 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1335 internal float GetCurrentProgress()
1337 float ret = Interop.Animation.GetCurrentProgress(SwigCPtr);
1338 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1342 internal void SetSpeedFactor(float factor)
1344 Interop.Animation.SetSpeedFactor(SwigCPtr, factor);
1345 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1348 internal float GetSpeedFactor()
1350 float ret = Interop.Animation.GetSpeedFactor(SwigCPtr);
1351 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1355 internal void SetPlayRange(Vector2 range)
1357 Interop.Animation.SetPlayRange(SwigCPtr, Vector2.getCPtr(range));
1358 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1361 internal Vector2 GetPlayRange()
1363 Vector2 ret = new Vector2(Interop.Animation.GetPlayRange(SwigCPtr), true);
1364 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1368 internal Animation.States GetState()
1370 Animation.States ret = (Animation.States)Interop.Animation.GetState(SwigCPtr);
1371 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1375 internal AnimationSignal FinishedSignal()
1377 AnimationSignal ret = new AnimationSignal(Interop.Animation.FinishedSignal(SwigCPtr), false);
1378 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1382 internal AnimationSignal ProgressReachedSignal()
1384 AnimationSignal ret = new AnimationSignal(Interop.Animation.ProgressReachedSignal(SwigCPtr), false);
1385 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1389 internal void AnimateBy(Property target, PropertyValue relativeValue, AlphaFunction alpha)
1393 Interop.Animation.AnimateBy(SwigCPtr, Property.getCPtr(target), PropertyValue.getCPtr(relativeValue));
1397 Interop.Animation.AnimateByAlphaFunction(SwigCPtr, Property.getCPtr(target), PropertyValue.getCPtr(relativeValue), AlphaFunction.getCPtr(alpha));
1399 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1402 internal void AnimateBy(Property target, PropertyValue relativeValue, AlphaFunction alpha, TimePeriod period)
1406 Interop.Animation.AnimateByTimePeriod(SwigCPtr, Property.getCPtr(target), PropertyValue.getCPtr(relativeValue), TimePeriod.getCPtr(period));
1410 Interop.Animation.AnimateBy(SwigCPtr, Property.getCPtr(target), PropertyValue.getCPtr(relativeValue), AlphaFunction.getCPtr(alpha), TimePeriod.getCPtr(period));
1412 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1415 internal void AnimateTo(Property target, PropertyValue destinationValue, AlphaFunction alpha)
1419 Interop.Animation.AnimateTo(SwigCPtr, Property.getCPtr(target), PropertyValue.getCPtr(destinationValue));
1423 Interop.Animation.AnimateToAlphaFunction(SwigCPtr, Property.getCPtr(target), PropertyValue.getCPtr(destinationValue), AlphaFunction.getCPtr(alpha));
1425 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1428 internal void AnimateTo(Property target, PropertyValue destinationValue, AlphaFunction alpha, TimePeriod period)
1432 Interop.Animation.AnimateToTimePeriod(SwigCPtr, Property.getCPtr(target), PropertyValue.getCPtr(destinationValue), TimePeriod.getCPtr(period));
1436 Interop.Animation.AnimateTo(SwigCPtr, Property.getCPtr(target), PropertyValue.getCPtr(destinationValue), AlphaFunction.getCPtr(alpha), TimePeriod.getCPtr(period));
1438 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1441 internal void AnimateBetween(Property target, KeyFrames keyFrames)
1443 Interop.Animation.AnimateBetween(SwigCPtr, Property.getCPtr(target), KeyFrames.getCPtr(keyFrames));
1444 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1447 internal void AnimateBetween(Property target, KeyFrames keyFrames, AlphaFunction alpha)
1449 Interop.Animation.AnimateBetweenAlphaFunction(SwigCPtr, Property.getCPtr(target), KeyFrames.getCPtr(keyFrames), AlphaFunction.getCPtr(alpha));
1450 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1453 internal void AnimateBetween(Property target, KeyFrames keyFrames, AlphaFunction alpha, Animation.Interpolation interpolation)
1457 Interop.Animation.AnimateBetween(SwigCPtr, Property.getCPtr(target), KeyFrames.getCPtr(keyFrames), (int)interpolation);
1461 Interop.Animation.AnimateBetweenAlphaFunctionInterpolation(SwigCPtr, Property.getCPtr(target), KeyFrames.getCPtr(keyFrames), AlphaFunction.getCPtr(alpha), (int)interpolation);
1463 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1466 internal void AnimateBetween(Property target, KeyFrames keyFrames, TimePeriod period)
1468 Interop.Animation.AnimateBetweenTimePeriod(SwigCPtr, Property.getCPtr(target), KeyFrames.getCPtr(keyFrames), TimePeriod.getCPtr(period));
1469 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1472 internal void AnimateBetween(Property target, KeyFrames keyFrames, AlphaFunction alpha, TimePeriod period)
1474 Interop.Animation.AnimateBetween(SwigCPtr, Property.getCPtr(target), KeyFrames.getCPtr(keyFrames), AlphaFunction.getCPtr(alpha), TimePeriod.getCPtr(period));
1475 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1478 internal void AnimateBetween(Property target, KeyFrames keyFrames, AlphaFunction alpha, TimePeriod period, Animation.Interpolation interpolation)
1482 Interop.Animation.AnimateBetweenTimePeriodInterpolation(SwigCPtr, Property.getCPtr(target), KeyFrames.getCPtr(keyFrames), TimePeriod.getCPtr(period), (int)interpolation);
1486 Interop.Animation.AnimateBetween(SwigCPtr, Property.getCPtr(target), KeyFrames.getCPtr(keyFrames), AlphaFunction.getCPtr(alpha), TimePeriod.getCPtr(period), (int)interpolation);
1488 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1491 internal void Animate(View view, Path path, Vector3 forward)
1493 Interop.Animation.Animate(SwigCPtr, View.getCPtr(view), Path.getCPtr(path), Vector3.getCPtr(forward));
1494 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1497 internal void Animate(View view, Path path, Vector3 forward, AlphaFunction alpha)
1499 Interop.Animation.AnimateAlphaFunction(SwigCPtr, View.getCPtr(view), Path.getCPtr(path), Vector3.getCPtr(forward), AlphaFunction.getCPtr(alpha));
1500 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1503 internal void Animate(View view, Path path, Vector3 forward, TimePeriod period)
1505 Interop.Animation.AnimateTimePeriod(SwigCPtr, View.getCPtr(view), Path.getCPtr(path), Vector3.getCPtr(forward), TimePeriod.getCPtr(period));
1506 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1509 internal void Animate(View view, Path path, Vector3 forward, AlphaFunction alpha, TimePeriod period)
1511 Interop.Animation.Animate(SwigCPtr, View.getCPtr(view), Path.getCPtr(path), Vector3.getCPtr(forward), AlphaFunction.getCPtr(alpha), TimePeriod.getCPtr(period));
1512 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1515 internal void Show(View view, float delaySeconds)
1517 Interop.Animation.Show(SwigCPtr, View.getCPtr(view), delaySeconds);
1518 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1521 internal void Hide(View view, float delaySeconds)
1523 Interop.Animation.Hide(SwigCPtr, View.getCPtr(view), delaySeconds);
1524 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1528 /// To make animation instance be disposed.
1530 /// <since_tizen> 3 </since_tizen>
1531 protected override void Dispose(DisposeTypes type)
1538 if (_animationFinishedEventHandler != null)
1540 AnimationSignal finishedSignal = FinishedSignal();
1541 finishedSignal?.Disconnect(_finishedCallbackOfNative);
1542 finishedSignal?.Dispose();
1543 _animationFinishedEventHandler = null;
1546 if (_animationProgressReachedEventCallback != null)
1548 AnimationSignal progressReachedSignal = ProgressReachedSignal();
1549 progressReachedSignal?.Disconnect(_animationProgressReachedEventCallback);
1550 progressReachedSignal?.Dispose();
1551 _animationProgressReachedEventCallback = null;
1557 /// This will not be public opened.
1558 [EditorBrowsable(EditorBrowsableState.Never)]
1559 protected override void ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef swigCPtr)
1561 if (swigCPtr.Handle == IntPtr.Zero || this.HasBody() == false)
1563 Tizen.Log.Fatal("NUI", $"[ERROR] Animation ReleaseSwigCPtr()! IntPtr=0x{swigCPtr.Handle:X} HasBody={this.HasBody()}");
1566 Interop.Animation.DeleteAnimation(swigCPtr);
1569 private void OnFinished(IntPtr data)
1571 if (_animationFinishedEventHandler != null)
1573 //here we send all data to user event handlers
1574 _animationFinishedEventHandler(this, null);
1578 private void OnProgressReached(IntPtr data)
1580 if (_animationProgressReachedEventHandler != null)
1582 //here we send all data to user event handlers
1583 _animationProgressReachedEventHandler(this, null);
1587 private float MilliSecondsToSeconds(int millisec)
1589 return (float)millisec / 1000.0f;
1592 private int SecondsToMilliSeconds(float sec)
1594 return (int)(sec * 1000);