X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=src%2FTizen.NUI%2Fsrc%2Fpublic%2FAnimation.cs;h=682f2b43de2659f1caf1c9ec2a0bdb9e3b21fba9;hb=0eeef17fb8c79910223a298c9819b95974a71525;hp=b0deba5c78eda4b27194c4b813bc0bacf7db67e2;hpb=60a6696cc226d99a69aa13bf4060c7bdcc85e398;p=platform%2Fcore%2Fcsapi%2Ftizenfx.git
diff --git a/src/Tizen.NUI/src/public/Animation.cs b/src/Tizen.NUI/src/public/Animation.cs
index b0deba5..682f2b4 100755
--- a/src/Tizen.NUI/src/public/Animation.cs
+++ b/src/Tizen.NUI/src/public/Animation.cs
@@ -1,127 +1,101 @@
-// Copyright (c) 2017 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.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-//
-// This File has been auto-generated by SWIG and then modified using DALi Ruby Scripts
-// Some have been manually changed
+/*
+ * Copyright(c) 2019 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
namespace Tizen.NUI
{
-
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;
+
///
- /// Animation can be used to animate the properties of any number of objects, typically View.
- /// If the "Finished" event is connected to a member function of an object, it must be disconnected before the object is destroyed.
- /// This is typically done in the object destructor, and requires either the Animation handle to be stored.
- /// The overall animation time is superseded by the values given in the animation time used when calling the AnimateTo(), AnimateBy(), AnimateBetween() and AnimatePath() methods.
- /// If any of the individual calls to those functions exceeds the overall animation time(Duration), then the overall animation time is automatically extended.
+ /// Animation can be used to animate the properties of any number of objects, typically view.
+ /// If the "Finished" event is connected to a member function of an object, it must be disconnected before the object is destroyed.
+ /// This is typically done in the object destructor, and requires either the animation handle to be stored.
+ /// The overall animation time is superseded by the values given in the animation time used when calling the AnimateTo(), AnimateBy(), AnimateBetween() and AnimatePath() methods.
+ /// If any of the individual calls to those functions exceeds the overall animation time (Duration), then the overall animation time is automatically extended.
///
+ /// 3
public class Animation : BaseHandle
{
- private global::System.Runtime.InteropServices.HandleRef swigCPtr;
+ private static bool? disableAnimation = null;
- internal Animation(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicPINVOKE.Animation_SWIGUpcast(cPtr), cMemoryOwn)
- {
- swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
- }
- 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;
- }
-
- ///
- /// To make Animation instance be disposed.
- ///
- protected override void Dispose(DisposeTypes type)
- {
- if(disposed)
- {
- return;
- }
- if(type == DisposeTypes.Explicit)
- {
- //Called by User
- //Release your own managed resources here.
- //You should release all of your own disposable objects here.
-
- }
- else if(type == DisposeTypes.Implicit)
- {
-
- }
-
- if(this)
- {
- this.Clear();
- this.Reset();
- NUILog.Error("Now Animation is playing! Clear and Reset here!");
- //throw new System.InvalidOperationException("Animation Instance should not be disposed until getting Finished event. Should be a global variable");
- }
-
-
- //Release your own unmanaged resources here.
- //You should not access any managed member here except static instance.
- //because the execution order of Finalizes is non-deterministic.
+ private AnimationFinishedEventCallbackType _animationFinishedEventCallback;
+ private System.IntPtr _finishedCallbackOfNative;
- if (swigCPtr.Handle != global::System.IntPtr.Zero)
- {
- if (swigCMemOwn)
- {
- swigCMemOwn = false;
- NDalicPINVOKE.delete_Animation(swigCPtr);
- }
- swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
- }
+ private AnimationProgressReachedEventCallbackType _animationProgressReachedEventCallback;
- base.Dispose(type);
- }
+ private string[] _properties = null;
+ private string[] _destValue = null;
+ private int[] _startTime = null;
+ private int[] _endTime = null;
///
- /// Create an initialized Animation.
- /// The animation will not loop.
- /// The default end action is "Cancel".
- /// The default Alpha function is linear.
+ /// Creates an initialized animation.
+ /// The animation will not loop.
+ /// The default end action is "Cancel".
+ /// The default alpha function is linear.
///
/// DurationmSeconds must be greater than zero.
- /// The duration in milli seconds.
- public Animation(int durationMilliSeconds) : this(NDalicPINVOKE.Animation_New((float)durationMilliSeconds / 1000.0f), true)
+ /// The duration in milliseconds.
+ /// 3
+ public Animation(int durationMilliSeconds) : this(Interop.Animation.Animation_New((float)durationMilliSeconds / 1000.0f), true)
{
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
- private AnimationFinishedEventCallbackType _animationFinishedEventCallback;
+ internal Animation(global::System.IntPtr cPtr, bool cMemoryOwn) : base(Interop.Animation.Animation_SWIGUpcast(cPtr), cMemoryOwn)
+ {
+
+ _animationFinishedEventCallback = OnFinished;
+ _finishedCallbackOfNative = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(_animationFinishedEventCallback);
+ }
+
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
private delegate void AnimationFinishedEventCallbackType(IntPtr data);
+
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ private delegate void AnimationProgressReachedEventCallbackType(IntPtr data);
+
private event EventHandler _animationFinishedEventHandler;
+
/**
- * @brief Event for Finished signal which can be used to subscribe/unsubscribe the event handler.
- * Finished signal is emitted when an Animation's animations have finished.
+ * @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.
*/
+ /// 3
public event EventHandler Finished
{
add
{
- if (_animationFinishedEventHandler == null)
+ if (_animationFinishedEventHandler == null && disposed == false)
{
- NUILog.Debug("[add before]FinishedSignal().Empty=" + FinishedSignal().Empty() + " GetConnectionCount=" + FinishedSignal().GetConnectionCount());
- _animationFinishedEventCallback = OnFinished;
- FinishedSignal().Connect(_animationFinishedEventCallback);
- NUILog.Debug("[add after]FinishedSignal().Empty=" + FinishedSignal().Empty() + " GetConnectionCount=" + FinishedSignal().GetConnectionCount());
+ FinishedSignal().Connect(_finishedCallbackOfNative);
}
_animationFinishedEventHandler += value;
}
@@ -131,39 +105,26 @@ namespace Tizen.NUI
if (_animationFinishedEventHandler == null && FinishedSignal().Empty() == false)
{
- NUILog.Debug("[remove before]FinishedSignal().Empty=" + FinishedSignal().Empty() + " GetConnectionCount=" + FinishedSignal().GetConnectionCount());
- FinishedSignal().Disconnect(_animationFinishedEventCallback);
- NUILog.Debug("[remove after]FinishedSignal().Empty=" + FinishedSignal().Empty() + " GetConnectionCount=" + FinishedSignal().GetConnectionCount());
+ FinishedSignal().Disconnect(_finishedCallbackOfNative);
}
}
}
- private void OnFinished(IntPtr data)
- {
- if (_animationFinishedEventHandler != null)
- {
- //here we send all data to user event handlers
- _animationFinishedEventHandler(this, null);
- }
- }
- [UnmanagedFunctionPointer(CallingConvention.StdCall)]
- private delegate void AnimationProgressReachedEventCallbackType(IntPtr data);
- private AnimationProgressReachedEventCallbackType _animationProgressReachedEventCallback;
private event EventHandler _animationProgressReachedEventHandler;
+
/**
- * @brief Event for ProgressReached signal which can be used to subscribe/unsubscribe the event handler.
- * ProgressReached signal is emitted when the Animation has reached a given progress percentage, this is set in the api SetProgressNotification.
- */
+ * @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.
+ */
+ /// 3
public event EventHandler ProgressReached
{
add
{
if (_animationProgressReachedEventHandler == null)
{
- NUILog.Debug("[add before]ProgressReachedSignal().Empty=" + FinishedSignal().Empty() + " GetConnectionCount=" + FinishedSignal().GetConnectionCount());
_animationProgressReachedEventCallback = OnProgressReached;
ProgressReachedSignal().Connect(_animationProgressReachedEventCallback);
- NUILog.Debug("[add after]ProgressReachedSignal().Empty=" + FinishedSignal().Empty() + " GetConnectionCount=" + FinishedSignal().GetConnectionCount());
}
_animationProgressReachedEventHandler += value;
@@ -174,35 +135,72 @@ namespace Tizen.NUI
if (_animationProgressReachedEventHandler == null && ProgressReachedSignal().Empty() == false)
{
- NUILog.Debug("[remove before]ProgressReachedSignal().Empty=" + FinishedSignal().Empty() + " GetConnectionCount=" + FinishedSignal().GetConnectionCount());
- ProgressReachedSignal().Disconnect(_animationProgressReachedEventHandler);
- NUILog.Debug("[remove after]ProgressReachedSignal().Empty=" + FinishedSignal().Empty() + " GetConnectionCount=" + FinishedSignal().GetConnectionCount());
+ ProgressReachedSignal().Disconnect(_animationProgressReachedEventCallback);
}
}
}
- private void OnProgressReached(IntPtr data)
+
+ ///
+ /// Enumeration for what to do when the animation ends, stopped, or destroyed.
+ ///
+ /// 3
+ public enum EndActions
{
- if (_animationProgressReachedEventHandler != null)
- {
- //here we send all data to user event handlers
- _animationProgressReachedEventHandler(this, null);
- }
+ ///
+ /// When the animation ends, the animated property values are saved.
+ ///
+ Cancel,
+ ///
+ /// When the animation ends, the animated property values are forgotten.
+ ///
+ Discard,
+ ///
+ /// If the animation is stopped, the animated property values are saved as if the animation had run to completion, otherwise behaves like cancel.
+ ///
+ StopFinal
}
- private float MilliSecondsToSeconds(int millisec)
+ ///
+ /// Enumeration for what interpolation method to use on key-frame animations.
+ ///
+ /// 3
+ public enum Interpolation
{
- return (float)millisec / 1000.0f;
+ ///
+ /// Values in between key frames are interpolated using a linear polynomial. (Default)
+ ///
+ Linear,
+ ///
+ /// Values in between key frames are interpolated using a cubic polynomial.
+ ///
+ Cubic
}
- private int SecondsToMilliSeconds(float sec)
+ ///
+ /// Enumeration for what state the animation is in.
+ ///
+ /// Calling Reset() on this class will not reset the animation. It will call the BaseHandle.Reset() which drops the object handle.
+ /// 3
+ public enum States
{
- return (int)(sec * 1000);
+ ///
+ /// The animation has stopped.
+ ///
+ Stopped,
+ ///
+ /// The animation is playing.
+ ///
+ Playing,
+ ///
+ /// The animation is paused.
+ ///
+ Paused
}
-
///
- /// Gets/Sets the duration in milli seconds of the animation.
+ /// Gets or sets the duration in milliseconds of the animation.
///
+ /// 3
public int Duration
{
set
@@ -216,8 +214,9 @@ namespace Tizen.NUI
}
///
- /// Gets/Sets the default alpha function for the animation.
+ /// Gets or sets the default alpha function for the animation.
///
+ /// 3
public AlphaFunction DefaultAlphaFunction
{
set
@@ -234,6 +233,7 @@ namespace Tizen.NUI
///
/// Queries the state of the animation.
///
+ /// 3
public States State
{
get
@@ -243,12 +243,13 @@ namespace Tizen.NUI
}
///
- /// Set : Enables looping for 'count' repeats. A zero is the same as Looping = true; i.e.repeat forever.
- /// If Play() Stop() or 'count' loops is reached, the loop counter will reset.
- /// Setting this parameter does not cause the animation to Play().
- /// Get : Gets the loop count. A zero is the same as Looping = true; ie repeat forever.
- /// The loop count is initially 1 for play once.
+ /// Set: Enables looping for a specified number of repeats. A zero is the same as Looping = true; i.e., repeat forever.
+ /// This property resets the looping value and should not be used with the Looping property.
+ /// Setting this parameter does not cause the animation to Play().
+ /// Get: Gets the loop count. A zero is the same as Looping = true; i.e., repeat forever.
+ /// The loop count is initially 1 for play once.
///
+ /// 3
public int LoopCount
{
set
@@ -263,10 +264,11 @@ namespace Tizen.NUI
}
///
- /// Gets/Sets the status of whether the animation will loop.
- /// This property resets the loop count and should not be used with LoopCount property.
- /// Setting this parameter does not cause the animation to Play().
+ /// Gets or sets the status of whether the animation will loop.
+ /// This property resets the loop count and should not be used with the LoopCount property.
+ /// Setting this parameter does not cause the animation to Play().
///
+ /// 3
public bool Looping
{
set
@@ -282,10 +284,11 @@ namespace Tizen.NUI
///
- /// Gets/Sets the end action of the animation.
- /// This action is performed when the animation ends or if it is stopped.
- /// Default end action is Cancel.
+ /// Gets or sets the end action of the animation.
+ /// This action is performed when the animation ends or if it is stopped.
+ /// The default end action is cancel.
///
+ /// 3
public EndActions EndAction
{
set
@@ -298,22 +301,11 @@ namespace Tizen.NUI
}
}
-
- ///
- /// Stops the animation.
- ///
- /// end action can be set
- public void Stop(EndActions action = EndActions.Cancel)
- {
- SetEndAction(action);
- NDalicPINVOKE.Animation_Stop(swigCPtr);
- if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
- }
-
///
- /// Gets the current loop count.
- /// A value 0 indicating the current loop count when looping.
+ /// Gets the current loop count.
+ /// A value 0 indicating the current loop count when looping.
///
+ /// 3
public int CurrentLoop
{
get
@@ -323,20 +315,21 @@ namespace Tizen.NUI
}
///
- /// Gets/Sets the disconnect action.
- /// If any of the animated property owners are disconnected from the stage while the animation is being played, then this action is performed.
- /// Default action is to Cancel.
+ /// Gets or sets the disconnect action.
+ /// If any of the animated property owners are disconnected from the stage while the animation is being played, then this action is performed.
+ /// The default action is cancel.
///
+ /// 3
public EndActions DisconnectAction
{
set
{
- NDalicPINVOKE.Animation_SetDisconnectAction(swigCPtr, (int)value);
+ Interop.Animation.Animation_SetDisconnectAction(swigCPtr, (int)value);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
get
{
- Animation.EndActions ret = (Animation.EndActions)NDalicPINVOKE.Animation_GetDisconnectAction(swigCPtr);
+ Animation.EndActions ret = (Animation.EndActions)Interop.Animation.Animation_GetDisconnectAction(swigCPtr);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
return ret;
}
@@ -344,62 +337,65 @@ namespace Tizen.NUI
///
- /// Gets/Sets the progress of the animation.
- /// The animation will play(or continue playing) from this point.
- /// The progress must be in the 0-1 interval or in the play range interval if defined.
- /// otherwise, it will be ignored.
+ /// Gets or sets the progress of the animation.
+ /// The animation will play (or continue playing) from this point.
+ /// The progress must be in the 0-1 interval or in the play range interval if defined
+ /// otherwise, it will be ignored.
///
+ /// 3
public float CurrentProgress
{
set
{
- NDalicPINVOKE.Animation_SetCurrentProgress(swigCPtr, value);
+ Interop.Animation.Animation_SetCurrentProgress(swigCPtr, value);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
get
{
- float ret = NDalicPINVOKE.Animation_GetCurrentProgress(swigCPtr);
+ float ret = Interop.Animation.Animation_GetCurrentProgress(swigCPtr);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
return ret;
}
}
///
- /// Gets/Sets Specifies a speed factor for the animation.
- /// The speed factor is a multiplier of the normal velocity of the animation.
- /// Values between[0, 1] will slow down the animation and values above one will speed up the animation.
- /// It is also possible to specify a negative multiplier to play the animation in reverse.
+ /// Gets or sets specificifications of a speed factor for the animation.
+ /// The speed factor is a multiplier of the normal velocity of the animation.
+ /// Values between [0, 1] will slow down the animation and values above one will speed up the animation.
+ /// It is also possible to specify a negative multiplier to play the animation in reverse.
///
+ /// 3
public float SpeedFactor
{
set
{
- NDalicPINVOKE.Animation_SetSpeedFactor(swigCPtr, value);
+ Interop.Animation.Animation_SetSpeedFactor(swigCPtr, value);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
get
{
- float ret = NDalicPINVOKE.Animation_GetSpeedFactor(swigCPtr);
+ float ret = Interop.Animation.Animation_GetSpeedFactor(swigCPtr);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
return ret;
}
}
///
- /// Gets/Sets the playing range.
- /// Animation will play between the values specified. Both values(range.x and range.y ) should be between 0-1,
- /// otherwise they will be ignored.If the range provided is not in proper order(minimum, maximum ), it will be reordered.
+ /// Gets or sets the playing range.
+ /// Animation will play between the values specified. Both values (range.x and range.y ) should be between 0-1,
+ /// otherwise they will be ignored. If the range provided is not in proper order (minimum, maximum ), it will be reordered.
///
+ /// 3
public RelativeVector2 PlayRange
{
set
{
- NDalicPINVOKE.Animation_SetPlayRange(swigCPtr, Vector2.getCPtr(value));
+ Interop.Animation.Animation_SetPlayRange(swigCPtr, Vector2.getCPtr(value));
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
get
{
- Vector2 ret = new Vector2(NDalicPINVOKE.Animation_GetPlayRange(swigCPtr), true);
+ Vector2 ret = new Vector2(Interop.Animation.Animation_GetPlayRange(swigCPtr), true);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
return ret;
}
@@ -407,55 +403,143 @@ namespace Tizen.NUI
///
- /// Gets/Sets the Progress notification marker which triggers the ProgressReachedSignal.
- /// percentage of animation progress should be greater than 0 and less than 1, e.g 0.3 for 30%
- /// One notification can be set on each animation
+ /// Gets or sets the progress notification marker which triggers the ProgressReachedSignal.
+ /// Percentage of animation progress should be greater than 0 and less than 1, for example, 0.3 for 30%
+ /// One notification can be set on each animation.
///
+ /// 3
public float ProgressNotification
{
set
{
- NDalicPINVOKE.Animation_SetProgressNotification(swigCPtr, value);
+ Interop.Animation.Animation_SetProgressNotification(swigCPtr, value);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
get
{
- float ret = NDalicPINVOKE.Animation_GetProgressNotification(swigCPtr);
+ float ret = Interop.Animation.Animation_GetProgressNotification(swigCPtr);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
return ret;
}
}
///
- /// Animates a property value by a relative amount.
+ /// Gets or sets the properties of the animation.
///
- /// The target object to animate
- /// The target property to animate
- /// The property value will change by this amount
- /// The alpha function to apply
- public void AnimateBy(View target, string property, object relativeValue, AlphaFunction alphaFunction = null)
+ public string[] Properties
{
- string _str1 = property.Substring(0, 1);
- string _str2 = property.Substring(1);
- string _str = _str1.ToLower() + _str2;
+ get
+ {
+ return _properties;
+ }
+ set
+ {
+ _properties = value;
+ }
+ }
- Property _prop = new Property(target, _str);
- if (_prop.propertyIndex == Property.INVALID_INDEX)
+ ///
+ /// Gets or sets the destination value for each property of the animation.
+ ///
+ public string[] DestValue
+ {
+ get
{
- throw new System.ArgumentException("second argument string property is invalid parameter!");
+ return _destValue;
}
+ set
+ {
+ _destValue = value;
+ }
+ }
- PropertyType propertyType = target.GetPropertyType(_prop.propertyIndex);
- if(propertyType.Equals(PropertyType.Float))
+ ///
+ /// Gets or sets the start time for each property of the animation.
+ ///
+ public int[] StartTime
+ {
+ get
{
- System.Type type = relativeValue.GetType();
- if (type.Equals(typeof(System.Int32)) || type.Equals(typeof(int)))
+ return _startTime;
+ }
+ set
+ {
+ _startTime = value;
+ }
+ }
+
+ ///
+ /// Gets or sets the end time for each property of the animation.
+ ///
+ public int[] EndTime
+ {
+ get
+ {
+ return _endTime;
+ }
+ set
+ {
+ _endTime = value;
+ }
+ }
+
+ private bool DisableAnimation
+ {
+ get
+ {
+ if (disableAnimation.HasValue == false)
{
- int num = (int)relativeValue;
- relativeValue = (float)num;
+ string type = Environment.GetEnvironmentVariable("PlatformSmartType");
+ if (type == "Entry")
+ disableAnimation = true;
+ else
+ disableAnimation = false;
}
+ return disableAnimation.Value;
}
+ }
+ ///
+ /// Downcasts a handle to animation handle.
+ /// If handle points to an animation object, the downcast produces a valid handle.
+ /// If not, the returned handle is left uninitialized.
+ ///
+ /// Handle to an object.
+ /// Handle to an animation object or an uninitialized handle.
+ /// 3
+ [Obsolete("Deprecated in API6, Will be removed in API9, Please use as keyword instead!")]
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static Animation DownCast(BaseHandle handle)
+ {
+ Animation ret = Registry.GetManagedBaseHandleFromNativePtr(handle) as Animation;
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ return ret;
+ }
+
+ ///
+ /// Stops the animation.
+ ///
+ /// The end action can be set.
+ /// 3
+ public void Stop(EndActions action = EndActions.Cancel)
+ {
+ SetEndAction(action);
+ Interop.Animation.Animation_Stop(swigCPtr);
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ }
+
+ ///
+ /// Animates a property value by a relative amount.
+ ///
+ /// The target object to animate.
+ /// The target property to animate.
+ /// The property value will change by this amount.
+ /// The alpha function to apply.
+ /// 3
+ public void AnimateBy(View target, string property, object relativeValue, AlphaFunction alphaFunction = null)
+ {
+ Property _prop = PropertyHelper.GetPropertyFromString(target, property);
+ relativeValue = AvoidFloatPropertyHasIntegerValue(target, _prop, relativeValue);
PropertyValue val = PropertyValue.CreateFromObject(relativeValue);
if (alphaFunction != null)
@@ -469,37 +553,19 @@ namespace Tizen.NUI
}
///
- /// Animates a property value by a relative amount.
+ /// Animates a property value by a relative amount.
///
- /// The target object to animate
- /// The target property to animate
- /// The property value will change by this amount
- /// Start time of animation
- /// End time of animation
- /// The alpha function to apply
+ /// The target object to animate.
+ /// The target property to animate.
+ /// The property value will change by this amount.
+ /// The start time of the animation.
+ /// The end time of the animation.
+ /// The alpha function to apply.
+ /// 3
public void AnimateBy(View target, string property, object relativeValue, int startTime, int endTime, AlphaFunction alphaFunction = null)
{
- string _str1 = property.Substring(0, 1);
- string _str2 = property.Substring(1);
- string _str = _str1.ToLower() + _str2;
-
- Property _prop = new Property(target, _str);
- if (_prop.propertyIndex == Property.INVALID_INDEX)
- {
- throw new System.ArgumentException("second argument string property is invalid parameter!");
- }
-
- PropertyType propertyType = target.GetPropertyType(_prop.propertyIndex);
- if(propertyType.Equals(PropertyType.Float))
- {
- System.Type type = relativeValue.GetType();
- if (type.Equals(typeof(System.Int32)) || type.Equals(typeof(int)))
- {
- int num = (int)relativeValue;
- relativeValue = (float)num;
- }
- }
-
+ Property _prop = PropertyHelper.GetPropertyFromString(target, property);
+ relativeValue = AvoidFloatPropertyHasIntegerValue(target, _prop, relativeValue);
PropertyValue val = PropertyValue.CreateFromObject(relativeValue);
if (alphaFunction != null)
@@ -515,35 +581,17 @@ namespace Tizen.NUI
}
///
- /// Animates a property to a destination value.
+ /// Animates a property to a destination value.
///
- /// The target object to animate
- /// The target property to animate
- /// The destination value
- /// The alpha function to apply
+ /// The target object to animate.
+ /// The target property to animate.
+ /// The destination value.
+ /// The alpha function to apply.
+ /// 3
public void AnimateTo(View target, string property, object destinationValue, AlphaFunction alphaFunction = null)
{
- string _str1 = property.Substring(0, 1);
- string _str2 = property.Substring(1);
- string _str = _str1.ToLower() + _str2;
-
- Property _prop = new Property(target, _str);
- if (_prop.propertyIndex == Property.INVALID_INDEX)
- {
- throw new System.ArgumentException("second argument string property is invalid parameter!");
- }
-
- PropertyType propertyType = target.GetPropertyType(_prop.propertyIndex);
- if(propertyType.Equals(PropertyType.Float))
- {
- System.Type type = destinationValue.GetType();
- if (type.Equals(typeof(System.Int32)) || type.Equals(typeof(int)))
- {
- int num = (int)destinationValue;
- destinationValue = (float)num;
- }
- }
-
+ Property _prop = PropertyHelper.GetPropertyFromString(target, property);
+ destinationValue = AvoidFloatPropertyHasIntegerValue(target, _prop, destinationValue);
PropertyValue val = PropertyValue.CreateFromObject(destinationValue);
if (alphaFunction != null)
@@ -557,38 +605,49 @@ namespace Tizen.NUI
}
///
- /// Animates a property to a destination value.
+ /// Animates one or more properties to a destination value.
///
- /// The target object to animate
- /// The target property to animate
- /// The destination value
- /// The alpha function to apply
- /// Start time of animation
- /// End time of animation
- /// The alpha function to apply
- public void AnimateTo(View target, string property, object destinationValue, int startTime, int endTime, AlphaFunction alphaFunction = null)
+ /// The target object to animate.
+ public void PlayAnimateTo(View target)
{
- string _str1 = property.Substring(0, 1);
- string _str2 = property.Substring(1);
- string _str = _str1.ToLower() + _str2;
-
- Property _prop = new Property(target, _str);
- if (_prop.propertyIndex == Property.INVALID_INDEX)
+ Clear();
+ if (_properties.Length == _destValue.Length && _startTime.Length == _endTime.Length && _properties.Length == _startTime.Length)
{
- throw new System.ArgumentException("second argument string property is invalid parameter!");
- }
-
- PropertyType propertyType = target.GetPropertyType(_prop.propertyIndex);
- if(propertyType.Equals(PropertyType.Float))
- {
- System.Type type = destinationValue.GetType();
- if (type.Equals(typeof(System.Int32)) || type.Equals(typeof(int)))
+ int length = _properties.Length;
+ for (int index = 0; index < length; index++)
{
- int num = (int)destinationValue;
- destinationValue = (float)num;
+ //object destinationValue = _destValue[index];
+ var elementType = target.GetType();
+ 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);
+
+ if (destinationValue != null)
+ {
+ AnimateTo(target, _properties[index], destinationValue, _startTime[index], _endTime[index]);
+ }
+ }
}
+ Play();
}
+ }
+ ///
+ /// Animates a property to a destination value.
+ ///
+ /// The target object to animate.
+ /// The target property to animate.
+ /// The destination value.
+ /// The start time of the animation.
+ /// The end time of the animation.
+ /// The alpha function to apply.
+ /// 3
+ public void AnimateTo(View target, string property, object destinationValue, int startTime, int endTime, AlphaFunction alphaFunction = null)
+ {
+ Property _prop = PropertyHelper.GetPropertyFromString(target, property);
+ destinationValue = AvoidFloatPropertyHasIntegerValue(target, _prop, destinationValue);
PropertyValue val = PropertyValue.CreateFromObject(destinationValue);
if (alphaFunction != null)
@@ -606,18 +665,16 @@ namespace Tizen.NUI
///
/// Animates a property between keyframes.
///
- /// The target object to animate
- /// The target property to animate
- /// The set of time/value pairs between which to animate
- /// The method used to interpolate between values
- /// The alpha function to apply
+ /// The target object to animate.
+ /// The target property to animate.
+ /// The set of time or value pairs between which to animate.
+ /// The method used to interpolate between values.
+ /// The alpha function to apply.
+ /// 3
public void AnimateBetween(View target, string property, KeyFrames keyFrames, Interpolation interpolation = Interpolation.Linear, AlphaFunction alphaFunction = null)
{
- string _str1 = property.Substring(0, 1);
- string _str2 = property.Substring(1);
- string _str = _str1.ToLower() + _str2;
+ Property _prop = PropertyHelper.GetPropertyFromString(target, property);
- Property _prop = new Property(target, _str);
if (_prop.propertyIndex == Property.INVALID_INDEX)
{
throw new System.ArgumentException("second argument string property is invalid parameter!");
@@ -633,28 +690,20 @@ namespace Tizen.NUI
}
}
-
///
/// Animates a property between keyframes.
///
/// The target object to animate
/// The target property to animate
/// The set of time/value pairs between which to animate
- /// Start time of animation in milli seconds
- /// End time of animation in milli seconds
- /// The method used to interpolate between values
- /// The alpha function to apply
+ /// The start time of animation in milliseconds.
+ /// The end time of animation in milliseconds.
+ /// The method used to interpolate between values.
+ /// The alpha function to apply.
+ /// 3
public void AnimateBetween(View target, string property, KeyFrames keyFrames, int startTime, int endTime, Interpolation interpolation = Interpolation.Linear, AlphaFunction alphaFunction = null)
{
- string _str1 = property.Substring(0, 1);
- string _str2 = property.Substring(1);
- string _str = _str1.ToLower() + _str2;
-
- Property _prop = new Property(target, _str);
- if (_prop.propertyIndex == Property.INVALID_INDEX)
- {
- throw new System.ArgumentException("second argument string property is invalid parameter!");
- }
+ Property _prop = PropertyHelper.GetPropertyFromString(target, property);
Tizen.NUI.TimePeriod time = new Tizen.NUI.TimePeriod(MilliSecondsToSeconds(startTime), MilliSecondsToSeconds(endTime - startTime));
if (alphaFunction != null)
@@ -668,14 +717,15 @@ namespace Tizen.NUI
}
///
- /// Animates an view's position and orientation through a predefined path.
- /// The view will rotate to orient the supplied forward vector with the path's tangent.
- /// If forward is the zero vector then no rotation will happen.
+ /// Animates the view's position and orientation through a predefined path.
+ /// The view will rotate to orient the supplied forward vector with the path's tangent.
+ /// If forward is the zero vector then no rotation will happen.
///
- /// The view to animate
- /// It defines position and orientation
- /// The vector (in local space coordinate system) that will be oriented with the path's tangent direction
- /// The alpha function to apply
+ /// The view to animate.
+ /// It defines position and orientation.
+ /// The vector (in local space coordinate system) will be oriented with the path's tangent direction.
+ /// The alpha function to apply.
+ /// 3
public void AnimatePath(View view, Path path, Vector3 forward, AlphaFunction alphaFunction = null)
{
if (alphaFunction == null)
@@ -689,16 +739,17 @@ namespace Tizen.NUI
}
///
- /// Animates an view's position and orientation through a predefined path.
- /// The view will rotate to orient the supplied forward vector with the path's tangent.
- /// If forward is the zero vector then no rotation will happen.
+ /// Animates the view's position and orientation through a predefined path.
+ /// The view will rotate to orient the supplied forward vector with the path's tangent.
+ /// If forward is the zero vector then no rotation will happen.
///
- /// The view to animate
- /// It defines position and orientation
- /// The vector (in local space coordinate system) that will be oriented with the path's tangent direction
- /// Start time of animation
- /// End time of animation
- /// The alpha function to apply
+ /// The view to animate.
+ /// It defines position and orientation.
+ /// The vector (in local space coordinate system) will be oriented with the path's tangent direction.
+ /// The start time of the animation.
+ /// The end time of the animation.
+ /// The alpha function to apply.
+ /// 3
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));
@@ -713,443 +764,599 @@ namespace Tizen.NUI
}
///
- /// Creates an initialized Animation.
- /// The animation will not loop.
- /// The default end action is "Cancel".
- /// The default alpha function is linear.
+ /// Creates an initialized animation.
+ /// The animation will not loop.
+ /// The default end action is "Cancel".
+ /// The default alpha function is linear.
///
- public Animation() : this(NDalicPINVOKE.Animation_New(0.0f), true)
+ /// 3
+ public Animation() : this(Interop.Animation.Animation_New(0.0f), true)
{
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
- internal Animation(float durationSeconds) : this(NDalicPINVOKE.Animation_New(durationSeconds), true)
+ ///
+ /// Plays the animation.
+ ///
+ /// 3
+ public void Play()
{
+ Interop.Animation.Animation_Play(swigCPtr);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ if (DisableAnimation == true)
+ Stop(EndActions.StopFinal);
}
///
- /// Downcasts a handle to Animation handle.
- /// If handle points to an Animation object, the downcast produces valid handle.
- /// If not, the returned handle is left uninitialized.
+ /// Plays the animation from a given point.
+ /// The progress must be in the 0-1 interval or in the play range interval if defined,
+ /// otherwise, it will be ignored.
///
- /// Handle to an object
- /// Handle to an Animation object or an uninitialized handle
- public static Animation DownCast(BaseHandle handle)
+ /// A value between [0,1], or between the play range if specified, from where the animation should start playing.
+ /// 3
+ public void PlayFrom(float progress)
{
- Animation ret = Registry.GetManagedBaseHandleFromNativePtr(handle) as Animation;
+ Interop.Animation.Animation_PlayFrom(swigCPtr, progress);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
- return ret;
}
- internal Animation(Animation handle) : this(NDalicPINVOKE.new_Animation__SWIG_1(Animation.getCPtr(handle)), true)
+ ///
+ /// Plays the animation after a given delay time.
+ /// The delay time is not included in the looping time.
+ /// When the delay time is a negative value, it would treat as play immediately.
+ ///
+ /// The delay time.
+ /// 4
+ public void PlayAfter(int delayMilliseconds)
+ {
+ Interop.Animation.Animation_PlayAfter(swigCPtr, MilliSecondsToSeconds(delayMilliseconds));
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ }
+
+ ///
+ /// Pauses the animation.
+ ///
+ /// 3
+ public void Pause()
+ {
+ Interop.Animation.Animation_Pause(swigCPtr);
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ }
+
+ ///
+ /// Stops the animation.
+ ///
+ /// 3
+ public void Stop()
+ {
+ Interop.Animation.Animation_Stop(swigCPtr);
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ }
+
+ ///
+ /// Clears the animation.
+ /// This disconnects any objects that were being animated, effectively stopping the animation.
+ ///
+ /// 3
+ public void Clear()
+ {
+ Interop.Animation.Animation_Clear(swigCPtr);
+ 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