/*
- * Copyright(c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright(c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
using System;
using System.ComponentModel;
using System.Runtime.InteropServices;
- using Tizen.NUI.BaseComponents;
-
- using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
- using System.Xml;
- using Tizen.NUI.Binding.Internals;
- using Tizen.NUI.Binding;
using System.Globalization;
- using Tizen.NUI.Xaml.Internals;
using System.Diagnostics.CodeAnalysis;
+ using Tizen.NUI.BaseComponents;
+
/// <summary>
/// Animation can be used to animate the properties of any number of objects, typically view.<br />
/// If the "Finished" event is connected to a member function of an object, it must be disconnected before the object is destroyed.<br />
{
private static bool? disableAnimation = null;
+ private AnimationFinishedEventCallbackType animationFinishedEventCallback;
+ private System.IntPtr finishedCallbackOfNative;
- private AnimationFinishedEventCallbackType _animationFinishedEventCallback;
- private System.IntPtr _finishedCallbackOfNative;
-
- private AnimationProgressReachedEventCallbackType _animationProgressReachedEventCallback;
+ private AnimationProgressReachedEventCallbackType animationProgressReachedEventCallback;
- private string[] _properties = null;
- private string[] _destValue = null;
- private int[] _startTime = null;
- private int[] _endTime = null;
+ private string[] properties = null;
+ private string[] destValue = null;
+ private int[] startTime = null;
+ private int[] endTime = null;
private List<string> propertyList = null;
private List<string> destValueList = null;
internal Animation(global::System.IntPtr cPtr, bool cMemoryOwn) : base(cPtr, cMemoryOwn)
{
-
- _animationFinishedEventCallback = OnFinished;
- _finishedCallbackOfNative = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate<System.Delegate>(_animationFinishedEventCallback);
+ animationFinishedEventCallback = OnFinished;
+ finishedCallbackOfNative = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate<System.Delegate>(animationFinishedEventCallback);
}
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
private delegate void AnimationProgressReachedEventCallbackType(IntPtr data);
- private event EventHandler _animationFinishedEventHandler;
+ private event EventHandler animationFinishedEventHandler;
- /**
- * @brief Event for the finished signal which can be used to subscribe or unsubscribe the event handler.
- * The finished signal is emitted when an animation's animations have finished.
- */
+ /// <summary>
+ /// Event for the finished signal which can be used to subscribe or unsubscribe the event handler.<br />
+ /// The finished signal is emitted when an animation's animations have finished.<br />
+ /// </summary>
/// <since_tizen> 3 </since_tizen>
public event EventHandler Finished
{
add
{
- if (_animationFinishedEventHandler == null && disposed == false)
+ if (animationFinishedEventHandler == null && disposed == false)
{
AnimationSignal finishedSignal = FinishedSignal();
- finishedSignal.Connect(_finishedCallbackOfNative);
+ finishedSignal.Connect(finishedCallbackOfNative);
finishedSignal.Dispose();
}
- _animationFinishedEventHandler += value;
+ animationFinishedEventHandler += value;
}
remove
{
- _animationFinishedEventHandler -= value;
+ animationFinishedEventHandler -= value;
AnimationSignal finishedSignal = FinishedSignal();
- if (_animationFinishedEventHandler == null && finishedSignal.Empty() == false)
+ if (animationFinishedEventHandler == null && finishedSignal.Empty() == false)
{
- finishedSignal.Disconnect(_finishedCallbackOfNative);
+ finishedSignal.Disconnect(finishedCallbackOfNative);
}
finishedSignal.Dispose();
}
}
- private event EventHandler _animationProgressReachedEventHandler;
+ private event EventHandler animationProgressReachedEventHandler;
- /**
- * @brief Event for the ProgressReached signal, which can be used to subscribe or unsubscribe the event handler.
- * The ProgressReached signal is emitted when the animation has reached a given progress percentage, this is set in the api SetProgressNotification.
- */
+ /// <summary>
+ /// Event for the ProgressReached signal, which can be used to subscribe or unsubscribe the event handler.<br />
+ /// The ProgressReached signal is emitted when the animation has reached a given progress percentage, this is set in the api SetProgressNotification.<br />
+ /// </summary>
+ /// <remark>
+ /// This value only be applied if animation state is Stopped.
+ /// </remark>
/// <since_tizen> 3 </since_tizen>
public event EventHandler ProgressReached
{
add
{
- if (_animationProgressReachedEventHandler == null)
+ if (animationProgressReachedEventHandler == null)
{
- _animationProgressReachedEventCallback = OnProgressReached;
+ animationProgressReachedEventCallback = OnProgressReached;
AnimationSignal progressReachedSignal = ProgressReachedSignal();
- progressReachedSignal?.Connect(_animationProgressReachedEventCallback);
+ progressReachedSignal?.Connect(animationProgressReachedEventCallback);
progressReachedSignal?.Dispose();
}
- _animationProgressReachedEventHandler += value;
+ animationProgressReachedEventHandler += value;
}
remove
{
- _animationProgressReachedEventHandler -= value;
+ animationProgressReachedEventHandler -= value;
AnimationSignal progressReachedSignal = ProgressReachedSignal();
- if (_animationProgressReachedEventHandler == null && progressReachedSignal?.Empty() == false)
+ if (animationProgressReachedEventHandler == null && progressReachedSignal?.Empty() == false)
{
- progressReachedSignal?.Disconnect(_animationProgressReachedEventCallback);
+ progressReachedSignal?.Disconnect(animationProgressReachedEventCallback);
}
progressReachedSignal.Dispose();
}
}
/// <summary>
+ /// Enumeration for what looping mode is in.
+ /// </summary>
+ /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1717:Only FlagsAttribute enums should have plural names")]
+ public enum LoopingModes
+ {
+ /// <summary>
+ /// When the animation arrives at the end in looping mode, the animation restarts from the beginning. (Default)
+ /// </summary>
+ /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ Restart,
+ /// <summary>
+ /// When the animation arrives at the end in looping mode, the animation reverses direction and runs backwards again.
+ /// </summary>
+ /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ AutoReverse
+ }
+
+ /// <summary>
/// Gets or sets the duration in milliseconds of the animation.
+ /// This duration is applied to the animations are added after the Duration is set.
/// </summary>
+ /// <example>
+ /// <code>
+ /// animation.AnimateTo(actor, "position", destination);
+ /// animation.Duration = 500; // This duration 500 is only applied to the size animation.
+ /// animation.AnimateTo(actor, "size", size);
+ /// </code>
+ /// </example>
/// <since_tizen> 3 </since_tizen>
public int Duration
{
}
/// <summary>
- /// Gets or sets the default alpha function for the animation.
+ /// Gets or sets the default alpha function for the animation.
+ /// This DefaultAlphaFunction is only applied to the animations are added after the DefaultAlphaFunction is set.
/// </summary>
+ /// <example>
+ /// <code>
+ /// animation.AnimateTo(actor, "position", destination);
+ /// animation.DefaultAlphaFunction = newAlphaFunction; // This newAlphaFunction is applied only for the size animation.
+ /// animation.AnimateTo(actor, "size", size);
+ /// </code>
+ /// </example>
/// <since_tizen> 3 </since_tizen>
public AlphaFunction DefaultAlphaFunction
{
/// <summary>
/// Gets or sets the end action of the animation.<br />
/// This action is performed when the animation ends or if it is stopped.<br />
- /// The default end action is cancel.<br />
+ /// The default end action is EndActions.Cancel.<br />
/// </summary>
+ /// <remark>
+ /// Change the action value from EndActions.Discard, or to EndActions.Discard during animation is playing / paused will not works well.
+ /// </remark>
/// <since_tizen> 3 </since_tizen>
public EndActions EndAction
{
/// <summary>
/// Gets or sets the disconnect action.<br />
/// If any of the animated property owners are disconnected from the stage while the animation is being played, then this action is performed.<br />
- /// The default action is cancel.<br />
+ /// The default action is EndActions.StopFinal.<br />
/// </summary>
/// <since_tizen> 3 </since_tizen>
public EndActions DisconnectAction
}
/// <summary>
- /// Gets or sets specificifications of a speed factor for the animation.<br />
+ /// Gets or sets specifications of a speed factor for the animation.<br />
/// The speed factor is a multiplier of the normal velocity of the animation.<br />
/// Values between [0, 1] will slow down the animation and values above one will speed up the animation.<br />
/// It is also possible to specify a negative multiplier to play the animation in reverse.<br />
/// <summary>
/// Gets or sets the progress notification marker which triggers the ProgressReachedSignal.<br />
- /// Percentage of animation progress should be greater than 0 and less than 1, for example, 0.3 for 30% <br />
+ /// Percentage of animation progress should be greater than 0 and less than 1, for example, 0.3 for 30%<br />
/// One notification can be set on each animation.
/// </summary>
+ /// <remark>
+ /// This value only be applied if animation state is Stopped.
+ /// </remark>
/// <since_tizen> 3 </since_tizen>
public float ProgressNotification
{
}
/// <summary>
+ /// Enumeration for what looping mode is in.
+ /// </summary>
+ /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public LoopingModes LoopingMode
+ {
+ set
+ {
+ Interop.Animation.SetLoopingMode(SwigCPtr, (int)value);
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ }
+ get
+ {
+ Animation.LoopingModes ret = (Animation.LoopingModes)Interop.Animation.GetLoopingMode(SwigCPtr);
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve());
+ return ret;
+ }
+ }
+
+ /// <summary>
+ /// Sets and Gets the blend point to interpolate animate property
+ ///
+ /// BlendPoint is a value between [0,1], If the value of the keyframe whose progress is 0 is different from the current value,
+ /// the property is animated as it smoothly blends until the progress reaches the blendPoint.
+ /// </summary>
+ /// <remarks>
+ /// The blend point only affects animation registered with AnimateBetween. Other animations operate the same as when Play() is called.
+ /// And the blend point needs to be set before this animation plays. If the blend point changes after playback, animation continuity cannot be guaranteed.
+ /// </remarks>
+ /// <remarks>
+ /// In the case of a looping animation, the animation is blended only in the first loop.
+ /// </remarks>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public float BlendPoint
+ {
+ set
+ {
+ Interop.Animation.SetBlendPoint(SwigCPtr, value);
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ }
+ get
+ {
+ float ret = Interop.Animation.GetBlendPoint(SwigCPtr);
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve());
+ return ret;
+ }
+ }
+
+ /// <summary>
/// Gets or sets the properties of the animation.
/// </summary>
- //ToDo : will raise deprecated-ACR, [Obsolete("Deprecated in API9, Will be removed in API11, Please use PropertyList instead")]
+ //ToDo : will raise deprecated-ACR, [Obsolete("Deprecated in API9, will be removed in API11, Use PropertyList instead")]
[SuppressMessage("Microsoft.Performance", "CA1819:PropertiesShouldNotReturnArrays", Justification = "This API will be deprecated, so suppressing the warning for now")]
public string[] Properties
{
get
{
- return _properties;
+ return properties;
}
set
{
- _properties = value;
+ properties = value;
}
}
/// <summary>
/// Gets or sets the destination value for each property of the animation.
/// </summary>
- //ToDo : will raise deprecated-ACR, [Obsolete("Deprecated in API9, Will be removed in API11, Please use DestValueList instead")]
+ //ToDo : will raise deprecated-ACR, [Obsolete("Deprecated in API9, will be removed in API11, Use DestValueList instead")]
[SuppressMessage("Microsoft.Performance", "CA1819:PropertiesShouldNotReturnArrays", Justification = "This API will be deprecated, so suppressing the warning for now")]
public string[] DestValue
{
get
{
- return _destValue;
+ return destValue;
}
set
{
- _destValue = value;
+ destValue = value;
}
}
/// <summary>
/// Gets or sets the start time for each property of the animation.
/// </summary>
- //ToDo : will raise deprecated-ACR, [Obsolete("Deprecated in API9, Will be removed in API11, Please use StartTimeList instead")]
+ //ToDo : will raise deprecated-ACR, [Obsolete("Deprecated in API9, will be removed in API11, Use StartTimeList instead")]
[SuppressMessage("Microsoft.Performance", "CA1819:PropertiesShouldNotReturnArrays", Justification = "This API will be deprecated, so suppressing the warning for now")]
public int[] StartTime
{
get
{
- return _startTime;
+ return startTime;
}
set
{
- _startTime = value;
+ startTime = value;
}
}
/// <summary>
/// Gets or sets the end time for each property of the animation.
/// </summary>
- //ToDo : will raise deprecated-ACR, [Obsolete("Deprecated in API9, Will be removed in API11, Please use EndTimeList instead")]
+ //ToDo : will raise deprecated-ACR, [Obsolete("Deprecated in API9, will be removed in API11, Use EndTimeList instead")]
[SuppressMessage("Microsoft.Performance", "CA1819:PropertiesShouldNotReturnArrays", Justification = "This API will be deprecated, so suppressing the warning for now")]
public int[] EndTime
{
get
{
- return _endTime;
+ return endTime;
}
set
{
- _endTime = value;
+ endTime = value;
}
}
/// <param name="handle">Handle to an object.</param>
/// <returns>Handle to an animation object or an uninitialized handle.</returns>
/// <exception cref="ArgumentNullException"> Thrown when handle is null. </exception>
- /// <since_tizen> 3 </since_tizen>
- [Obsolete("Deprecated in API6, Will be removed in API9, Please use as keyword instead!")]
- [EditorBrowsable(EditorBrowsableState.Never)]
- public static Animation DownCast(BaseHandle handle)
+ internal static Animation DownCast(BaseHandle handle)
{
if (handle == null)
{
}
/// <summary>
- /// Stops the animation.
+ /// Stops the animation. It will change this animation's EndAction property.
/// </summary>
+ /// <remarks>
+ /// Change the value from EndActions.Discard, or to EndActions.Discard during animation is playing / paused will not works well.<br/>
+ /// If you want to stop by EndActions.Discard, EndAction property also should be EndActions.Discard before Play API called. <br/>
+ /// <br/>
+ /// This method is deprecated since API11 because EndActions property concept is not matched with Stop(). <br/>
+ /// Use <see cref="EndAction"/> property instead.
+ /// </remarks>
/// <param name="action">The end action can be set.</param>
/// <since_tizen> 3 </since_tizen>
- public void Stop(EndActions action = EndActions.Cancel)
+ [Obsolete("Deprecated in API11, will be removed in API13. Use EndAction property instead.")]
+ public void Stop(EndActions action)
{
SetEndAction(action);
Interop.Animation.Stop(SwigCPtr);
/// <summary>
/// Animates a property value by a relative amount.<br />
/// </summary>
- /// <param name="target">The target object to animate.</param>
+ /// <param name="target">The target animatable object to animate.</param>
/// <param name="property">The target property to animate.</param>
/// <param name="relativeValue">The property value will change by this amount.</param>
/// <param name="alphaFunction">The alpha function to apply.</param>
- /// <exception cref="ArgumentNullException"> Thrown when target or relativeValue is null. </exception>
- /// <since_tizen> 3 </since_tizen>
- public void AnimateBy(View target, string property, object relativeValue, AlphaFunction alphaFunction = null)
+ /// <exception cref="ArgumentNullException"> Thrown when target or property or relativeValue is null. </exception>
+ /// <exception cref="ArgumentException"> Thrown when it failed to find a property from given string or the given relativeValue is invalid format. </exception>
+ /// This will not be public opened.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public void AnimateBy(Animatable target, string property, object relativeValue, AlphaFunction alphaFunction = null)
{
if (target == null)
{
throw new ArgumentNullException(nameof(target));
}
- else if (relativeValue == null)
+ if (property == null)
+ {
+ throw new ArgumentNullException(nameof(property));
+ }
+ if (relativeValue == null)
{
throw new ArgumentNullException(nameof(relativeValue));
}
- Property _prop = PropertyHelper.GetPropertyFromString(target, property);
- relativeValue = AvoidFloatPropertyHasIntegerValue(target, _prop, relativeValue);
- PropertyValue val = PropertyValue.CreateFromObject(relativeValue);
+ using (var result = PropertyHelper.Search(target, property))
+ {
+ if (result == null)
+ {
+ throw new ArgumentException("string property is invalid");
+ }
+
+ var current = result;
+ while (current != null)
+ {
+
+ var targetValueIntPtr = current.RefineValueIntPtr(relativeValue);
+ if (targetValueIntPtr == global::System.IntPtr.Zero)
+ {
+ throw new ArgumentException("Invalid " + nameof(relativeValue));
+ }
+ AnimateByIntPtr(current.Property, targetValueIntPtr, alphaFunction);
+ Interop.PropertyValue.DeletePropertyValueIntPtr(targetValueIntPtr);
+ current = current.NextResult;
+ }
+ }
+ }
- if (alphaFunction != null)
+ /// <summary>
+ /// Animates a property value by a relative amount.<br />
+ /// </summary>
+ /// <param name="target">The target animatable object to animate.</param>
+ /// <param name="property">The target property to animate.</param>
+ /// <param name="relativeValue">The property value will change by this amount.</param>
+ /// <param name="startTime">The start time of the animation.</param>
+ /// <param name="endTime">The end time of the animation.</param>
+ /// <param name="alphaFunction">The alpha function to apply.</param>
+ /// <exception cref="ArgumentNullException"> Thrown when target or property or relativeValue is null. </exception>
+ /// <exception cref="ArgumentException"> Thrown when it failed to find a property from given string or the given relativeValue is invalid format. </exception>
+ /// This will not be public opened.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public void AnimateBy(Animatable target, string property, object relativeValue, int startTime, int endTime, AlphaFunction alphaFunction = null)
+ {
+ if (target == null)
{
- AnimateBy(_prop, val, alphaFunction);
+ throw new ArgumentNullException(nameof(target));
}
- else
+ if (property == null)
{
- AnimateBy(_prop, val);
+ throw new ArgumentNullException(nameof(property));
}
+ if (relativeValue == null)
+ {
+ throw new ArgumentNullException(nameof(relativeValue));
+ }
+
+ using (var result = PropertyHelper.Search(target, property))
+ {
+ if (result == null)
+ {
+ throw new ArgumentException("string property is invalid");
+ }
- val.Dispose();
- _prop.Dispose();
+ var current = result;
+ using (var time = new TimePeriod(startTime, endTime - startTime))
+ while (current != null)
+ {
+
+ var targetValueIntPtr = current.RefineValueIntPtr(relativeValue);
+ if (targetValueIntPtr == global::System.IntPtr.Zero)
+ {
+ throw new ArgumentException("Invalid " + nameof(relativeValue));
+ }
+ AnimateByIntPtr(current.Property, targetValueIntPtr, alphaFunction, time);
+ Interop.PropertyValue.DeletePropertyValueIntPtr(targetValueIntPtr);
+ current = current.NextResult;
+ }
+ }
+ }
+
+ /// <summary>
+ /// Animates a property value by a relative amount.<br />
+ /// </summary>
+ /// <param name="target">The target object to animate.</param>
+ /// <param name="property">The target property to animate.</param>
+ /// <param name="relativeValue">The property value will change by this amount.</param>
+ /// <param name="alphaFunction">The alpha function to apply.</param>
+ /// <exception cref="ArgumentNullException"> Thrown when target or property or relativeValue is null. </exception>
+ /// <exception cref="ArgumentException"> Thrown when it failed to find a property from given string or the given relativeValue is invalid format. </exception>
+ /// <since_tizen> 3 </since_tizen>
+ public void AnimateBy(View target, string property, object relativeValue, AlphaFunction alphaFunction = null)
+ {
+ AnimateBy(target as Animatable, property, relativeValue, alphaFunction);
}
/// <summary>
/// <param name="startTime">The start time of the animation.</param>
/// <param name="endTime">The end time of the animation.</param>
/// <param name="alphaFunction">The alpha function to apply.</param>
- /// <exception cref="ArgumentNullException"> Thrown when target or relativeValue is null. </exception>
+ /// <exception cref="ArgumentNullException"> Thrown when target or property or relativeValue is null. </exception>
+ /// <exception cref="ArgumentException"> Thrown when it failed to find a property from given string or the given relativeValue is invalid format. </exception>
/// <since_tizen> 3 </since_tizen>
public void AnimateBy(View target, string property, object relativeValue, int startTime, int endTime, AlphaFunction alphaFunction = null)
{
+ AnimateBy(target as Animatable, property, relativeValue, startTime, endTime, alphaFunction);
+ }
+
+ /// <summary>
+ /// Animates a property to a destination value.<br />
+ /// </summary>
+ /// <param name="target">The target animatable object to animate.</param>
+ /// <param name="property">The target property to animate.</param>
+ /// <param name="destinationValue">The destination value.</param>
+ /// <param name="alphaFunction">The alpha function to apply.</param>
+ /// <exception cref="ArgumentNullException"> Thrown when target or property or destinationValue is null. </exception>
+ /// <exception cref="ArgumentException"> Thrown when it failed to find a property from given string or the given destinationValue is invalid format. </exception>
+ /// This will not be public opened.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public void AnimateTo(Animatable target, string property, object destinationValue, AlphaFunction alphaFunction = null)
+ {
if (target == null)
{
throw new ArgumentNullException(nameof(target));
}
- else if (relativeValue == null)
+ if (property == null)
{
- throw new ArgumentNullException(nameof(relativeValue));
+ throw new ArgumentNullException(nameof(property));
}
-
- Property _prop = PropertyHelper.GetPropertyFromString(target, property);
- relativeValue = AvoidFloatPropertyHasIntegerValue(target, _prop, relativeValue);
- PropertyValue val = PropertyValue.CreateFromObject(relativeValue);
-
- if (alphaFunction != null)
+ if (destinationValue == null)
{
- Tizen.NUI.TimePeriod time = new Tizen.NUI.TimePeriod(MilliSecondsToSeconds(startTime), MilliSecondsToSeconds(endTime - startTime));
- AnimateBy(_prop, val, alphaFunction, time);
- time.Dispose();
+ throw new ArgumentNullException(nameof(destinationValue));
}
- else
+
+ using (var result = PropertyHelper.Search(target, property))
{
- Tizen.NUI.TimePeriod time = new Tizen.NUI.TimePeriod(MilliSecondsToSeconds(startTime), MilliSecondsToSeconds(endTime - startTime));
- AnimateBy(_prop, val, time);
- time.Dispose();
- }
+ if (result == null)
+ {
+ throw new ArgumentException("string property is invalid");
+ }
- val.Dispose();
- _prop.Dispose();
+ var current = result;
+ while (current != null)
+ {
+
+ var targetValueIntPtr = current.RefineValueIntPtr(destinationValue);
+ if (targetValueIntPtr == global::System.IntPtr.Zero)
+ {
+ throw new ArgumentException("Invalid " + nameof(destinationValue));
+ }
+ AnimateToIntPtr(current.Property, targetValueIntPtr, alphaFunction);
+ Interop.PropertyValue.DeletePropertyValueIntPtr(targetValueIntPtr);
+ current = current.NextResult;
+ }
+ }
}
/// <summary>
/// Animates a property to a destination value.<br />
/// </summary>
- /// <param name="target">The target object to animate.</param>
+ /// <param name="target">The target animatable object to animate.</param>
/// <param name="property">The target property to animate.</param>
/// <param name="destinationValue">The destination value.</param>
+ /// <param name="startTime">The start time of the animation.</param>
+ /// <param name="endTime">The end time of the animation.</param>
/// <param name="alphaFunction">The alpha function to apply.</param>
- /// <exception cref="ArgumentNullException"> Thrown when target or destinationValue is null. </exception>
- /// <since_tizen> 3 </since_tizen>
- public void AnimateTo(View target, string property, object destinationValue, AlphaFunction alphaFunction = null)
+ /// <exception cref="ArgumentNullException"> Thrown when target or property or destinationValue is null. </exception>
+ /// <exception cref="ArgumentException"> Thrown when it failed to find a property from given string or the given destinationValue is invalid format. </exception>
+ /// This will not be public opened.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public void AnimateTo(Animatable target, string property, object destinationValue, int startTime, int endTime, AlphaFunction alphaFunction = null)
{
if (target == null)
{
throw new ArgumentNullException(nameof(target));
}
- else if (destinationValue == null)
+ if (property == null)
{
- throw new ArgumentNullException(nameof(destinationValue));
+ throw new ArgumentNullException(nameof(property));
}
-
- Property _prop = PropertyHelper.GetPropertyFromString(target, property);
- destinationValue = AvoidFloatPropertyHasIntegerValue(target, _prop, destinationValue);
- PropertyValue val = PropertyValue.CreateFromObject(destinationValue);
-
- if (alphaFunction != null)
+ if (destinationValue == null)
{
- AnimateTo(_prop, val, alphaFunction);
+ throw new ArgumentNullException(nameof(destinationValue));
}
- else
+
+ using (var result = PropertyHelper.Search(target, property))
{
- AnimateTo(_prop, val);
+ if (result == null)
+ {
+ throw new ArgumentException("string property is invalid");
+ }
+
+ var current = result;
+ using (var time = new TimePeriod(startTime, endTime - startTime))
+ while (current != null)
+ {
+#if NUI_ANIMATION_PROPERTY_CHANGE_1
+ var targetValueIntPtr = current.RefineValueIntPtr(destinationValue);
+ if (targetValueIntPtr == global::System.IntPtr.Zero)
+ {
+ throw new ArgumentException("Invalid " + nameof(destinationValue));
+ }
+ AnimateToIntPtr(current.Property, targetValueIntPtr, alphaFunction, time);
+ Interop.PropertyValue.DeletePropertyValueIntPtr(targetValueIntPtr);
+#else
+ var targetValue = current.RefineValue(destinationValue) ?? throw new ArgumentException("Invalid " + nameof(destinationValue));
+ AnimateTo(current.Property, targetValue, alphaFunction, time);
+ targetValue.Dispose();
+#endif
+ current = current.NextResult;
+ }
}
+ }
- val.Dispose();
- _prop.Dispose();
+ /// <summary>
+ /// Animates a property to a destination value.<br />
+ /// </summary>
+ /// <param name="target">The target object to animate.</param>
+ /// <param name="property">The target property to animate.</param>
+ /// <param name="destinationValue">The destination value.</param>
+ /// <param name="alphaFunction">The alpha function to apply.</param>
+ /// <exception cref="ArgumentNullException"> Thrown when target or property or destinationValue is null. </exception>
+ /// <exception cref="ArgumentException"> Thrown when it failed to find a property from given string or the given destinationValue is invalid format. </exception>
+ /// <since_tizen> 3 </since_tizen>
+ public void AnimateTo(View target, string property, object destinationValue, AlphaFunction alphaFunction = null)
+ {
+ AnimateTo(target as Animatable, property, destinationValue, alphaFunction);
+ }
+
+ /// <summary>
+ /// Animates a property to a destination value.<br />
+ /// </summary>
+ /// <param name="target">The target object to animate.</param>
+ /// <param name="property">The target property to animate.</param>
+ /// <param name="destinationValue">The destination value.</param>
+ /// <param name="startTime">The start time of the animation.</param>
+ /// <param name="endTime">The end time of the animation.</param>
+ /// <param name="alphaFunction">The alpha function to apply.</param>
+ /// <exception cref="ArgumentNullException"> Thrown when target or property or destinationValue is null. </exception>
+ /// <exception cref="ArgumentException"> Thrown when it failed to find a property from given string or the given destinationValue is invalid format. </exception>
+ /// <since_tizen> 3 </since_tizen>
+ public void AnimateTo(View target, string property, object destinationValue, int startTime, int endTime, AlphaFunction alphaFunction = null)
+ {
+ AnimateTo(target as Animatable, property, destinationValue, startTime, endTime, alphaFunction);
}
/// <summary>
}
else
{
- if (_properties.Length == _destValue.Length && _startTime.Length == _endTime.Length && _properties.Length == _startTime.Length)
+ if (properties.Length == destValue.Length && startTime.Length == endTime.Length && properties.Length == startTime.Length)
{
- int length = _properties.Length;
+ int length = properties.Length;
for (int index = 0; index < length; index++)
{
//object destinationValue = _destValue[index];
var elementType = target.GetType();
- PropertyInfo propertyInfo = elementType.GetProperties().FirstOrDefault(fi => fi.Name == _properties[index]);
+ PropertyInfo propertyInfo = elementType.GetProperties().FirstOrDefault(fi => fi.Name == properties[index]);
//var propertyInfo = elementType.GetRuntimeProperties().FirstOrDefault(p => p.Name == localName);
if (propertyInfo != null)
{
- object destinationValue = ConvertTo(_destValue[index], propertyInfo.PropertyType);
+ object destinationValue = ConvertTo(destValue[index], propertyInfo.PropertyType);
if (destinationValue != null)
{
- AnimateTo(target, _properties[index], destinationValue, _startTime[index], _endTime[index]);
+ AnimateTo(target, properties[index], destinationValue, startTime[index], endTime[index]);
}
}
}
}
/// <summary>
- /// Animates a property to a destination value.<br />
+ /// Animates a property between keyframes.
/// </summary>
- /// <param name="target">The target object to animate.</param>
+ /// <param name="target">The target animatable object to animate.</param>
/// <param name="property">The target property to animate.</param>
- /// <param name="destinationValue">The destination value.</param>
- /// <param name="startTime">The start time of the animation.</param>
- /// <param name="endTime">The end time of the animation.</param>
+ /// <param name="keyFrames">The set of time or value pairs between which to animate.</param>
+ /// <param name="interpolation">The method used to interpolate between values.</param>
/// <param name="alphaFunction">The alpha function to apply.</param>
- /// <exception cref="ArgumentNullException"> Thrown when target or destinationValue is null. </exception>
- /// <since_tizen> 3 </since_tizen>
- public void AnimateTo(View target, string property, object destinationValue, int startTime, int endTime, AlphaFunction alphaFunction = null)
+ /// <exception cref="ArgumentNullException"> Thrown when target or property or keyFrames is null. </exception>
+ /// <exception cref="ArgumentException"> Thrown when it failed to find a property from given string or the given keyFrames has invalid value. </exception>
+ /// This will not be public opened.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public void AnimateBetween(Animatable target, string property, KeyFrames keyFrames, Interpolation interpolation = Interpolation.Linear, AlphaFunction alphaFunction = null)
{
if (target == null)
{
throw new ArgumentNullException(nameof(target));
}
- else if (destinationValue == null)
+ if (property == null)
{
- throw new ArgumentNullException(nameof(destinationValue));
+ throw new ArgumentNullException(nameof(property));
}
+ if (keyFrames == null)
+ {
+ throw new ArgumentNullException(nameof(keyFrames));
+ }
+
+ using (var result = PropertyHelper.Search(target, property))
+ {
+ if (result == null)
+ {
+ throw new ArgumentException("string property is invalid");
+ }
- Property _prop = PropertyHelper.GetPropertyFromString(target, property);
- destinationValue = AvoidFloatPropertyHasIntegerValue(target, _prop, destinationValue);
- PropertyValue val = PropertyValue.CreateFromObject(destinationValue);
+ var current = result;
+ while (current != null)
+ {
+ // NOTE Do not dispose keyFrames object returned by GetRefinedKeyFrames() here.
+ AnimateBetween(current.Property, current.RefineKeyFrames(keyFrames) ?? throw new ArgumentException("Invalid " + nameof(keyFrames)), alphaFunction, interpolation);
+ current = current.NextResult;
+ }
+ }
+ }
- if (alphaFunction != null)
+ /// <summary>
+ /// Animates a property between keyframes.
+ /// </summary>
+ /// <param name="target">The target animatable object to animate</param>
+ /// <param name="property">The target property to animate</param>
+ /// <param name="keyFrames">The set of time/value pairs between which to animate</param>
+ /// <param name="startTime">The start time of animation in milliseconds.</param>
+ /// <param name="endTime">The end time of animation in milliseconds.</param>
+ /// <param name="interpolation">The method used to interpolate between values.</param>
+ /// <param name="alphaFunction">The alpha function to apply.</param>
+ /// <exception cref="ArgumentNullException"> Thrown when target or property or keyFrames is null. </exception>
+ /// <exception cref="ArgumentException"> Thrown when it failed to find a property from given string or the given keyFrames has invalid value. </exception>
+ /// This will not be public opened.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public void AnimateBetween(Animatable target, string property, KeyFrames keyFrames, int startTime, int endTime, Interpolation interpolation = Interpolation.Linear, AlphaFunction alphaFunction = null)
+ {
+ if (target == null)
+ {
+ throw new ArgumentNullException(nameof(target));
+ }
+ if (property == null)
{
- Tizen.NUI.TimePeriod time = new Tizen.NUI.TimePeriod(MilliSecondsToSeconds(startTime), MilliSecondsToSeconds(endTime - startTime));
- AnimateTo(_prop, val, alphaFunction, time);
- time.Dispose();
+ throw new ArgumentNullException(nameof(property));
}
- else
+ if (keyFrames == null)
{
- Tizen.NUI.TimePeriod time = new Tizen.NUI.TimePeriod(MilliSecondsToSeconds(startTime), MilliSecondsToSeconds(endTime - startTime));
- AnimateTo(_prop, val, time);
- time.Dispose();
+ throw new ArgumentNullException(nameof(keyFrames));
}
- val.Dispose();
- _prop.Dispose();
+ using (var result = PropertyHelper.Search(target, property))
+ {
+ if (result == null)
+ {
+ throw new ArgumentException("string property is invalid");
+ }
+
+ var current = result;
+ using (var time = new TimePeriod(startTime, endTime - startTime))
+ while (current != null)
+ {
+ // NOTE Do not dispose keyFrames object returned by GetRefinedKeyFrames() here.
+ AnimateBetween(current.Property, current.RefineKeyFrames(keyFrames) ?? throw new ArgumentException("Invalid " + nameof(keyFrames)), alphaFunction, time, interpolation);
+ current = current.NextResult;
+ }
+ }
}
/// <summary>
/// <param name="keyFrames">The set of time or value pairs between which to animate.</param>
/// <param name="interpolation">The method used to interpolate between values.</param>
/// <param name="alphaFunction">The alpha function to apply.</param>
+ /// <exception cref="ArgumentNullException"> Thrown when target or property or keyFrames is null. </exception>
+ /// <exception cref="ArgumentException"> Thrown when it failed to find a property from given string or the given keyFrames has invalid value. </exception>
/// <since_tizen> 3 </since_tizen>
public void AnimateBetween(View target, string property, KeyFrames keyFrames, Interpolation interpolation = Interpolation.Linear, AlphaFunction alphaFunction = null)
{
- Property _prop = PropertyHelper.GetPropertyFromString(target, property);
-
- if (_prop.propertyIndex == Property.InvalidIndex)
- {
- throw new System.ArgumentException("second argument string property is invalid parameter!");
- }
-
- if (alphaFunction != null)
- {
- AnimateBetween(_prop, keyFrames, alphaFunction, interpolation);
- }
- else
- {
- AnimateBetween(_prop, keyFrames, interpolation);
- }
-
- _prop.Dispose();
+ AnimateBetween(target as Animatable, property, keyFrames, interpolation, alphaFunction);
}
/// <summary>
/// <param name="endTime">The end time of animation in milliseconds.</param>
/// <param name="interpolation">The method used to interpolate between values.</param>
/// <param name="alphaFunction">The alpha function to apply.</param>
+ /// <exception cref="ArgumentNullException"> Thrown when target or property or keyFrames is null. </exception>
+ /// <exception cref="ArgumentException"> Thrown when it failed to find a property from given string or the given keyFrames has invalid value. </exception>
/// <since_tizen> 3 </since_tizen>
public void AnimateBetween(View target, string property, KeyFrames keyFrames, int startTime, int endTime, Interpolation interpolation = Interpolation.Linear, AlphaFunction alphaFunction = null)
{
- Property _prop = PropertyHelper.GetPropertyFromString(target, property);
-
- Tizen.NUI.TimePeriod time = new Tizen.NUI.TimePeriod(MilliSecondsToSeconds(startTime), MilliSecondsToSeconds(endTime - startTime));
- if (alphaFunction != null)
- {
- AnimateBetween(_prop, keyFrames, alphaFunction, time, interpolation);
- }
- else
- {
- AnimateBetween(_prop, keyFrames, time, interpolation);
- }
-
- time.Dispose();
- _prop.Dispose();
+ AnimateBetween(target as Animatable, property, keyFrames, startTime, endTime, interpolation, alphaFunction);
}
/// <summary>
/// <since_tizen> 3 </since_tizen>
public void AnimatePath(View view, Path path, Vector3 forward, int startTime, int endTime, AlphaFunction alphaFunction = null)
{
- TimePeriod time = new TimePeriod(MilliSecondsToSeconds(startTime), MilliSecondsToSeconds(endTime - startTime));
+ TimePeriod time = new TimePeriod(startTime, endTime - startTime);
if (alphaFunction == null)
{
Animate(view, path, forward, time);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
- internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Animation obj)
- {
- return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.SwigCPtr;
- }
-
internal object ConvertTo(object value, Type toType)
{
Func<object> getConverter = () =>
return ret;
}
- internal void AnimateBy(Property target, PropertyValue relativeValue)
+ internal void AnimateBy(Property target, PropertyValue relativeValue, AlphaFunction alpha)
{
- Interop.Animation.AnimateBy(SwigCPtr, Property.getCPtr(target), PropertyValue.getCPtr(relativeValue));
+ if (alpha == null)
+ {
+ Interop.Animation.AnimateBy(SwigCPtr, Property.getCPtr(target), PropertyValue.getCPtr(relativeValue));
+ }
+ else
+ {
+ Interop.Animation.AnimateByAlphaFunction(SwigCPtr, Property.getCPtr(target), PropertyValue.getCPtr(relativeValue), AlphaFunction.getCPtr(alpha));
+ }
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
- internal void AnimateBy(Property target, PropertyValue relativeValue, AlphaFunction alpha)
+ internal void AnimateBy(Property target, PropertyValue relativeValue, AlphaFunction alpha, TimePeriod period)
{
- Interop.Animation.AnimateByAlphaFunction(SwigCPtr, Property.getCPtr(target), PropertyValue.getCPtr(relativeValue), AlphaFunction.getCPtr(alpha));
+ if (alpha == null)
+ {
+ Interop.Animation.AnimateByTimePeriod(SwigCPtr, Property.getCPtr(target), PropertyValue.getCPtr(relativeValue), TimePeriod.getCPtr(period));
+ }
+ else
+ {
+ Interop.Animation.AnimateBy(SwigCPtr, Property.getCPtr(target), PropertyValue.getCPtr(relativeValue), AlphaFunction.getCPtr(alpha), TimePeriod.getCPtr(period));
+ }
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
- internal void AnimateBy(Property target, PropertyValue relativeValue, TimePeriod period)
+ internal void AnimateTo(Property target, PropertyValue destinationValue, AlphaFunction alpha)
{
- Interop.Animation.AnimateByTimePeriod(SwigCPtr, Property.getCPtr(target), PropertyValue.getCPtr(relativeValue), TimePeriod.getCPtr(period));
+ if (alpha == null)
+ {
+ Interop.Animation.AnimateTo(SwigCPtr, Property.getCPtr(target), PropertyValue.getCPtr(destinationValue));
+ }
+ else
+ {
+ Interop.Animation.AnimateToAlphaFunction(SwigCPtr, Property.getCPtr(target), PropertyValue.getCPtr(destinationValue), AlphaFunction.getCPtr(alpha));
+ }
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
- internal void AnimateBy(Property target, PropertyValue relativeValue, AlphaFunction alpha, TimePeriod period)
+ internal void AnimateTo(Property target, PropertyValue destinationValue, AlphaFunction alpha, TimePeriod period)
{
- Interop.Animation.AnimateBy(SwigCPtr, Property.getCPtr(target), PropertyValue.getCPtr(relativeValue), AlphaFunction.getCPtr(alpha), TimePeriod.getCPtr(period));
+ if (alpha == null)
+ {
+ Interop.Animation.AnimateToTimePeriod(SwigCPtr, Property.getCPtr(target), PropertyValue.getCPtr(destinationValue), TimePeriod.getCPtr(period));
+ }
+ else
+ {
+ Interop.Animation.AnimateTo(SwigCPtr, Property.getCPtr(target), PropertyValue.getCPtr(destinationValue), AlphaFunction.getCPtr(alpha), TimePeriod.getCPtr(period));
+ }
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
- internal void AnimateTo(Property target, PropertyValue destinationValue)
+
+ internal void AnimateByIntPtr(Property target, global::System.IntPtr relativeValueIntPtr, AlphaFunction alpha)
{
- Interop.Animation.AnimateTo(SwigCPtr, Property.getCPtr(target), PropertyValue.getCPtr(destinationValue));
+ if (alpha == null)
+ {
+ Interop.Animation.AnimateBy(SwigCPtr, Property.getCPtr(target), relativeValueIntPtr);
+ }
+ else
+ {
+ Interop.Animation.AnimateByAlphaFunction(SwigCPtr, Property.getCPtr(target), relativeValueIntPtr, AlphaFunction.getCPtr(alpha));
+ }
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
- internal void AnimateTo(Property target, PropertyValue destinationValue, AlphaFunction alpha)
+ internal void AnimateByIntPtr(Property target, global::System.IntPtr relativeValueIntPtr, AlphaFunction alpha, TimePeriod period)
{
- Interop.Animation.AnimateToAlphaFunction(SwigCPtr, Property.getCPtr(target), PropertyValue.getCPtr(destinationValue), AlphaFunction.getCPtr(alpha));
+ if (alpha == null)
+ {
+ Interop.Animation.AnimateByTimePeriod(SwigCPtr, Property.getCPtr(target), relativeValueIntPtr, TimePeriod.getCPtr(period));
+ }
+ else
+ {
+ Interop.Animation.AnimateBy(SwigCPtr, Property.getCPtr(target), relativeValueIntPtr, AlphaFunction.getCPtr(alpha), TimePeriod.getCPtr(period));
+ }
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
- internal void AnimateTo(Property target, PropertyValue destinationValue, TimePeriod period)
+ internal void AnimateToIntPtr(Property target, global::System.IntPtr destinationValueIntPtr, AlphaFunction alpha)
{
- Interop.Animation.AnimateToTimePeriod(SwigCPtr, Property.getCPtr(target), PropertyValue.getCPtr(destinationValue), TimePeriod.getCPtr(period));
+ if (alpha == null)
+ {
+ Interop.Animation.AnimateTo(SwigCPtr, Property.getCPtr(target), destinationValueIntPtr);
+ }
+ else
+ {
+ Interop.Animation.AnimateToAlphaFunction(SwigCPtr, Property.getCPtr(target), destinationValueIntPtr, AlphaFunction.getCPtr(alpha));
+ }
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
- internal void AnimateTo(Property target, PropertyValue destinationValue, AlphaFunction alpha, TimePeriod period)
+ internal void AnimateToIntPtr(Property target, global::System.IntPtr destinationValueIntPtr, AlphaFunction alpha, TimePeriod period)
{
- Interop.Animation.AnimateTo(SwigCPtr, Property.getCPtr(target), PropertyValue.getCPtr(destinationValue), AlphaFunction.getCPtr(alpha), TimePeriod.getCPtr(period));
+ if (alpha == null)
+ {
+ Interop.Animation.AnimateToTimePeriod(SwigCPtr, Property.getCPtr(target), destinationValueIntPtr, TimePeriod.getCPtr(period));
+ }
+ else
+ {
+ Interop.Animation.AnimateTo(SwigCPtr, Property.getCPtr(target), destinationValueIntPtr, AlphaFunction.getCPtr(alpha), TimePeriod.getCPtr(period));
+ }
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
- internal void AnimateBetween(Property target, KeyFrames keyFrames, Animation.Interpolation interpolation)
- {
- Interop.Animation.AnimateBetween(SwigCPtr, Property.getCPtr(target), KeyFrames.getCPtr(keyFrames), (int)interpolation);
- if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
- }
-
internal void AnimateBetween(Property target, KeyFrames keyFrames, AlphaFunction alpha)
{
Interop.Animation.AnimateBetweenAlphaFunction(SwigCPtr, Property.getCPtr(target), KeyFrames.getCPtr(keyFrames), AlphaFunction.getCPtr(alpha));
internal void AnimateBetween(Property target, KeyFrames keyFrames, AlphaFunction alpha, Animation.Interpolation interpolation)
{
- Interop.Animation.AnimateBetweenAlphaFunctionInterpolation(SwigCPtr, Property.getCPtr(target), KeyFrames.getCPtr(keyFrames), AlphaFunction.getCPtr(alpha), (int)interpolation);
+ if (alpha == null)
+ {
+ Interop.Animation.AnimateBetween(SwigCPtr, Property.getCPtr(target), KeyFrames.getCPtr(keyFrames), (int)interpolation);
+ }
+ else
+ {
+ Interop.Animation.AnimateBetweenAlphaFunctionInterpolation(SwigCPtr, Property.getCPtr(target), KeyFrames.getCPtr(keyFrames), AlphaFunction.getCPtr(alpha), (int)interpolation);
+ }
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
- internal void AnimateBetween(Property target, KeyFrames keyFrames, TimePeriod period, Animation.Interpolation interpolation)
- {
- Interop.Animation.AnimateBetweenTimePeriodInterpolation(SwigCPtr, Property.getCPtr(target), KeyFrames.getCPtr(keyFrames), TimePeriod.getCPtr(period), (int)interpolation);
- if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
- }
-
internal void AnimateBetween(Property target, KeyFrames keyFrames, AlphaFunction alpha, TimePeriod period)
{
Interop.Animation.AnimateBetween(SwigCPtr, Property.getCPtr(target), KeyFrames.getCPtr(keyFrames), AlphaFunction.getCPtr(alpha), TimePeriod.getCPtr(period));
internal void AnimateBetween(Property target, KeyFrames keyFrames, AlphaFunction alpha, TimePeriod period, Animation.Interpolation interpolation)
{
- Interop.Animation.AnimateBetween(SwigCPtr, Property.getCPtr(target), KeyFrames.getCPtr(keyFrames), AlphaFunction.getCPtr(alpha), TimePeriod.getCPtr(period), (int)interpolation);
+ if (alpha == null)
+ {
+ Interop.Animation.AnimateBetweenTimePeriodInterpolation(SwigCPtr, Property.getCPtr(target), KeyFrames.getCPtr(keyFrames), TimePeriod.getCPtr(period), (int)interpolation);
+ }
+ else
+ {
+ Interop.Animation.AnimateBetween(SwigCPtr, Property.getCPtr(target), KeyFrames.getCPtr(keyFrames), AlphaFunction.getCPtr(alpha), TimePeriod.getCPtr(period), (int)interpolation);
+ }
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
return;
}
- if (_animationFinishedEventHandler != null)
+ if (animationFinishedEventHandler != null)
{
AnimationSignal finishedSignal = FinishedSignal();
- finishedSignal?.Disconnect(_finishedCallbackOfNative);
+ finishedSignal?.Disconnect(finishedCallbackOfNative);
finishedSignal?.Dispose();
- _animationFinishedEventHandler = null;
+ animationFinishedEventHandler = null;
}
- if (_animationProgressReachedEventCallback != null)
+ if (animationProgressReachedEventCallback != null)
{
AnimationSignal progressReachedSignal = ProgressReachedSignal();
- progressReachedSignal?.Disconnect(_animationProgressReachedEventCallback);
+ progressReachedSignal?.Disconnect(animationProgressReachedEventCallback);
progressReachedSignal?.Dispose();
- _animationProgressReachedEventCallback = null;
+ animationProgressReachedEventCallback = null;
}
base.Dispose(type);
[EditorBrowsable(EditorBrowsableState.Never)]
protected override void ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef swigCPtr)
{
- if (swigCPtr.Handle == IntPtr.Zero || this.HasBody() == false)
+ if (swigCPtr.Handle == IntPtr.Zero || Disposed)
{
- Tizen.Log.Fatal("NUI", $"[ERROR] Animation ReleaseSwigCPtr()! IntPtr=0x{swigCPtr.Handle:X} HasBody={this.HasBody()}");
+ Tizen.Log.Fatal("NUI", $"[ERROR] Animation ReleaseSwigCPtr()! IntPtr=0x{swigCPtr.Handle:X} Disposed={Disposed}");
return;
}
Interop.Animation.DeleteAnimation(swigCPtr);
private void OnFinished(IntPtr data)
{
- if (_animationFinishedEventHandler != null)
+ if (animationFinishedEventHandler != null)
{
//here we send all data to user event handlers
- _animationFinishedEventHandler(this, null);
+ animationFinishedEventHandler(this, null);
}
}
private void OnProgressReached(IntPtr data)
{
- if (_animationProgressReachedEventHandler != null)
+ if (animationProgressReachedEventHandler != null)
{
//here we send all data to user event handlers
- _animationProgressReachedEventHandler(this, null);
+ animationProgressReachedEventHandler(this, null);
}
}
{
return (int)(sec * 1000);
}
-
- private object AvoidFloatPropertyHasIntegerValue(View target, Property property, object value)
- {
- PropertyType propertyType = target.GetPropertyType(property.propertyIndex);
- if (propertyType.Equals(PropertyType.Float))
- {
- System.Type type = value.GetType();
- if (type.Equals(typeof(System.Int32)) || type.Equals(typeof(int)))
- {
- int num = (int)value;
- value = (float)num;
- }
- }
- return value;
- }
}
}