2 * Copyright(c) 2017 Samsung Electronics Co., Ltd.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
22 using System.Runtime.InteropServices;
23 using Tizen.NUI.BaseComponents;
26 /// Animation can be used to animate the properties of any number of objects, typically view.<br />
27 /// If the "Finished" event is connected to a member function of an object, it must be disconnected before the object is destroyed.<br />
28 /// This is typically done in the object destructor, and requires either the animation handle to be stored.<br />
29 /// 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 />
30 /// If any of the individual calls to those functions exceeds the overall animation time (Duration), then the overall animation time is automatically extended.<br />
32 public class Animation : BaseHandle
34 private global::System.Runtime.InteropServices.HandleRef swigCPtr;
36 internal Animation(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicPINVOKE.Animation_SWIGUpcast(cPtr), cMemoryOwn)
38 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
41 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Animation obj)
43 return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
47 /// To make animation instance be disposed.
49 protected override void Dispose(DisposeTypes type)
55 if(type == DisposeTypes.Explicit)
58 //Release your own managed resources here.
59 //You should release all of your own disposable objects here.
62 else if(type == DisposeTypes.Implicit)
67 if (_animationFinishedEventCallback != null)
69 FinishedSignal().Disconnect(_animationFinishedEventCallback);
72 if (_animationProgressReachedEventCallback != null)
75 ProgressReachedSignal().Disconnect(_animationProgressReachedEventCallback);
82 NUILog.Error("Now Animation is playing! Clear and Reset here!");
83 //throw new System.InvalidOperationException("Animation Instance should not be disposed until getting Finished event. Should be a global variable");
86 //Release your own unmanaged resources here.
87 //You should not access any managed member here except static instance.
88 //because the execution order of Finalizes is non-deterministic.
90 if (swigCPtr.Handle != global::System.IntPtr.Zero)
95 NDalicPINVOKE.delete_Animation(swigCPtr);
97 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
104 /// Creates an initialized animation.<br />
105 /// The animation will not loop.<br />
106 /// The default end action is "Cancel".<br />
107 /// The default alpha function is linear.<br />
109 /// <remarks>DurationmSeconds must be greater than zero.</remarks>
110 /// <param name="durationMilliSeconds">The duration in milliseconds.</param>
111 /// <since_tizen> 3 </since_tizen>
112 public Animation(int durationMilliSeconds) : this(NDalicPINVOKE.Animation_New((float)durationMilliSeconds / 1000.0f), true)
114 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
117 private AnimationFinishedEventCallbackType _animationFinishedEventCallback;
118 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
119 private delegate void AnimationFinishedEventCallbackType(IntPtr data);
120 private event EventHandler _animationFinishedEventHandler;
122 * @brief Event for the finished signal which can be used to subscribe or unsubscribe the event handler.
123 * The finished signal is emitted when an animation's animations have finished.
125 public event EventHandler Finished
129 if (_animationFinishedEventHandler == null)
131 NUILog.Debug("[add before]FinishedSignal().Empty=" + FinishedSignal().Empty() + " GetConnectionCount=" + FinishedSignal().GetConnectionCount());
132 _animationFinishedEventCallback = OnFinished;
133 FinishedSignal().Connect(_animationFinishedEventCallback);
134 NUILog.Debug("[add after]FinishedSignal().Empty=" + FinishedSignal().Empty() + " GetConnectionCount=" + FinishedSignal().GetConnectionCount());
136 _animationFinishedEventHandler += value;
140 _animationFinishedEventHandler -= value;
142 if (_animationFinishedEventHandler == null && FinishedSignal().Empty() == false)
144 NUILog.Debug("[remove before]FinishedSignal().Empty=" + FinishedSignal().Empty() + " GetConnectionCount=" + FinishedSignal().GetConnectionCount());
145 FinishedSignal().Disconnect(_animationFinishedEventCallback);
146 NUILog.Debug("[remove after]FinishedSignal().Empty=" + FinishedSignal().Empty() + " GetConnectionCount=" + FinishedSignal().GetConnectionCount());
150 private void OnFinished(IntPtr data)
152 if (_animationFinishedEventHandler != null)
154 //here we send all data to user event handlers
155 _animationFinishedEventHandler(this, null);
159 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
160 private delegate void AnimationProgressReachedEventCallbackType(IntPtr data);
161 private AnimationProgressReachedEventCallbackType _animationProgressReachedEventCallback;
162 private event EventHandler _animationProgressReachedEventHandler;
164 * @brief Event for the ProgressReached signal, which can be used to subscribe or unsubscribe the event handler.
165 * The ProgressReached signal is emitted when the animation has reached a given progress percentage, this is set in the api SetProgressNotification.
167 public event EventHandler ProgressReached
171 if (_animationProgressReachedEventHandler == null)
173 NUILog.Debug("[add before]ProgressReachedSignal().Empty=" + FinishedSignal().Empty() + " GetConnectionCount=" + FinishedSignal().GetConnectionCount());
174 _animationProgressReachedEventCallback = OnProgressReached;
175 ProgressReachedSignal().Connect(_animationProgressReachedEventCallback);
176 NUILog.Debug("[add after]ProgressReachedSignal().Empty=" + FinishedSignal().Empty() + " GetConnectionCount=" + FinishedSignal().GetConnectionCount());
179 _animationProgressReachedEventHandler += value;
183 _animationProgressReachedEventHandler -= value;
185 if (_animationProgressReachedEventHandler == null && ProgressReachedSignal().Empty() == false)
187 NUILog.Debug("[remove before]ProgressReachedSignal().Empty=" + FinishedSignal().Empty() + " GetConnectionCount=" + FinishedSignal().GetConnectionCount());
188 ProgressReachedSignal().Disconnect(_animationProgressReachedEventCallback);
189 NUILog.Debug("[remove after]ProgressReachedSignal().Empty=" + FinishedSignal().Empty() + " GetConnectionCount=" + FinishedSignal().GetConnectionCount());
193 private void OnProgressReached(IntPtr data)
195 if (_animationProgressReachedEventHandler != null)
197 //here we send all data to user event handlers
198 _animationProgressReachedEventHandler(this, null);
202 private float MilliSecondsToSeconds(int millisec)
204 return (float)millisec / 1000.0f;
207 private int SecondsToMilliSeconds(float sec)
209 return (int)(sec * 1000);
214 /// Gets or sets the duration in milliseconds of the animation.
216 /// <since_tizen> 3 </since_tizen>
221 SetDuration(MilliSecondsToSeconds(value));
225 return SecondsToMilliSeconds(GetDuration());
230 /// Gets or sets the default alpha function for the animation.
232 /// <since_tizen> 3 </since_tizen>
233 public AlphaFunction DefaultAlphaFunction
237 SetDefaultAlphaFunction(value);
241 AlphaFunction ret = GetDefaultAlphaFunction();
247 /// Queries the state of the animation.
249 /// <since_tizen> 3 </since_tizen>
259 /// Set: Enables looping for 'count' repeats. A zero is the same as Looping = true; i.e., repeat forever.<br />
260 /// If Play() Stop() or 'count' loops is reached, the loop counter will reset.<br />
261 /// Setting this parameter does not cause the animation to Play().<br />
262 /// Get: Gets the loop count. A zero is the same as Looping = true; i.e., repeat forever.<br />
263 /// The loop count is initially 1 for play once.<br />
265 /// <since_tizen> 3 </since_tizen>
274 int ret = GetLoopCount();
280 /// Gets or sets the status of whether the animation will loop.<br />
281 /// This property resets the loop count and should not be used with the LoopCount property.<br />
282 /// Setting this parameter does not cause the animation to Play().<br />
284 /// <since_tizen> 3 </since_tizen>
293 bool ret = IsLooping();
300 /// Gets or sets the end action of the animation.<br />
301 /// This action is performed when the animation ends or if it is stopped.<br />
302 /// The default end action is cancel.<br />
304 /// <since_tizen> 3 </since_tizen>
305 public EndActions EndAction
313 return GetEndAction();
319 /// Stops the animation.
321 /// <param name="action">The end action can be set.</param>
322 /// <since_tizen> 3 </since_tizen>
323 public void Stop(EndActions action = EndActions.Cancel)
325 SetEndAction(action);
326 NDalicPINVOKE.Animation_Stop(swigCPtr);
327 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
331 /// Gets the current loop count.<br />
332 /// A value 0 indicating the current loop count when looping.<br />
334 /// <since_tizen> 3 </since_tizen>
335 public int CurrentLoop
339 return GetCurrentLoop();
344 /// Gets or sets the disconnect action.<br />
345 /// If any of the animated property owners are disconnected from the stage while the animation is being played, then this action is performed.<br />
346 /// The default action is cancel.<br />
348 /// <since_tizen> 3 </since_tizen>
349 public EndActions DisconnectAction
353 NDalicPINVOKE.Animation_SetDisconnectAction(swigCPtr, (int)value);
354 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
358 Animation.EndActions ret = (Animation.EndActions)NDalicPINVOKE.Animation_GetDisconnectAction(swigCPtr);
359 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
366 /// Gets or sets the progress of the animation.<br />
367 /// The animation will play (or continue playing) from this point.<br />
368 /// The progress must be in the 0-1 interval or in the play range interval if defined<br />
369 /// otherwise, it will be ignored.<br />
371 /// <since_tizen> 3 </since_tizen>
372 public float CurrentProgress
376 NDalicPINVOKE.Animation_SetCurrentProgress(swigCPtr, value);
377 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
381 float ret = NDalicPINVOKE.Animation_GetCurrentProgress(swigCPtr);
382 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
388 /// Gets or sets specificifications of a speed factor for the animation.<br />
389 /// The speed factor is a multiplier of the normal velocity of the animation.<br />
390 /// Values between [0, 1] will slow down the animation and values above one will speed up the animation.<br />
391 /// It is also possible to specify a negative multiplier to play the animation in reverse.<br />
393 /// <since_tizen> 3 </since_tizen>
394 public float SpeedFactor
398 NDalicPINVOKE.Animation_SetSpeedFactor(swigCPtr, value);
399 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
403 float ret = NDalicPINVOKE.Animation_GetSpeedFactor(swigCPtr);
404 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
410 /// Gets or sets the playing range.<br />
411 /// Animation will play between the values specified. Both values (range.x and range.y ) should be between 0-1,
412 /// otherwise they will be ignored. If the range provided is not in proper order (minimum, maximum ), it will be reordered.<br />
414 /// <since_tizen> 3 </since_tizen>
415 public RelativeVector2 PlayRange
419 NDalicPINVOKE.Animation_SetPlayRange(swigCPtr, Vector2.getCPtr(value));
420 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
424 Vector2 ret = new Vector2(NDalicPINVOKE.Animation_GetPlayRange(swigCPtr), true);
425 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
432 /// Gets or sets the progress notification marker which triggers the ProgressReachedSignal.<br />
433 /// Percentage of animation progress should be greater than 0 and less than 1, for example, 0.3 for 30% <br />
434 /// One notification can be set on each animation.
436 /// <since_tizen> 3 </since_tizen>
437 public float ProgressNotification
441 NDalicPINVOKE.Animation_SetProgressNotification(swigCPtr, value);
442 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
446 float ret = NDalicPINVOKE.Animation_GetProgressNotification(swigCPtr);
447 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
453 /// Animates a property value by a relative amount.<br />
455 /// <param name="target">The target object to animate.</param>
456 /// <param name="property">The target property to animate.</param>
457 /// <param name="relativeValue">The property value will change by this amount.</param>
458 /// <param name="alphaFunction">The alpha function to apply.</param>
459 /// <since_tizen> 3 </since_tizen>
460 public void AnimateBy(View target, string property, object relativeValue, AlphaFunction alphaFunction = null)
462 Property _prop = PropertyHelper.GetPropertyFromString(target, property);
464 PropertyType propertyType = target.GetPropertyType(_prop.propertyIndex);
465 if(propertyType.Equals(PropertyType.Float))
467 System.Type type = relativeValue.GetType();
468 if (type.Equals(typeof(System.Int32)) || type.Equals(typeof(int)))
470 int num = (int)relativeValue;
471 relativeValue = (float)num;
475 PropertyValue val = PropertyValue.CreateFromObject(relativeValue);
477 if (alphaFunction != null)
479 AnimateBy(_prop, val, alphaFunction);
483 AnimateBy(_prop, val);
488 /// Animates a property value by a relative amount.<br />
490 /// <param name="target">The target object to animate.</param>
491 /// <param name="property">The target property to animate.</param>
492 /// <param name="relativeValue">The property value will change by this amount.</param>
493 /// <param name="startTime">The start time of the animation.</param>
494 /// <param name="endTime">The end time of the animation.</param>
495 /// <param name="alphaFunction">The alpha function to apply.</param>
496 /// <since_tizen> 3 </since_tizen>
497 public void AnimateBy(View target, string property, object relativeValue, int startTime, int endTime, AlphaFunction alphaFunction = null)
499 Property _prop = PropertyHelper.GetPropertyFromString(target, property);
501 PropertyType propertyType = target.GetPropertyType(_prop.propertyIndex);
502 if(propertyType.Equals(PropertyType.Float))
504 System.Type type = relativeValue.GetType();
505 if (type.Equals(typeof(System.Int32)) || type.Equals(typeof(int)))
507 int num = (int)relativeValue;
508 relativeValue = (float)num;
512 PropertyValue val = PropertyValue.CreateFromObject(relativeValue);
514 if (alphaFunction != null)
516 Tizen.NUI.TimePeriod time = new Tizen.NUI.TimePeriod(MilliSecondsToSeconds(startTime), MilliSecondsToSeconds(endTime - startTime));
517 AnimateBy(_prop, val, alphaFunction, time);
521 Tizen.NUI.TimePeriod time = new Tizen.NUI.TimePeriod(MilliSecondsToSeconds(startTime), MilliSecondsToSeconds(endTime - startTime));
522 AnimateBy(_prop, val, time);
527 /// Animates a property to a destination value.<br />
529 /// <param name="target">The target object to animate.</param>
530 /// <param name="property">The target property to animate.</param>
531 /// <param name="destinationValue">The destination value.</param>
532 /// <param name="alphaFunction">The alpha function to apply.</param>
533 /// <since_tizen> 3 </since_tizen>
534 public void AnimateTo(View target, string property, object destinationValue, AlphaFunction alphaFunction = null)
536 Property _prop = PropertyHelper.GetPropertyFromString(target, property);
538 PropertyType propertyType = target.GetPropertyType(_prop.propertyIndex);
539 if(propertyType.Equals(PropertyType.Float))
541 System.Type type = destinationValue.GetType();
542 if (type.Equals(typeof(System.Int32)) || type.Equals(typeof(int)))
544 int num = (int)destinationValue;
545 destinationValue = (float)num;
549 PropertyValue val = PropertyValue.CreateFromObject(destinationValue);
551 if (alphaFunction != null)
553 AnimateTo(_prop, val, alphaFunction);
557 AnimateTo(_prop, val);
562 /// Animates a property to a destination value.<br />
564 /// <param name="target">The target object to animate.</param>
565 /// <param name="property">The target property to animate.</param>
566 /// <param name="destinationValue">The destination value.</param>
567 /// <param name="startTime">The start time of the animation.</param>
568 /// <param name="endTime">The end time of the animation.</param>
569 /// <param name="alphaFunction">The alpha function to apply.</param>
570 /// <since_tizen> 3 </since_tizen>
571 public void AnimateTo(View target, string property, object destinationValue, int startTime, int endTime, AlphaFunction alphaFunction = null)
573 Property _prop = PropertyHelper.GetPropertyFromString(target, property);
575 PropertyType propertyType = target.GetPropertyType(_prop.propertyIndex);
576 if(propertyType.Equals(PropertyType.Float))
578 System.Type type = destinationValue.GetType();
579 if (type.Equals(typeof(System.Int32)) || type.Equals(typeof(int)))
581 int num = (int)destinationValue;
582 destinationValue = (float)num;
586 PropertyValue val = PropertyValue.CreateFromObject(destinationValue);
588 if (alphaFunction != null)
590 Tizen.NUI.TimePeriod time = new Tizen.NUI.TimePeriod(MilliSecondsToSeconds(startTime), MilliSecondsToSeconds(endTime - startTime));
591 AnimateTo(_prop, val, alphaFunction, time);
595 Tizen.NUI.TimePeriod time = new Tizen.NUI.TimePeriod(MilliSecondsToSeconds(startTime), MilliSecondsToSeconds(endTime - startTime));
596 AnimateTo(_prop, val, time);
601 /// Animates a property between keyframes.
603 /// <param name="target">The target object to animate.</param>
604 /// <param name="property">The target property to animate.</param>
605 /// <param name="keyFrames">The set of time or value pairs between which to animate.</param>
606 /// <param name="interpolation">The method used to interpolate between values.</param>
607 /// <param name="alphaFunction">The alpha function to apply.</param>
608 /// <since_tizen> 3 </since_tizen>
609 public void AnimateBetween(View target, string property, KeyFrames keyFrames, Interpolation interpolation = Interpolation.Linear, AlphaFunction alphaFunction = null)
611 Property _prop = PropertyHelper.GetPropertyFromString(target, property);
613 if (_prop.propertyIndex == Property.INVALID_INDEX)
615 throw new System.ArgumentException("second argument string property is invalid parameter!");
618 if (alphaFunction != null)
620 AnimateBetween(_prop, keyFrames, alphaFunction, interpolation);
624 AnimateBetween(_prop, keyFrames, interpolation);
630 /// Animates a property between keyframes.
632 /// <param name="target">The target object to animate</param>
633 /// <param name="property">The target property to animate</param>
634 /// <param name="keyFrames">The set of time/value pairs between which to animate</param>
635 /// <param name="startTime">The start time of animation in milliseconds.</param>
636 /// <param name="endTime">The end time of animation in milliseconds.</param>
637 /// <param name="interpolation">The method used to interpolate between values.</param>
638 /// <param name="alphaFunction">The alpha function to apply.</param>
639 /// <since_tizen> 3 </since_tizen>
640 public void AnimateBetween(View target, string property, KeyFrames keyFrames, int startTime, int endTime, Interpolation interpolation = Interpolation.Linear, AlphaFunction alphaFunction = null)
642 Property _prop = PropertyHelper.GetPropertyFromString(target, property);
644 Tizen.NUI.TimePeriod time = new Tizen.NUI.TimePeriod(MilliSecondsToSeconds(startTime), MilliSecondsToSeconds(endTime - startTime));
645 if (alphaFunction != null)
647 AnimateBetween(_prop, keyFrames, alphaFunction, time, interpolation);
651 AnimateBetween(_prop, keyFrames, time, interpolation);
656 /// Animates the view's position and orientation through a predefined path.<br />
657 /// The view will rotate to orient the supplied forward vector with the path's tangent.<br />
658 /// If forward is the zero vector then no rotation will happen.<br />
660 /// <param name="view">The view to animate.</param>
661 /// <param name="path">It defines position and orientation.</param>
662 /// <param name="forward">The vector (in local space coordinate system) will be oriented with the path's tangent direction.</param>
663 /// <param name="alphaFunction">The alpha function to apply.</param>
664 /// <since_tizen> 3 </since_tizen>
665 public void AnimatePath(View view, Path path, Vector3 forward, AlphaFunction alphaFunction = null)
667 if (alphaFunction == null)
669 Animate(view, path, forward);
673 Animate(view, path, forward, alphaFunction);
678 /// Animates the view's position and orientation through a predefined path.<br />
679 /// The view will rotate to orient the supplied forward vector with the path's tangent.<br />
680 /// If forward is the zero vector then no rotation will happen.<br />
682 /// <param name="view">The view to animate.</param>
683 /// <param name="path">It defines position and orientation.</param>
684 /// <param name="forward">The vector (in local space coordinate system) will be oriented with the path's tangent direction.</param>
685 /// <param name="startTime">The start time of the animation.</param>
686 /// <param name="endTime">The end time of the animation.</param>
687 /// <param name="alphaFunction">The alpha function to apply.</param>
688 /// <since_tizen> 3 </since_tizen>
689 public void AnimatePath(View view, Path path, Vector3 forward, int startTime, int endTime, AlphaFunction alphaFunction = null)
691 TimePeriod time = new TimePeriod(MilliSecondsToSeconds(startTime), MilliSecondsToSeconds(endTime - startTime));
692 if (alphaFunction == null)
694 Animate(view, path, forward, time);
698 Animate(view, path, forward, alphaFunction, time);
703 /// Creates an initialized animation.<br />
704 /// The animation will not loop.<br />
705 /// The default end action is "Cancel".<br />
706 /// The default alpha function is linear.<br />
708 /// <since_tizen> 3 </since_tizen>
709 public Animation() : this(NDalicPINVOKE.Animation_New(0.0f), true)
711 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
714 internal Animation(float durationSeconds) : this(NDalicPINVOKE.Animation_New(durationSeconds), true)
716 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
721 /// Downcasts a handle to animation handle.<br />
722 /// If handle points to an animation object, the downcast produces a valid handle.<br />
723 /// If not, the returned handle is left uninitialized.<br />
725 /// <param name="handle">Handle to an object.</param>
726 /// <returns>Handle to an animation object or an uninitialized handle.</returns>
727 /// <since_tizen> 3 </since_tizen>
728 public static Animation DownCast(BaseHandle handle)
730 Animation ret = Registry.GetManagedBaseHandleFromNativePtr(handle) as Animation;
731 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
735 internal Animation(Animation handle) : this(NDalicPINVOKE.new_Animation__SWIG_1(Animation.getCPtr(handle)), true)
737 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
740 internal Animation Assign(Animation rhs)
742 Animation ret = new Animation(NDalicPINVOKE.Animation_Assign(swigCPtr, Animation.getCPtr(rhs)), false);
743 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
747 internal void SetDuration(float seconds)
749 NDalicPINVOKE.Animation_SetDuration(swigCPtr, seconds);
750 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
753 internal float GetDuration()
755 float ret = NDalicPINVOKE.Animation_GetDuration(swigCPtr);
756 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
760 internal void SetLooping(bool looping)
762 NDalicPINVOKE.Animation_SetLooping(swigCPtr, looping);
763 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
766 internal void SetLoopCount(int count)
768 NDalicPINVOKE.Animation_SetLoopCount(swigCPtr, count);
769 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
772 internal int GetLoopCount()
774 int ret = NDalicPINVOKE.Animation_GetLoopCount(swigCPtr);
775 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
779 internal int GetCurrentLoop()
781 int ret = NDalicPINVOKE.Animation_GetCurrentLoop(swigCPtr);
782 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
786 internal bool IsLooping()
788 bool ret = NDalicPINVOKE.Animation_IsLooping(swigCPtr);
789 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
793 internal void SetEndAction(Animation.EndActions action)
795 NDalicPINVOKE.Animation_SetEndAction(swigCPtr, (int)action);
796 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
799 internal Animation.EndActions GetEndAction()
801 Animation.EndActions ret = (Animation.EndActions)NDalicPINVOKE.Animation_GetEndAction(swigCPtr);
802 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
806 internal void SetDisconnectAction(Animation.EndActions disconnectAction)
808 NDalicPINVOKE.Animation_SetDisconnectAction(swigCPtr, (int)disconnectAction);
809 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
812 internal Animation.EndActions GetDisconnectAction()
814 Animation.EndActions ret = (Animation.EndActions)NDalicPINVOKE.Animation_GetDisconnectAction(swigCPtr);
815 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
819 internal void SetDefaultAlphaFunction(AlphaFunction alpha)
821 NDalicPINVOKE.Animation_SetDefaultAlphaFunction(swigCPtr, AlphaFunction.getCPtr(alpha));
822 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
825 internal AlphaFunction GetDefaultAlphaFunction()
827 AlphaFunction ret = new AlphaFunction(NDalicPINVOKE.Animation_GetDefaultAlphaFunction(swigCPtr), true);
828 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
832 internal void SetCurrentProgress(float progress)
834 NDalicPINVOKE.Animation_SetCurrentProgress(swigCPtr, progress);
835 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
838 internal float GetCurrentProgress()
840 float ret = NDalicPINVOKE.Animation_GetCurrentProgress(swigCPtr);
841 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
845 internal void SetSpeedFactor(float factor)
847 NDalicPINVOKE.Animation_SetSpeedFactor(swigCPtr, factor);
848 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
851 internal float GetSpeedFactor()
853 float ret = NDalicPINVOKE.Animation_GetSpeedFactor(swigCPtr);
854 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
858 internal void SetPlayRange(Vector2 range)
860 NDalicPINVOKE.Animation_SetPlayRange(swigCPtr, Vector2.getCPtr(range));
861 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
864 internal Vector2 GetPlayRange()
866 Vector2 ret = new Vector2(NDalicPINVOKE.Animation_GetPlayRange(swigCPtr), true);
867 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
871 private static bool? disableAnimation = null;
872 private bool DisableAnimation
876 if (disableAnimation.HasValue == false)
878 string type = Environment.GetEnvironmentVariable("PlatformSmartType");
880 disableAnimation = true;
882 disableAnimation = false;
884 return disableAnimation.Value;
889 /// Plays the animation.
891 /// <since_tizen> 3 </since_tizen>
894 NDalicPINVOKE.Animation_Play(swigCPtr);
895 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
897 if (DisableAnimation == true)
898 Stop(EndActions.StopFinal);
902 /// Plays the animation from a given point.<br />
903 /// The progress must be in the 0-1 interval or in the play range interval if defined,
904 /// otherwise, it will be ignored.<br />
906 /// <param name="progress">A value between [0,1], or between the play range if specified, from where the animation should start playing.</param>
907 /// <since_tizen> 3 </since_tizen>
908 public void PlayFrom(float progress)
910 NDalicPINVOKE.Animation_PlayFrom(swigCPtr, progress);
911 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
915 /// Plays the animation after a given delay time.<br/>
916 /// The delay time is not included in the looping time.<br/>
917 /// When the delay time is a negative value, it would treat as play immediately.<br/>
919 /// <param name="delayMilliseconds">The delay time.</param>
920 /// <since_tizen> 4 </since_tizen>
921 public void PlayAfter(int delayMilliseconds)
923 NDalicPINVOKE.Animation_PlayAfter(swigCPtr, MilliSecondsToSeconds(delayMilliseconds));
924 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
928 /// Pauses the animation.
930 /// <since_tizen> 3 </since_tizen>
933 NDalicPINVOKE.Animation_Pause(swigCPtr);
934 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
937 internal Animation.States GetState()
939 Animation.States ret = (Animation.States)NDalicPINVOKE.Animation_GetState(swigCPtr);
940 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
945 /// Stops the animation.
947 /// <since_tizen> 3 </since_tizen>
950 NDalicPINVOKE.Animation_Stop(swigCPtr);
951 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
955 /// Clears the animation.<br />
956 /// This disconnects any objects that were being animated, effectively stopping the animation.<br />
958 /// <since_tizen> 3 </since_tizen>
961 NDalicPINVOKE.Animation_Clear(swigCPtr);
962 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
965 internal AnimationSignal FinishedSignal()
967 AnimationSignal ret = new AnimationSignal(NDalicPINVOKE.Animation_FinishedSignal(swigCPtr), false);
968 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
972 internal AnimationSignal ProgressReachedSignal()
974 AnimationSignal ret = new AnimationSignal(NDalicPINVOKE.Animation_ProgressReachedSignal(swigCPtr), false);
975 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
979 internal void AnimateBy(Property target, PropertyValue relativeValue)
981 NDalicPINVOKE.Animation_AnimateBy__SWIG_0(swigCPtr, Property.getCPtr(target), PropertyValue.getCPtr(relativeValue));
982 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
985 internal void AnimateBy(Property target, PropertyValue relativeValue, AlphaFunction alpha)
987 NDalicPINVOKE.Animation_AnimateBy__SWIG_1(swigCPtr, Property.getCPtr(target), PropertyValue.getCPtr(relativeValue), AlphaFunction.getCPtr(alpha));
988 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
991 internal void AnimateBy(Property target, PropertyValue relativeValue, TimePeriod period)
993 NDalicPINVOKE.Animation_AnimateBy__SWIG_2(swigCPtr, Property.getCPtr(target), PropertyValue.getCPtr(relativeValue), TimePeriod.getCPtr(period));
994 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
997 internal void AnimateBy(Property target, PropertyValue relativeValue, AlphaFunction alpha, TimePeriod period)
999 NDalicPINVOKE.Animation_AnimateBy__SWIG_3(swigCPtr, Property.getCPtr(target), PropertyValue.getCPtr(relativeValue), AlphaFunction.getCPtr(alpha), TimePeriod.getCPtr(period));
1000 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1003 internal void AnimateTo(Property target, PropertyValue destinationValue)
1005 NDalicPINVOKE.Animation_AnimateTo__SWIG_0(swigCPtr, Property.getCPtr(target), PropertyValue.getCPtr(destinationValue));
1006 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1009 internal void AnimateTo(Property target, PropertyValue destinationValue, AlphaFunction alpha)
1011 NDalicPINVOKE.Animation_AnimateTo__SWIG_1(swigCPtr, Property.getCPtr(target), PropertyValue.getCPtr(destinationValue), AlphaFunction.getCPtr(alpha));
1012 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1015 internal void AnimateTo(Property target, PropertyValue destinationValue, TimePeriod period)
1017 NDalicPINVOKE.Animation_AnimateTo__SWIG_2(swigCPtr, Property.getCPtr(target), PropertyValue.getCPtr(destinationValue), TimePeriod.getCPtr(period));
1018 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1021 internal void AnimateTo(Property target, PropertyValue destinationValue, AlphaFunction alpha, TimePeriod period)
1023 NDalicPINVOKE.Animation_AnimateTo__SWIG_3(swigCPtr, Property.getCPtr(target), PropertyValue.getCPtr(destinationValue), AlphaFunction.getCPtr(alpha), TimePeriod.getCPtr(period));
1024 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1027 internal void AnimateBetween(Property target, KeyFrames keyFrames)
1029 NDalicPINVOKE.Animation_AnimateBetween__SWIG_0(swigCPtr, Property.getCPtr(target), KeyFrames.getCPtr(keyFrames));
1030 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1033 internal void AnimateBetween(Property target, KeyFrames keyFrames, Animation.Interpolation interpolation)
1035 NDalicPINVOKE.Animation_AnimateBetween__SWIG_1(swigCPtr, Property.getCPtr(target), KeyFrames.getCPtr(keyFrames), (int)interpolation);
1036 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1039 internal void AnimateBetween(Property target, KeyFrames keyFrames, AlphaFunction alpha)
1041 NDalicPINVOKE.Animation_AnimateBetween__SWIG_2(swigCPtr, Property.getCPtr(target), KeyFrames.getCPtr(keyFrames), AlphaFunction.getCPtr(alpha));
1042 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1045 internal void AnimateBetween(Property target, KeyFrames keyFrames, AlphaFunction alpha, Animation.Interpolation interpolation)
1047 NDalicPINVOKE.Animation_AnimateBetween__SWIG_3(swigCPtr, Property.getCPtr(target), KeyFrames.getCPtr(keyFrames), AlphaFunction.getCPtr(alpha), (int)interpolation);
1048 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1051 internal void AnimateBetween(Property target, KeyFrames keyFrames, TimePeriod period)
1053 NDalicPINVOKE.Animation_AnimateBetween__SWIG_4(swigCPtr, Property.getCPtr(target), KeyFrames.getCPtr(keyFrames), TimePeriod.getCPtr(period));
1054 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1057 internal void AnimateBetween(Property target, KeyFrames keyFrames, TimePeriod period, Animation.Interpolation interpolation)
1059 NDalicPINVOKE.Animation_AnimateBetween__SWIG_5(swigCPtr, Property.getCPtr(target), KeyFrames.getCPtr(keyFrames), TimePeriod.getCPtr(period), (int)interpolation);
1060 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1063 internal void AnimateBetween(Property target, KeyFrames keyFrames, AlphaFunction alpha, TimePeriod period)
1065 NDalicPINVOKE.Animation_AnimateBetween__SWIG_6(swigCPtr, Property.getCPtr(target), KeyFrames.getCPtr(keyFrames), AlphaFunction.getCPtr(alpha), TimePeriod.getCPtr(period));
1066 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1069 internal void AnimateBetween(Property target, KeyFrames keyFrames, AlphaFunction alpha, TimePeriod period, Animation.Interpolation interpolation)
1071 NDalicPINVOKE.Animation_AnimateBetween__SWIG_7(swigCPtr, Property.getCPtr(target), KeyFrames.getCPtr(keyFrames), AlphaFunction.getCPtr(alpha), TimePeriod.getCPtr(period), (int)interpolation);
1072 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1075 internal void Animate(View view, Path path, Vector3 forward)
1077 NDalicPINVOKE.Animation_Animate__SWIG_0(swigCPtr, View.getCPtr(view), Path.getCPtr(path), Vector3.getCPtr(forward));
1078 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1081 internal void Animate(View view, Path path, Vector3 forward, AlphaFunction alpha)
1083 NDalicPINVOKE.Animation_Animate__SWIG_1(swigCPtr, View.getCPtr(view), Path.getCPtr(path), Vector3.getCPtr(forward), AlphaFunction.getCPtr(alpha));
1084 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1087 internal void Animate(View view, Path path, Vector3 forward, TimePeriod period)
1089 NDalicPINVOKE.Animation_Animate__SWIG_2(swigCPtr, View.getCPtr(view), Path.getCPtr(path), Vector3.getCPtr(forward), TimePeriod.getCPtr(period));
1090 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1093 internal void Animate(View view, Path path, Vector3 forward, AlphaFunction alpha, TimePeriod period)
1095 NDalicPINVOKE.Animation_Animate__SWIG_3(swigCPtr, View.getCPtr(view), Path.getCPtr(path), Vector3.getCPtr(forward), AlphaFunction.getCPtr(alpha), TimePeriod.getCPtr(period));
1096 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1099 internal void Show(View view, float delaySeconds)
1101 NDalicPINVOKE.Animation_Show(swigCPtr, View.getCPtr(view), delaySeconds);
1102 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1105 internal void Hide(View view, float delaySeconds)
1107 NDalicPINVOKE.Animation_Hide(swigCPtr, View.getCPtr(view), delaySeconds);
1108 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1112 /// Enumeration for what to do when the animation ends, stopped, or destroyed.
1114 /// <since_tizen> 3 </since_tizen>
1115 public enum EndActions
1118 /// When the animation ends, the animated property values are saved.
1122 /// When the animation ends, the animated property values are forgotten.
1126 /// If the animation is stopped, the animated property values are saved as if the animation had run to completion, otherwise behaves like cancel.
1132 /// Enumeration for what interpolation method to use on key-frame animations.
1134 /// <since_tizen> 3 </since_tizen>
1135 public enum Interpolation
1138 /// Values in between key frames are interpolated using a linear polynomial. (Default)
1142 /// Values in between key frames are interpolated using a cubic polynomial.
1148 /// Enumeration for what state the animation is in.
1150 /// <remarks>Calling Reset() on this class will not reset the animation. It will call the BaseHandle.Reset() which drops the object handle.</remarks>
1151 /// <since_tizen> 3 </since_tizen>
1155 /// The animation has stopped.
1159 /// The animation is playing.
1163 /// The animation is paused.