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 /// <since_tizen> 3 </since_tizen>
33 public class Animation : BaseHandle
35 private global::System.Runtime.InteropServices.HandleRef swigCPtr;
37 internal Animation(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicPINVOKE.Animation_SWIGUpcast(cPtr), cMemoryOwn)
39 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
41 _animationFinishedEventCallback = OnFinished;
42 _finishedCallbackOfNative = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate<System.Delegate>(_animationFinishedEventCallback);
45 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Animation obj)
47 return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
51 /// To make animation instance be disposed.
53 /// <since_tizen> 3 </since_tizen>
54 protected override void Dispose(DisposeTypes type)
58 if (_animationFinishedEventCallback != null)
60 FinishedSignal().Disconnect(_finishedCallbackOfNative);
63 if (_animationProgressReachedEventCallback != null)
66 ProgressReachedSignal().Disconnect(_animationProgressReachedEventCallback);
74 if(type == DisposeTypes.Explicit)
77 //Release your own managed resources here.
78 //You should release all of your own disposable objects here.
81 else if(type == DisposeTypes.Implicit)
88 //Release your own unmanaged resources here.
89 //You should not access any managed member here except static instance.
90 //because the execution order of Finalizes is non-deterministic.
92 if (swigCPtr.Handle != global::System.IntPtr.Zero)
97 NDalicPINVOKE.delete_Animation(swigCPtr);
99 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
106 /// Creates an initialized animation.<br />
107 /// The animation will not loop.<br />
108 /// The default end action is "Cancel".<br />
109 /// The default alpha function is linear.<br />
111 /// <remarks>DurationmSeconds must be greater than zero.</remarks>
112 /// <param name="durationMilliSeconds">The duration in milliseconds.</param>
113 /// <since_tizen> 3 </since_tizen>
114 public Animation(int durationMilliSeconds) : this(NDalicPINVOKE.Animation_New((float)durationMilliSeconds / 1000.0f), true)
116 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
119 private AnimationFinishedEventCallbackType _animationFinishedEventCallback;
120 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
121 private delegate void AnimationFinishedEventCallbackType(IntPtr data);
122 private event EventHandler _animationFinishedEventHandler;
124 private System.IntPtr _finishedCallbackOfNative;
127 * @brief Event for the finished signal which can be used to subscribe or unsubscribe the event handler.
128 * The finished signal is emitted when an animation's animations have finished.
130 /// <since_tizen> 3 </since_tizen>
131 public event EventHandler Finished
135 if (_animationFinishedEventHandler == null && disposed == false)
137 FinishedSignal().Connect(_finishedCallbackOfNative);
139 _animationFinishedEventHandler += value;
143 _animationFinishedEventHandler -= value;
145 if (_animationFinishedEventHandler == null && FinishedSignal().Empty() == false)
147 FinishedSignal().Disconnect(_finishedCallbackOfNative);
151 private void OnFinished(IntPtr data)
153 if (_animationFinishedEventHandler != null)
155 //here we send all data to user event handlers
156 _animationFinishedEventHandler(this, null);
160 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
161 private delegate void AnimationProgressReachedEventCallbackType(IntPtr data);
162 private AnimationProgressReachedEventCallbackType _animationProgressReachedEventCallback;
163 private event EventHandler _animationProgressReachedEventHandler;
165 * @brief Event for the ProgressReached signal, which can be used to subscribe or unsubscribe the event handler.
166 * The ProgressReached signal is emitted when the animation has reached a given progress percentage, this is set in the api SetProgressNotification.
168 /// <since_tizen> 3 </since_tizen>
169 public event EventHandler ProgressReached
173 if (_animationProgressReachedEventHandler == null)
175 _animationProgressReachedEventCallback = OnProgressReached;
176 ProgressReachedSignal().Connect(_animationProgressReachedEventCallback);
179 _animationProgressReachedEventHandler += value;
183 _animationProgressReachedEventHandler -= value;
185 if (_animationProgressReachedEventHandler == null && ProgressReachedSignal().Empty() == false)
187 ProgressReachedSignal().Disconnect(_animationProgressReachedEventCallback);
191 private void OnProgressReached(IntPtr data)
193 if (_animationProgressReachedEventHandler != null)
195 //here we send all data to user event handlers
196 _animationProgressReachedEventHandler(this, null);
200 private float MilliSecondsToSeconds(int millisec)
202 return (float)millisec / 1000.0f;
205 private int SecondsToMilliSeconds(float sec)
207 return (int)(sec * 1000);
212 /// Gets or sets the duration in milliseconds of the animation.
214 /// <since_tizen> 3 </since_tizen>
219 SetDuration(MilliSecondsToSeconds(value));
223 return SecondsToMilliSeconds(GetDuration());
228 /// Gets or sets the default alpha function for the animation.
230 /// <since_tizen> 3 </since_tizen>
231 public AlphaFunction DefaultAlphaFunction
235 SetDefaultAlphaFunction(value);
239 AlphaFunction ret = GetDefaultAlphaFunction();
245 /// Queries the state of the animation.
247 /// <since_tizen> 3 </since_tizen>
257 /// Set: Enables looping for a specified number of repeats. A zero is the same as Looping = true; i.e., repeat forever.<br />
258 /// This property resets the looping value and should not be used with the Looping property.<br />
259 /// Setting this parameter does not cause the animation to Play().<br />
260 /// Get: Gets the loop count. A zero is the same as Looping = true; i.e., repeat forever.<br />
261 /// The loop count is initially 1 for play once.<br />
263 /// <since_tizen> 3 </since_tizen>
272 int ret = GetLoopCount();
278 /// Gets or sets the status of whether the animation will loop.<br />
279 /// This property resets the loop count and should not be used with the LoopCount property.<br />
280 /// Setting this parameter does not cause the animation to Play().<br />
282 /// <since_tizen> 3 </since_tizen>
291 bool ret = IsLooping();
298 /// Gets or sets the end action of the animation.<br />
299 /// This action is performed when the animation ends or if it is stopped.<br />
300 /// The default end action is cancel.<br />
302 /// <since_tizen> 3 </since_tizen>
303 public EndActions EndAction
311 return GetEndAction();
317 /// Stops the animation.
319 /// <param name="action">The end action can be set.</param>
320 /// <since_tizen> 3 </since_tizen>
321 public void Stop(EndActions action = EndActions.Cancel)
323 SetEndAction(action);
324 NDalicPINVOKE.Animation_Stop(swigCPtr);
325 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
329 /// Gets the current loop count.<br />
330 /// A value 0 indicating the current loop count when looping.<br />
332 /// <since_tizen> 3 </since_tizen>
333 public int CurrentLoop
337 return GetCurrentLoop();
342 /// Gets or sets the disconnect action.<br />
343 /// If any of the animated property owners are disconnected from the stage while the animation is being played, then this action is performed.<br />
344 /// The default action is cancel.<br />
346 /// <since_tizen> 3 </since_tizen>
347 public EndActions DisconnectAction
351 NDalicPINVOKE.Animation_SetDisconnectAction(swigCPtr, (int)value);
352 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
356 Animation.EndActions ret = (Animation.EndActions)NDalicPINVOKE.Animation_GetDisconnectAction(swigCPtr);
357 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
364 /// Gets or sets the progress of the animation.<br />
365 /// The animation will play (or continue playing) from this point.<br />
366 /// The progress must be in the 0-1 interval or in the play range interval if defined<br />
367 /// otherwise, it will be ignored.<br />
369 /// <since_tizen> 3 </since_tizen>
370 public float CurrentProgress
374 NDalicPINVOKE.Animation_SetCurrentProgress(swigCPtr, value);
375 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
379 float ret = NDalicPINVOKE.Animation_GetCurrentProgress(swigCPtr);
380 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
386 /// Gets or sets specificifications of a speed factor for the animation.<br />
387 /// The speed factor is a multiplier of the normal velocity of the animation.<br />
388 /// Values between [0, 1] will slow down the animation and values above one will speed up the animation.<br />
389 /// It is also possible to specify a negative multiplier to play the animation in reverse.<br />
391 /// <since_tizen> 3 </since_tizen>
392 public float SpeedFactor
396 NDalicPINVOKE.Animation_SetSpeedFactor(swigCPtr, value);
397 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
401 float ret = NDalicPINVOKE.Animation_GetSpeedFactor(swigCPtr);
402 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
408 /// Gets or sets the playing range.<br />
409 /// Animation will play between the values specified. Both values (range.x and range.y ) should be between 0-1,
410 /// otherwise they will be ignored. If the range provided is not in proper order (minimum, maximum ), it will be reordered.<br />
412 /// <since_tizen> 3 </since_tizen>
413 public RelativeVector2 PlayRange
417 NDalicPINVOKE.Animation_SetPlayRange(swigCPtr, Vector2.getCPtr(value));
418 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
422 Vector2 ret = new Vector2(NDalicPINVOKE.Animation_GetPlayRange(swigCPtr), true);
423 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
430 /// Gets or sets the progress notification marker which triggers the ProgressReachedSignal.<br />
431 /// Percentage of animation progress should be greater than 0 and less than 1, for example, 0.3 for 30% <br />
432 /// One notification can be set on each animation.
434 /// <since_tizen> 3 </since_tizen>
435 public float ProgressNotification
439 NDalicPINVOKE.Animation_SetProgressNotification(swigCPtr, value);
440 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
444 float ret = NDalicPINVOKE.Animation_GetProgressNotification(swigCPtr);
445 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
451 /// Animates a property value by a relative amount.<br />
453 /// <param name="target">The target object to animate.</param>
454 /// <param name="property">The target property to animate.</param>
455 /// <param name="relativeValue">The property value will change by this amount.</param>
456 /// <param name="alphaFunction">The alpha function to apply.</param>
457 /// <since_tizen> 3 </since_tizen>
458 public void AnimateBy(View target, string property, object relativeValue, AlphaFunction alphaFunction = null)
460 Property _prop = PropertyHelper.GetPropertyFromString(target, property);
462 PropertyType propertyType = target.GetPropertyType(_prop.propertyIndex);
463 if(propertyType.Equals(PropertyType.Float))
465 System.Type type = relativeValue.GetType();
466 if (type.Equals(typeof(System.Int32)) || type.Equals(typeof(int)))
468 int num = (int)relativeValue;
469 relativeValue = (float)num;
473 PropertyValue val = PropertyValue.CreateFromObject(relativeValue);
475 if (alphaFunction != null)
477 AnimateBy(_prop, val, alphaFunction);
481 AnimateBy(_prop, val);
486 /// Animates a property value by a relative amount.<br />
488 /// <param name="target">The target object to animate.</param>
489 /// <param name="property">The target property to animate.</param>
490 /// <param name="relativeValue">The property value will change by this amount.</param>
491 /// <param name="startTime">The start time of the animation.</param>
492 /// <param name="endTime">The end time of the animation.</param>
493 /// <param name="alphaFunction">The alpha function to apply.</param>
494 /// <since_tizen> 3 </since_tizen>
495 public void AnimateBy(View target, string property, object relativeValue, int startTime, int endTime, AlphaFunction alphaFunction = null)
497 Property _prop = PropertyHelper.GetPropertyFromString(target, property);
499 PropertyType propertyType = target.GetPropertyType(_prop.propertyIndex);
500 if(propertyType.Equals(PropertyType.Float))
502 System.Type type = relativeValue.GetType();
503 if (type.Equals(typeof(System.Int32)) || type.Equals(typeof(int)))
505 int num = (int)relativeValue;
506 relativeValue = (float)num;
510 PropertyValue val = PropertyValue.CreateFromObject(relativeValue);
512 if (alphaFunction != null)
514 Tizen.NUI.TimePeriod time = new Tizen.NUI.TimePeriod(MilliSecondsToSeconds(startTime), MilliSecondsToSeconds(endTime - startTime));
515 AnimateBy(_prop, val, alphaFunction, time);
519 Tizen.NUI.TimePeriod time = new Tizen.NUI.TimePeriod(MilliSecondsToSeconds(startTime), MilliSecondsToSeconds(endTime - startTime));
520 AnimateBy(_prop, val, time);
525 /// Animates a property to a destination value.<br />
527 /// <param name="target">The target object to animate.</param>
528 /// <param name="property">The target property to animate.</param>
529 /// <param name="destinationValue">The destination value.</param>
530 /// <param name="alphaFunction">The alpha function to apply.</param>
531 /// <since_tizen> 3 </since_tizen>
532 public void AnimateTo(View target, string property, object destinationValue, AlphaFunction alphaFunction = null)
534 Property _prop = PropertyHelper.GetPropertyFromString(target, property);
536 PropertyType propertyType = target.GetPropertyType(_prop.propertyIndex);
537 if(propertyType.Equals(PropertyType.Float))
539 System.Type type = destinationValue.GetType();
540 if (type.Equals(typeof(System.Int32)) || type.Equals(typeof(int)))
542 int num = (int)destinationValue;
543 destinationValue = (float)num;
547 PropertyValue val = PropertyValue.CreateFromObject(destinationValue);
549 if (alphaFunction != null)
551 AnimateTo(_prop, val, alphaFunction);
555 AnimateTo(_prop, val);
560 /// Animates a property to a destination value.<br />
562 /// <param name="target">The target object to animate.</param>
563 /// <param name="property">The target property to animate.</param>
564 /// <param name="destinationValue">The destination value.</param>
565 /// <param name="startTime">The start time of the animation.</param>
566 /// <param name="endTime">The end time of the animation.</param>
567 /// <param name="alphaFunction">The alpha function to apply.</param>
568 /// <since_tizen> 3 </since_tizen>
569 public void AnimateTo(View target, string property, object destinationValue, int startTime, int endTime, AlphaFunction alphaFunction = null)
571 Property _prop = PropertyHelper.GetPropertyFromString(target, property);
573 PropertyType propertyType = target.GetPropertyType(_prop.propertyIndex);
574 if(propertyType.Equals(PropertyType.Float))
576 System.Type type = destinationValue.GetType();
577 if (type.Equals(typeof(System.Int32)) || type.Equals(typeof(int)))
579 int num = (int)destinationValue;
580 destinationValue = (float)num;
584 PropertyValue val = PropertyValue.CreateFromObject(destinationValue);
586 if (alphaFunction != null)
588 Tizen.NUI.TimePeriod time = new Tizen.NUI.TimePeriod(MilliSecondsToSeconds(startTime), MilliSecondsToSeconds(endTime - startTime));
589 AnimateTo(_prop, val, alphaFunction, time);
593 Tizen.NUI.TimePeriod time = new Tizen.NUI.TimePeriod(MilliSecondsToSeconds(startTime), MilliSecondsToSeconds(endTime - startTime));
594 AnimateTo(_prop, val, time);
599 /// Animates a property between keyframes.
601 /// <param name="target">The target object to animate.</param>
602 /// <param name="property">The target property to animate.</param>
603 /// <param name="keyFrames">The set of time or value pairs between which to animate.</param>
604 /// <param name="interpolation">The method used to interpolate between values.</param>
605 /// <param name="alphaFunction">The alpha function to apply.</param>
606 /// <since_tizen> 3 </since_tizen>
607 public void AnimateBetween(View target, string property, KeyFrames keyFrames, Interpolation interpolation = Interpolation.Linear, AlphaFunction alphaFunction = null)
609 Property _prop = PropertyHelper.GetPropertyFromString(target, property);
611 if (_prop.propertyIndex == Property.INVALID_INDEX)
613 throw new System.ArgumentException("second argument string property is invalid parameter!");
616 if (alphaFunction != null)
618 AnimateBetween(_prop, keyFrames, alphaFunction, interpolation);
622 AnimateBetween(_prop, keyFrames, interpolation);
628 /// Animates a property between keyframes.
630 /// <param name="target">The target object to animate</param>
631 /// <param name="property">The target property to animate</param>
632 /// <param name="keyFrames">The set of time/value pairs between which to animate</param>
633 /// <param name="startTime">The start time of animation in milliseconds.</param>
634 /// <param name="endTime">The end time of animation in milliseconds.</param>
635 /// <param name="interpolation">The method used to interpolate between values.</param>
636 /// <param name="alphaFunction">The alpha function to apply.</param>
637 /// <since_tizen> 3 </since_tizen>
638 public void AnimateBetween(View target, string property, KeyFrames keyFrames, int startTime, int endTime, Interpolation interpolation = Interpolation.Linear, AlphaFunction alphaFunction = null)
640 Property _prop = PropertyHelper.GetPropertyFromString(target, property);
642 Tizen.NUI.TimePeriod time = new Tizen.NUI.TimePeriod(MilliSecondsToSeconds(startTime), MilliSecondsToSeconds(endTime - startTime));
643 if (alphaFunction != null)
645 AnimateBetween(_prop, keyFrames, alphaFunction, time, interpolation);
649 AnimateBetween(_prop, keyFrames, time, interpolation);
654 /// Animates the view's position and orientation through a predefined path.<br />
655 /// The view will rotate to orient the supplied forward vector with the path's tangent.<br />
656 /// If forward is the zero vector then no rotation will happen.<br />
658 /// <param name="view">The view to animate.</param>
659 /// <param name="path">It defines position and orientation.</param>
660 /// <param name="forward">The vector (in local space coordinate system) will be oriented with the path's tangent direction.</param>
661 /// <param name="alphaFunction">The alpha function to apply.</param>
662 /// <since_tizen> 3 </since_tizen>
663 public void AnimatePath(View view, Path path, Vector3 forward, AlphaFunction alphaFunction = null)
665 if (alphaFunction == null)
667 Animate(view, path, forward);
671 Animate(view, path, forward, alphaFunction);
676 /// Animates the view's position and orientation through a predefined path.<br />
677 /// The view will rotate to orient the supplied forward vector with the path's tangent.<br />
678 /// If forward is the zero vector then no rotation will happen.<br />
680 /// <param name="view">The view to animate.</param>
681 /// <param name="path">It defines position and orientation.</param>
682 /// <param name="forward">The vector (in local space coordinate system) will be oriented with the path's tangent direction.</param>
683 /// <param name="startTime">The start time of the animation.</param>
684 /// <param name="endTime">The end time of the animation.</param>
685 /// <param name="alphaFunction">The alpha function to apply.</param>
686 /// <since_tizen> 3 </since_tizen>
687 public void AnimatePath(View view, Path path, Vector3 forward, int startTime, int endTime, AlphaFunction alphaFunction = null)
689 TimePeriod time = new TimePeriod(MilliSecondsToSeconds(startTime), MilliSecondsToSeconds(endTime - startTime));
690 if (alphaFunction == null)
692 Animate(view, path, forward, time);
696 Animate(view, path, forward, alphaFunction, time);
701 /// Creates an initialized animation.<br />
702 /// The animation will not loop.<br />
703 /// The default end action is "Cancel".<br />
704 /// The default alpha function is linear.<br />
706 /// <since_tizen> 3 </since_tizen>
707 public Animation() : this(NDalicPINVOKE.Animation_New(0.0f), true)
709 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
712 internal Animation(float durationSeconds) : this(NDalicPINVOKE.Animation_New(durationSeconds), true)
714 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
719 /// Downcasts a handle to animation handle.<br />
720 /// If handle points to an animation object, the downcast produces a valid handle.<br />
721 /// If not, the returned handle is left uninitialized.<br />
723 /// <param name="handle">Handle to an object.</param>
724 /// <returns>Handle to an animation object or an uninitialized handle.</returns>
725 /// <since_tizen> 3 </since_tizen>
726 public static Animation DownCast(BaseHandle handle)
728 Animation ret = Registry.GetManagedBaseHandleFromNativePtr(handle) as Animation;
729 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
733 internal Animation(Animation handle) : this(NDalicPINVOKE.new_Animation__SWIG_1(Animation.getCPtr(handle)), true)
735 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
738 internal Animation Assign(Animation rhs)
740 Animation ret = new Animation(NDalicPINVOKE.Animation_Assign(swigCPtr, Animation.getCPtr(rhs)), false);
741 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
745 internal void SetDuration(float seconds)
747 NDalicPINVOKE.Animation_SetDuration(swigCPtr, seconds);
748 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
751 internal float GetDuration()
753 float ret = NDalicPINVOKE.Animation_GetDuration(swigCPtr);
754 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
758 internal void SetLooping(bool looping)
760 NDalicPINVOKE.Animation_SetLooping(swigCPtr, looping);
761 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
764 internal void SetLoopCount(int count)
766 NDalicPINVOKE.Animation_SetLoopCount(swigCPtr, count);
767 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
770 internal int GetLoopCount()
772 int ret = NDalicPINVOKE.Animation_GetLoopCount(swigCPtr);
773 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
777 internal int GetCurrentLoop()
779 int ret = NDalicPINVOKE.Animation_GetCurrentLoop(swigCPtr);
780 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
784 internal bool IsLooping()
786 bool ret = NDalicPINVOKE.Animation_IsLooping(swigCPtr);
787 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
791 internal void SetEndAction(Animation.EndActions action)
793 NDalicPINVOKE.Animation_SetEndAction(swigCPtr, (int)action);
794 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
797 internal Animation.EndActions GetEndAction()
799 Animation.EndActions ret = (Animation.EndActions)NDalicPINVOKE.Animation_GetEndAction(swigCPtr);
800 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
804 internal void SetDisconnectAction(Animation.EndActions disconnectAction)
806 NDalicPINVOKE.Animation_SetDisconnectAction(swigCPtr, (int)disconnectAction);
807 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
810 internal Animation.EndActions GetDisconnectAction()
812 Animation.EndActions ret = (Animation.EndActions)NDalicPINVOKE.Animation_GetDisconnectAction(swigCPtr);
813 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
817 internal void SetDefaultAlphaFunction(AlphaFunction alpha)
819 NDalicPINVOKE.Animation_SetDefaultAlphaFunction(swigCPtr, AlphaFunction.getCPtr(alpha));
820 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
823 internal AlphaFunction GetDefaultAlphaFunction()
825 AlphaFunction ret = new AlphaFunction(NDalicPINVOKE.Animation_GetDefaultAlphaFunction(swigCPtr), true);
826 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
830 internal void SetCurrentProgress(float progress)
832 NDalicPINVOKE.Animation_SetCurrentProgress(swigCPtr, progress);
833 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
836 internal float GetCurrentProgress()
838 float ret = NDalicPINVOKE.Animation_GetCurrentProgress(swigCPtr);
839 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
843 internal void SetSpeedFactor(float factor)
845 NDalicPINVOKE.Animation_SetSpeedFactor(swigCPtr, factor);
846 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
849 internal float GetSpeedFactor()
851 float ret = NDalicPINVOKE.Animation_GetSpeedFactor(swigCPtr);
852 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
856 internal void SetPlayRange(Vector2 range)
858 NDalicPINVOKE.Animation_SetPlayRange(swigCPtr, Vector2.getCPtr(range));
859 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
862 internal Vector2 GetPlayRange()
864 Vector2 ret = new Vector2(NDalicPINVOKE.Animation_GetPlayRange(swigCPtr), true);
865 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
869 private static bool? disableAnimation = null;
870 private bool DisableAnimation
874 if (disableAnimation.HasValue == false)
876 string type = Environment.GetEnvironmentVariable("PlatformSmartType");
878 disableAnimation = true;
880 disableAnimation = false;
882 return disableAnimation.Value;
887 /// Plays the animation.
889 /// <since_tizen> 3 </since_tizen>
892 NDalicPINVOKE.Animation_Play(swigCPtr);
893 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
895 if (DisableAnimation == true)
896 Stop(EndActions.StopFinal);
900 /// Plays the animation from a given point.<br />
901 /// The progress must be in the 0-1 interval or in the play range interval if defined,
902 /// otherwise, it will be ignored.<br />
904 /// <param name="progress">A value between [0,1], or between the play range if specified, from where the animation should start playing.</param>
905 /// <since_tizen> 3 </since_tizen>
906 public void PlayFrom(float progress)
908 NDalicPINVOKE.Animation_PlayFrom(swigCPtr, progress);
909 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
913 /// Plays the animation after a given delay time.<br/>
914 /// The delay time is not included in the looping time.<br/>
915 /// When the delay time is a negative value, it would treat as play immediately.<br/>
917 /// <param name="delayMilliseconds">The delay time.</param>
918 /// <since_tizen> 4 </since_tizen>
919 public void PlayAfter(int delayMilliseconds)
921 NDalicPINVOKE.Animation_PlayAfter(swigCPtr, MilliSecondsToSeconds(delayMilliseconds));
922 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
926 /// Pauses the animation.
928 /// <since_tizen> 3 </since_tizen>
931 NDalicPINVOKE.Animation_Pause(swigCPtr);
932 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
935 internal Animation.States GetState()
937 Animation.States ret = (Animation.States)NDalicPINVOKE.Animation_GetState(swigCPtr);
938 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
943 /// Stops the animation.
945 /// <since_tizen> 3 </since_tizen>
948 NDalicPINVOKE.Animation_Stop(swigCPtr);
949 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
953 /// Clears the animation.<br />
954 /// This disconnects any objects that were being animated, effectively stopping the animation.<br />
956 /// <since_tizen> 3 </since_tizen>
959 NDalicPINVOKE.Animation_Clear(swigCPtr);
960 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
963 internal AnimationSignal FinishedSignal()
965 AnimationSignal ret = new AnimationSignal(NDalicPINVOKE.Animation_FinishedSignal(swigCPtr), false);
966 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
970 internal AnimationSignal ProgressReachedSignal()
972 AnimationSignal ret = new AnimationSignal(NDalicPINVOKE.Animation_ProgressReachedSignal(swigCPtr), false);
973 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
977 internal void AnimateBy(Property target, PropertyValue relativeValue)
979 NDalicPINVOKE.Animation_AnimateBy__SWIG_0(swigCPtr, Property.getCPtr(target), PropertyValue.getCPtr(relativeValue));
980 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
983 internal void AnimateBy(Property target, PropertyValue relativeValue, AlphaFunction alpha)
985 NDalicPINVOKE.Animation_AnimateBy__SWIG_1(swigCPtr, Property.getCPtr(target), PropertyValue.getCPtr(relativeValue), AlphaFunction.getCPtr(alpha));
986 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
989 internal void AnimateBy(Property target, PropertyValue relativeValue, TimePeriod period)
991 NDalicPINVOKE.Animation_AnimateBy__SWIG_2(swigCPtr, Property.getCPtr(target), PropertyValue.getCPtr(relativeValue), TimePeriod.getCPtr(period));
992 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
995 internal void AnimateBy(Property target, PropertyValue relativeValue, AlphaFunction alpha, TimePeriod period)
997 NDalicPINVOKE.Animation_AnimateBy__SWIG_3(swigCPtr, Property.getCPtr(target), PropertyValue.getCPtr(relativeValue), AlphaFunction.getCPtr(alpha), TimePeriod.getCPtr(period));
998 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1001 internal void AnimateTo(Property target, PropertyValue destinationValue)
1003 NDalicPINVOKE.Animation_AnimateTo__SWIG_0(swigCPtr, Property.getCPtr(target), PropertyValue.getCPtr(destinationValue));
1004 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1007 internal void AnimateTo(Property target, PropertyValue destinationValue, AlphaFunction alpha)
1009 NDalicPINVOKE.Animation_AnimateTo__SWIG_1(swigCPtr, Property.getCPtr(target), PropertyValue.getCPtr(destinationValue), AlphaFunction.getCPtr(alpha));
1010 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1013 internal void AnimateTo(Property target, PropertyValue destinationValue, TimePeriod period)
1015 NDalicPINVOKE.Animation_AnimateTo__SWIG_2(swigCPtr, Property.getCPtr(target), PropertyValue.getCPtr(destinationValue), TimePeriod.getCPtr(period));
1016 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1019 internal void AnimateTo(Property target, PropertyValue destinationValue, AlphaFunction alpha, TimePeriod period)
1021 NDalicPINVOKE.Animation_AnimateTo__SWIG_3(swigCPtr, Property.getCPtr(target), PropertyValue.getCPtr(destinationValue), AlphaFunction.getCPtr(alpha), TimePeriod.getCPtr(period));
1022 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1025 internal void AnimateBetween(Property target, KeyFrames keyFrames)
1027 NDalicPINVOKE.Animation_AnimateBetween__SWIG_0(swigCPtr, Property.getCPtr(target), KeyFrames.getCPtr(keyFrames));
1028 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1031 internal void AnimateBetween(Property target, KeyFrames keyFrames, Animation.Interpolation interpolation)
1033 NDalicPINVOKE.Animation_AnimateBetween__SWIG_1(swigCPtr, Property.getCPtr(target), KeyFrames.getCPtr(keyFrames), (int)interpolation);
1034 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1037 internal void AnimateBetween(Property target, KeyFrames keyFrames, AlphaFunction alpha)
1039 NDalicPINVOKE.Animation_AnimateBetween__SWIG_2(swigCPtr, Property.getCPtr(target), KeyFrames.getCPtr(keyFrames), AlphaFunction.getCPtr(alpha));
1040 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1043 internal void AnimateBetween(Property target, KeyFrames keyFrames, AlphaFunction alpha, Animation.Interpolation interpolation)
1045 NDalicPINVOKE.Animation_AnimateBetween__SWIG_3(swigCPtr, Property.getCPtr(target), KeyFrames.getCPtr(keyFrames), AlphaFunction.getCPtr(alpha), (int)interpolation);
1046 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1049 internal void AnimateBetween(Property target, KeyFrames keyFrames, TimePeriod period)
1051 NDalicPINVOKE.Animation_AnimateBetween__SWIG_4(swigCPtr, Property.getCPtr(target), KeyFrames.getCPtr(keyFrames), TimePeriod.getCPtr(period));
1052 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1055 internal void AnimateBetween(Property target, KeyFrames keyFrames, TimePeriod period, Animation.Interpolation interpolation)
1057 NDalicPINVOKE.Animation_AnimateBetween__SWIG_5(swigCPtr, Property.getCPtr(target), KeyFrames.getCPtr(keyFrames), TimePeriod.getCPtr(period), (int)interpolation);
1058 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1061 internal void AnimateBetween(Property target, KeyFrames keyFrames, AlphaFunction alpha, TimePeriod period)
1063 NDalicPINVOKE.Animation_AnimateBetween__SWIG_6(swigCPtr, Property.getCPtr(target), KeyFrames.getCPtr(keyFrames), AlphaFunction.getCPtr(alpha), TimePeriod.getCPtr(period));
1064 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1067 internal void AnimateBetween(Property target, KeyFrames keyFrames, AlphaFunction alpha, TimePeriod period, Animation.Interpolation interpolation)
1069 NDalicPINVOKE.Animation_AnimateBetween__SWIG_7(swigCPtr, Property.getCPtr(target), KeyFrames.getCPtr(keyFrames), AlphaFunction.getCPtr(alpha), TimePeriod.getCPtr(period), (int)interpolation);
1070 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1073 internal void Animate(View view, Path path, Vector3 forward)
1075 NDalicPINVOKE.Animation_Animate__SWIG_0(swigCPtr, View.getCPtr(view), Path.getCPtr(path), Vector3.getCPtr(forward));
1076 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1079 internal void Animate(View view, Path path, Vector3 forward, AlphaFunction alpha)
1081 NDalicPINVOKE.Animation_Animate__SWIG_1(swigCPtr, View.getCPtr(view), Path.getCPtr(path), Vector3.getCPtr(forward), AlphaFunction.getCPtr(alpha));
1082 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1085 internal void Animate(View view, Path path, Vector3 forward, TimePeriod period)
1087 NDalicPINVOKE.Animation_Animate__SWIG_2(swigCPtr, View.getCPtr(view), Path.getCPtr(path), Vector3.getCPtr(forward), TimePeriod.getCPtr(period));
1088 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1091 internal void Animate(View view, Path path, Vector3 forward, AlphaFunction alpha, TimePeriod period)
1093 NDalicPINVOKE.Animation_Animate__SWIG_3(swigCPtr, View.getCPtr(view), Path.getCPtr(path), Vector3.getCPtr(forward), AlphaFunction.getCPtr(alpha), TimePeriod.getCPtr(period));
1094 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1097 internal void Show(View view, float delaySeconds)
1099 NDalicPINVOKE.Animation_Show(swigCPtr, View.getCPtr(view), delaySeconds);
1100 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1103 internal void Hide(View view, float delaySeconds)
1105 NDalicPINVOKE.Animation_Hide(swigCPtr, View.getCPtr(view), delaySeconds);
1106 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1110 /// Enumeration for what to do when the animation ends, stopped, or destroyed.
1112 /// <since_tizen> 3 </since_tizen>
1113 public enum EndActions
1116 /// When the animation ends, the animated property values are saved.
1120 /// When the animation ends, the animated property values are forgotten.
1124 /// If the animation is stopped, the animated property values are saved as if the animation had run to completion, otherwise behaves like cancel.
1130 /// Enumeration for what interpolation method to use on key-frame animations.
1132 /// <since_tizen> 3 </since_tizen>
1133 public enum Interpolation
1136 /// Values in between key frames are interpolated using a linear polynomial. (Default)
1140 /// Values in between key frames are interpolated using a cubic polynomial.
1146 /// Enumeration for what state the animation is in.
1148 /// <remarks>Calling Reset() on this class will not reset the animation. It will call the BaseHandle.Reset() which drops the object handle.</remarks>
1149 /// <since_tizen> 3 </since_tizen>
1153 /// The animation has stopped.
1157 /// The animation is playing.
1161 /// The animation is paused.