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)
90 //throw new System.InvalidOperationException("Animation Instance should not be disposed until getting Finished event. Should be a global variable");
93 //Release your own unmanaged resources here.
94 //You should not access any managed member here except static instance.
95 //because the execution order of Finalizes is non-deterministic.
97 if (swigCPtr.Handle != global::System.IntPtr.Zero)
102 NDalicPINVOKE.delete_Animation(swigCPtr);
104 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
111 /// Creates an initialized animation.<br />
112 /// The animation will not loop.<br />
113 /// The default end action is "Cancel".<br />
114 /// The default alpha function is linear.<br />
116 /// <remarks>DurationmSeconds must be greater than zero.</remarks>
117 /// <param name="durationMilliSeconds">The duration in milliseconds.</param>
118 /// <since_tizen> 3 </since_tizen>
119 public Animation(int durationMilliSeconds) : this(NDalicPINVOKE.Animation_New((float)durationMilliSeconds / 1000.0f), true)
121 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
124 private AnimationFinishedEventCallbackType _animationFinishedEventCallback;
125 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
126 private delegate void AnimationFinishedEventCallbackType(IntPtr data);
127 private event EventHandler _animationFinishedEventHandler;
129 private System.IntPtr _finishedCallbackOfNative;
132 * @brief Event for the finished signal which can be used to subscribe or unsubscribe the event handler.
133 * The finished signal is emitted when an animation's animations have finished.
135 /// <since_tizen> 3 </since_tizen>
136 public event EventHandler Finished
140 if (_animationFinishedEventHandler == null && disposed == false)
142 FinishedSignal().Connect(_finishedCallbackOfNative);
144 _animationFinishedEventHandler += value;
148 _animationFinishedEventHandler -= value;
150 if (_animationFinishedEventHandler == null && FinishedSignal().Empty() == false)
152 FinishedSignal().Disconnect(_finishedCallbackOfNative);
156 private void OnFinished(IntPtr data)
158 if (_animationFinishedEventHandler != null)
160 //here we send all data to user event handlers
161 _animationFinishedEventHandler(this, null);
165 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
166 private delegate void AnimationProgressReachedEventCallbackType(IntPtr data);
167 private AnimationProgressReachedEventCallbackType _animationProgressReachedEventCallback;
168 private event EventHandler _animationProgressReachedEventHandler;
170 * @brief Event for the ProgressReached signal, which can be used to subscribe or unsubscribe the event handler.
171 * The ProgressReached signal is emitted when the animation has reached a given progress percentage, this is set in the api SetProgressNotification.
173 /// <since_tizen> 3 </since_tizen>
174 public event EventHandler ProgressReached
178 if (_animationProgressReachedEventHandler == null)
180 _animationProgressReachedEventCallback = OnProgressReached;
181 ProgressReachedSignal().Connect(_animationProgressReachedEventCallback);
184 _animationProgressReachedEventHandler += value;
188 _animationProgressReachedEventHandler -= value;
190 if (_animationProgressReachedEventHandler == null && ProgressReachedSignal().Empty() == false)
192 ProgressReachedSignal().Disconnect(_animationProgressReachedEventCallback);
196 private void OnProgressReached(IntPtr data)
198 if (_animationProgressReachedEventHandler != null)
200 //here we send all data to user event handlers
201 _animationProgressReachedEventHandler(this, null);
205 private float MilliSecondsToSeconds(int millisec)
207 return (float)millisec / 1000.0f;
210 private int SecondsToMilliSeconds(float sec)
212 return (int)(sec * 1000);
217 /// Gets or sets the duration in milliseconds of the animation.
219 /// <since_tizen> 3 </since_tizen>
224 SetDuration(MilliSecondsToSeconds(value));
228 return SecondsToMilliSeconds(GetDuration());
233 /// Gets or sets the default alpha function for the animation.
235 /// <since_tizen> 3 </since_tizen>
236 public AlphaFunction DefaultAlphaFunction
240 SetDefaultAlphaFunction(value);
244 AlphaFunction ret = GetDefaultAlphaFunction();
250 /// Queries the state of the animation.
252 /// <since_tizen> 3 </since_tizen>
262 /// Set: Enables looping for a specified number of repeats. A zero is the same as Looping = true; i.e., repeat forever.<br />
263 /// This property resets the looping value and should not be used with the Looping property.<br />
264 /// Setting this parameter does not cause the animation to Play().<br />
265 /// Get: Gets the loop count. A zero is the same as Looping = true; i.e., repeat forever.<br />
266 /// The loop count is initially 1 for play once.<br />
268 /// <since_tizen> 3 </since_tizen>
277 int ret = GetLoopCount();
283 /// Gets or sets the status of whether the animation will loop.<br />
284 /// This property resets the loop count and should not be used with the LoopCount property.<br />
285 /// Setting this parameter does not cause the animation to Play().<br />
287 /// <since_tizen> 3 </since_tizen>
296 bool ret = IsLooping();
303 /// Gets or sets the end action of the animation.<br />
304 /// This action is performed when the animation ends or if it is stopped.<br />
305 /// The default end action is cancel.<br />
307 /// <since_tizen> 3 </since_tizen>
308 public EndActions EndAction
316 return GetEndAction();
322 /// Stops the animation.
324 /// <param name="action">The end action can be set.</param>
325 /// <since_tizen> 3 </since_tizen>
326 public void Stop(EndActions action = EndActions.Cancel)
328 SetEndAction(action);
329 NDalicPINVOKE.Animation_Stop(swigCPtr);
330 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
334 /// Gets the current loop count.<br />
335 /// A value 0 indicating the current loop count when looping.<br />
337 /// <since_tizen> 3 </since_tizen>
338 public int CurrentLoop
342 return GetCurrentLoop();
347 /// Gets or sets the disconnect action.<br />
348 /// If any of the animated property owners are disconnected from the stage while the animation is being played, then this action is performed.<br />
349 /// The default action is cancel.<br />
351 /// <since_tizen> 3 </since_tizen>
352 public EndActions DisconnectAction
356 NDalicPINVOKE.Animation_SetDisconnectAction(swigCPtr, (int)value);
357 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
361 Animation.EndActions ret = (Animation.EndActions)NDalicPINVOKE.Animation_GetDisconnectAction(swigCPtr);
362 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
369 /// Gets or sets the progress of the animation.<br />
370 /// The animation will play (or continue playing) from this point.<br />
371 /// The progress must be in the 0-1 interval or in the play range interval if defined<br />
372 /// otherwise, it will be ignored.<br />
374 /// <since_tizen> 3 </since_tizen>
375 public float CurrentProgress
379 NDalicPINVOKE.Animation_SetCurrentProgress(swigCPtr, value);
380 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
384 float ret = NDalicPINVOKE.Animation_GetCurrentProgress(swigCPtr);
385 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
391 /// Gets or sets specificifications of a speed factor for the animation.<br />
392 /// The speed factor is a multiplier of the normal velocity of the animation.<br />
393 /// Values between [0, 1] will slow down the animation and values above one will speed up the animation.<br />
394 /// It is also possible to specify a negative multiplier to play the animation in reverse.<br />
396 /// <since_tizen> 3 </since_tizen>
397 public float SpeedFactor
401 NDalicPINVOKE.Animation_SetSpeedFactor(swigCPtr, value);
402 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
406 float ret = NDalicPINVOKE.Animation_GetSpeedFactor(swigCPtr);
407 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
413 /// Gets or sets the playing range.<br />
414 /// Animation will play between the values specified. Both values (range.x and range.y ) should be between 0-1,
415 /// otherwise they will be ignored. If the range provided is not in proper order (minimum, maximum ), it will be reordered.<br />
417 /// <since_tizen> 3 </since_tizen>
418 public RelativeVector2 PlayRange
422 NDalicPINVOKE.Animation_SetPlayRange(swigCPtr, Vector2.getCPtr(value));
423 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
427 Vector2 ret = new Vector2(NDalicPINVOKE.Animation_GetPlayRange(swigCPtr), true);
428 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
435 /// Gets or sets the progress notification marker which triggers the ProgressReachedSignal.<br />
436 /// Percentage of animation progress should be greater than 0 and less than 1, for example, 0.3 for 30% <br />
437 /// One notification can be set on each animation.
439 /// <since_tizen> 3 </since_tizen>
440 public float ProgressNotification
444 NDalicPINVOKE.Animation_SetProgressNotification(swigCPtr, value);
445 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
449 float ret = NDalicPINVOKE.Animation_GetProgressNotification(swigCPtr);
450 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
456 /// Animates a property value by a relative amount.<br />
458 /// <param name="target">The target object to animate.</param>
459 /// <param name="property">The target property to animate.</param>
460 /// <param name="relativeValue">The property value will change by this amount.</param>
461 /// <param name="alphaFunction">The alpha function to apply.</param>
462 /// <since_tizen> 3 </since_tizen>
463 public void AnimateBy(View target, string property, object relativeValue, AlphaFunction alphaFunction = null)
465 Property _prop = PropertyHelper.GetPropertyFromString(target, property);
467 PropertyType propertyType = target.GetPropertyType(_prop.propertyIndex);
468 if(propertyType.Equals(PropertyType.Float))
470 System.Type type = relativeValue.GetType();
471 if (type.Equals(typeof(System.Int32)) || type.Equals(typeof(int)))
473 int num = (int)relativeValue;
474 relativeValue = (float)num;
478 PropertyValue val = PropertyValue.CreateFromObject(relativeValue);
480 if (alphaFunction != null)
482 AnimateBy(_prop, val, alphaFunction);
486 AnimateBy(_prop, val);
491 /// Animates a property value by a relative amount.<br />
493 /// <param name="target">The target object to animate.</param>
494 /// <param name="property">The target property to animate.</param>
495 /// <param name="relativeValue">The property value will change by this amount.</param>
496 /// <param name="startTime">The start time of the animation.</param>
497 /// <param name="endTime">The end time of the animation.</param>
498 /// <param name="alphaFunction">The alpha function to apply.</param>
499 /// <since_tizen> 3 </since_tizen>
500 public void AnimateBy(View target, string property, object relativeValue, int startTime, int endTime, AlphaFunction alphaFunction = null)
502 Property _prop = PropertyHelper.GetPropertyFromString(target, property);
504 PropertyType propertyType = target.GetPropertyType(_prop.propertyIndex);
505 if(propertyType.Equals(PropertyType.Float))
507 System.Type type = relativeValue.GetType();
508 if (type.Equals(typeof(System.Int32)) || type.Equals(typeof(int)))
510 int num = (int)relativeValue;
511 relativeValue = (float)num;
515 PropertyValue val = PropertyValue.CreateFromObject(relativeValue);
517 if (alphaFunction != null)
519 Tizen.NUI.TimePeriod time = new Tizen.NUI.TimePeriod(MilliSecondsToSeconds(startTime), MilliSecondsToSeconds(endTime - startTime));
520 AnimateBy(_prop, val, alphaFunction, time);
524 Tizen.NUI.TimePeriod time = new Tizen.NUI.TimePeriod(MilliSecondsToSeconds(startTime), MilliSecondsToSeconds(endTime - startTime));
525 AnimateBy(_prop, val, time);
530 /// Animates a property to a destination value.<br />
532 /// <param name="target">The target object to animate.</param>
533 /// <param name="property">The target property to animate.</param>
534 /// <param name="destinationValue">The destination value.</param>
535 /// <param name="alphaFunction">The alpha function to apply.</param>
536 /// <since_tizen> 3 </since_tizen>
537 public void AnimateTo(View target, string property, object destinationValue, AlphaFunction alphaFunction = null)
539 Property _prop = PropertyHelper.GetPropertyFromString(target, property);
541 PropertyType propertyType = target.GetPropertyType(_prop.propertyIndex);
542 if(propertyType.Equals(PropertyType.Float))
544 System.Type type = destinationValue.GetType();
545 if (type.Equals(typeof(System.Int32)) || type.Equals(typeof(int)))
547 int num = (int)destinationValue;
548 destinationValue = (float)num;
552 PropertyValue val = PropertyValue.CreateFromObject(destinationValue);
554 if (alphaFunction != null)
556 AnimateTo(_prop, val, alphaFunction);
560 AnimateTo(_prop, val);
565 /// Animates a property to a destination value.<br />
567 /// <param name="target">The target object to animate.</param>
568 /// <param name="property">The target property to animate.</param>
569 /// <param name="destinationValue">The destination value.</param>
570 /// <param name="startTime">The start time of the animation.</param>
571 /// <param name="endTime">The end time of the animation.</param>
572 /// <param name="alphaFunction">The alpha function to apply.</param>
573 /// <since_tizen> 3 </since_tizen>
574 public void AnimateTo(View target, string property, object destinationValue, int startTime, int endTime, AlphaFunction alphaFunction = null)
576 Property _prop = PropertyHelper.GetPropertyFromString(target, property);
578 PropertyType propertyType = target.GetPropertyType(_prop.propertyIndex);
579 if(propertyType.Equals(PropertyType.Float))
581 System.Type type = destinationValue.GetType();
582 if (type.Equals(typeof(System.Int32)) || type.Equals(typeof(int)))
584 int num = (int)destinationValue;
585 destinationValue = (float)num;
589 PropertyValue val = PropertyValue.CreateFromObject(destinationValue);
591 if (alphaFunction != null)
593 Tizen.NUI.TimePeriod time = new Tizen.NUI.TimePeriod(MilliSecondsToSeconds(startTime), MilliSecondsToSeconds(endTime - startTime));
594 AnimateTo(_prop, val, alphaFunction, time);
598 Tizen.NUI.TimePeriod time = new Tizen.NUI.TimePeriod(MilliSecondsToSeconds(startTime), MilliSecondsToSeconds(endTime - startTime));
599 AnimateTo(_prop, val, time);
604 /// Animates a property between keyframes.
606 /// <param name="target">The target object to animate.</param>
607 /// <param name="property">The target property to animate.</param>
608 /// <param name="keyFrames">The set of time or value pairs between which to animate.</param>
609 /// <param name="interpolation">The method used to interpolate between values.</param>
610 /// <param name="alphaFunction">The alpha function to apply.</param>
611 /// <since_tizen> 3 </since_tizen>
612 public void AnimateBetween(View target, string property, KeyFrames keyFrames, Interpolation interpolation = Interpolation.Linear, AlphaFunction alphaFunction = null)
614 Property _prop = PropertyHelper.GetPropertyFromString(target, property);
616 if (_prop.propertyIndex == Property.INVALID_INDEX)
618 throw new System.ArgumentException("second argument string property is invalid parameter!");
621 if (alphaFunction != null)
623 AnimateBetween(_prop, keyFrames, alphaFunction, interpolation);
627 AnimateBetween(_prop, keyFrames, interpolation);
633 /// Animates a property between keyframes.
635 /// <param name="target">The target object to animate</param>
636 /// <param name="property">The target property to animate</param>
637 /// <param name="keyFrames">The set of time/value pairs between which to animate</param>
638 /// <param name="startTime">The start time of animation in milliseconds.</param>
639 /// <param name="endTime">The end time of animation in milliseconds.</param>
640 /// <param name="interpolation">The method used to interpolate between values.</param>
641 /// <param name="alphaFunction">The alpha function to apply.</param>
642 /// <since_tizen> 3 </since_tizen>
643 public void AnimateBetween(View target, string property, KeyFrames keyFrames, int startTime, int endTime, Interpolation interpolation = Interpolation.Linear, AlphaFunction alphaFunction = null)
645 Property _prop = PropertyHelper.GetPropertyFromString(target, property);
647 Tizen.NUI.TimePeriod time = new Tizen.NUI.TimePeriod(MilliSecondsToSeconds(startTime), MilliSecondsToSeconds(endTime - startTime));
648 if (alphaFunction != null)
650 AnimateBetween(_prop, keyFrames, alphaFunction, time, interpolation);
654 AnimateBetween(_prop, keyFrames, time, interpolation);
659 /// Animates the view's position and orientation through a predefined path.<br />
660 /// The view will rotate to orient the supplied forward vector with the path's tangent.<br />
661 /// If forward is the zero vector then no rotation will happen.<br />
663 /// <param name="view">The view to animate.</param>
664 /// <param name="path">It defines position and orientation.</param>
665 /// <param name="forward">The vector (in local space coordinate system) will be oriented with the path's tangent direction.</param>
666 /// <param name="alphaFunction">The alpha function to apply.</param>
667 /// <since_tizen> 3 </since_tizen>
668 public void AnimatePath(View view, Path path, Vector3 forward, AlphaFunction alphaFunction = null)
670 if (alphaFunction == null)
672 Animate(view, path, forward);
676 Animate(view, path, forward, alphaFunction);
681 /// Animates the view's position and orientation through a predefined path.<br />
682 /// The view will rotate to orient the supplied forward vector with the path's tangent.<br />
683 /// If forward is the zero vector then no rotation will happen.<br />
685 /// <param name="view">The view to animate.</param>
686 /// <param name="path">It defines position and orientation.</param>
687 /// <param name="forward">The vector (in local space coordinate system) will be oriented with the path's tangent direction.</param>
688 /// <param name="startTime">The start time of the animation.</param>
689 /// <param name="endTime">The end time of the animation.</param>
690 /// <param name="alphaFunction">The alpha function to apply.</param>
691 /// <since_tizen> 3 </since_tizen>
692 public void AnimatePath(View view, Path path, Vector3 forward, int startTime, int endTime, AlphaFunction alphaFunction = null)
694 TimePeriod time = new TimePeriod(MilliSecondsToSeconds(startTime), MilliSecondsToSeconds(endTime - startTime));
695 if (alphaFunction == null)
697 Animate(view, path, forward, time);
701 Animate(view, path, forward, alphaFunction, time);
706 /// Creates an initialized animation.<br />
707 /// The animation will not loop.<br />
708 /// The default end action is "Cancel".<br />
709 /// The default alpha function is linear.<br />
711 /// <since_tizen> 3 </since_tizen>
712 public Animation() : this(NDalicPINVOKE.Animation_New(0.0f), true)
714 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
717 internal Animation(float durationSeconds) : this(NDalicPINVOKE.Animation_New(durationSeconds), true)
719 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
724 /// Downcasts a handle to animation handle.<br />
725 /// If handle points to an animation object, the downcast produces a valid handle.<br />
726 /// If not, the returned handle is left uninitialized.<br />
728 /// <param name="handle">Handle to an object.</param>
729 /// <returns>Handle to an animation object or an uninitialized handle.</returns>
730 /// <since_tizen> 3 </since_tizen>
731 public static Animation DownCast(BaseHandle handle)
733 Animation ret = Registry.GetManagedBaseHandleFromNativePtr(handle) as Animation;
734 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
738 internal Animation(Animation handle) : this(NDalicPINVOKE.new_Animation__SWIG_1(Animation.getCPtr(handle)), true)
740 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
743 internal Animation Assign(Animation rhs)
745 Animation ret = new Animation(NDalicPINVOKE.Animation_Assign(swigCPtr, Animation.getCPtr(rhs)), false);
746 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
750 internal void SetDuration(float seconds)
752 NDalicPINVOKE.Animation_SetDuration(swigCPtr, seconds);
753 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
756 internal float GetDuration()
758 float ret = NDalicPINVOKE.Animation_GetDuration(swigCPtr);
759 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
763 internal void SetLooping(bool looping)
765 NDalicPINVOKE.Animation_SetLooping(swigCPtr, looping);
766 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
769 internal void SetLoopCount(int count)
771 NDalicPINVOKE.Animation_SetLoopCount(swigCPtr, count);
772 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
775 internal int GetLoopCount()
777 int ret = NDalicPINVOKE.Animation_GetLoopCount(swigCPtr);
778 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
782 internal int GetCurrentLoop()
784 int ret = NDalicPINVOKE.Animation_GetCurrentLoop(swigCPtr);
785 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
789 internal bool IsLooping()
791 bool ret = NDalicPINVOKE.Animation_IsLooping(swigCPtr);
792 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
796 internal void SetEndAction(Animation.EndActions action)
798 NDalicPINVOKE.Animation_SetEndAction(swigCPtr, (int)action);
799 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
802 internal Animation.EndActions GetEndAction()
804 Animation.EndActions ret = (Animation.EndActions)NDalicPINVOKE.Animation_GetEndAction(swigCPtr);
805 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
809 internal void SetDisconnectAction(Animation.EndActions disconnectAction)
811 NDalicPINVOKE.Animation_SetDisconnectAction(swigCPtr, (int)disconnectAction);
812 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
815 internal Animation.EndActions GetDisconnectAction()
817 Animation.EndActions ret = (Animation.EndActions)NDalicPINVOKE.Animation_GetDisconnectAction(swigCPtr);
818 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
822 internal void SetDefaultAlphaFunction(AlphaFunction alpha)
824 NDalicPINVOKE.Animation_SetDefaultAlphaFunction(swigCPtr, AlphaFunction.getCPtr(alpha));
825 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
828 internal AlphaFunction GetDefaultAlphaFunction()
830 AlphaFunction ret = new AlphaFunction(NDalicPINVOKE.Animation_GetDefaultAlphaFunction(swigCPtr), true);
831 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
835 internal void SetCurrentProgress(float progress)
837 NDalicPINVOKE.Animation_SetCurrentProgress(swigCPtr, progress);
838 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
841 internal float GetCurrentProgress()
843 float ret = NDalicPINVOKE.Animation_GetCurrentProgress(swigCPtr);
844 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
848 internal void SetSpeedFactor(float factor)
850 NDalicPINVOKE.Animation_SetSpeedFactor(swigCPtr, factor);
851 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
854 internal float GetSpeedFactor()
856 float ret = NDalicPINVOKE.Animation_GetSpeedFactor(swigCPtr);
857 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
861 internal void SetPlayRange(Vector2 range)
863 NDalicPINVOKE.Animation_SetPlayRange(swigCPtr, Vector2.getCPtr(range));
864 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
867 internal Vector2 GetPlayRange()
869 Vector2 ret = new Vector2(NDalicPINVOKE.Animation_GetPlayRange(swigCPtr), true);
870 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
874 private static bool? disableAnimation = null;
875 private bool DisableAnimation
879 if (disableAnimation.HasValue == false)
881 string type = Environment.GetEnvironmentVariable("PlatformSmartType");
883 disableAnimation = true;
885 disableAnimation = false;
887 return disableAnimation.Value;
892 /// Plays the animation.
894 /// <since_tizen> 3 </since_tizen>
897 NDalicPINVOKE.Animation_Play(swigCPtr);
898 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
900 if (DisableAnimation == true)
901 Stop(EndActions.StopFinal);
905 /// Plays the animation from a given point.<br />
906 /// The progress must be in the 0-1 interval or in the play range interval if defined,
907 /// otherwise, it will be ignored.<br />
909 /// <param name="progress">A value between [0,1], or between the play range if specified, from where the animation should start playing.</param>
910 /// <since_tizen> 3 </since_tizen>
911 public void PlayFrom(float progress)
913 NDalicPINVOKE.Animation_PlayFrom(swigCPtr, progress);
914 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
918 /// Plays the animation after a given delay time.<br/>
919 /// The delay time is not included in the looping time.<br/>
920 /// When the delay time is a negative value, it would treat as play immediately.<br/>
922 /// <param name="delayMilliseconds">The delay time.</param>
923 /// <since_tizen> 4 </since_tizen>
924 public void PlayAfter(int delayMilliseconds)
926 NDalicPINVOKE.Animation_PlayAfter(swigCPtr, MilliSecondsToSeconds(delayMilliseconds));
927 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
931 /// Pauses the animation.
933 /// <since_tizen> 3 </since_tizen>
936 NDalicPINVOKE.Animation_Pause(swigCPtr);
937 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
940 internal Animation.States GetState()
942 Animation.States ret = (Animation.States)NDalicPINVOKE.Animation_GetState(swigCPtr);
943 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
948 /// Stops the animation.
950 /// <since_tizen> 3 </since_tizen>
953 NDalicPINVOKE.Animation_Stop(swigCPtr);
954 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
958 /// Clears the animation.<br />
959 /// This disconnects any objects that were being animated, effectively stopping the animation.<br />
961 /// <since_tizen> 3 </since_tizen>
964 NDalicPINVOKE.Animation_Clear(swigCPtr);
965 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
968 internal AnimationSignal FinishedSignal()
970 AnimationSignal ret = new AnimationSignal(NDalicPINVOKE.Animation_FinishedSignal(swigCPtr), false);
971 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
975 internal AnimationSignal ProgressReachedSignal()
977 AnimationSignal ret = new AnimationSignal(NDalicPINVOKE.Animation_ProgressReachedSignal(swigCPtr), false);
978 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
982 internal void AnimateBy(Property target, PropertyValue relativeValue)
984 NDalicPINVOKE.Animation_AnimateBy__SWIG_0(swigCPtr, Property.getCPtr(target), PropertyValue.getCPtr(relativeValue));
985 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
988 internal void AnimateBy(Property target, PropertyValue relativeValue, AlphaFunction alpha)
990 NDalicPINVOKE.Animation_AnimateBy__SWIG_1(swigCPtr, Property.getCPtr(target), PropertyValue.getCPtr(relativeValue), AlphaFunction.getCPtr(alpha));
991 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
994 internal void AnimateBy(Property target, PropertyValue relativeValue, TimePeriod period)
996 NDalicPINVOKE.Animation_AnimateBy__SWIG_2(swigCPtr, Property.getCPtr(target), PropertyValue.getCPtr(relativeValue), TimePeriod.getCPtr(period));
997 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1000 internal void AnimateBy(Property target, PropertyValue relativeValue, AlphaFunction alpha, TimePeriod period)
1002 NDalicPINVOKE.Animation_AnimateBy__SWIG_3(swigCPtr, Property.getCPtr(target), PropertyValue.getCPtr(relativeValue), AlphaFunction.getCPtr(alpha), TimePeriod.getCPtr(period));
1003 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1006 internal void AnimateTo(Property target, PropertyValue destinationValue)
1008 NDalicPINVOKE.Animation_AnimateTo__SWIG_0(swigCPtr, Property.getCPtr(target), PropertyValue.getCPtr(destinationValue));
1009 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1012 internal void AnimateTo(Property target, PropertyValue destinationValue, AlphaFunction alpha)
1014 NDalicPINVOKE.Animation_AnimateTo__SWIG_1(swigCPtr, Property.getCPtr(target), PropertyValue.getCPtr(destinationValue), AlphaFunction.getCPtr(alpha));
1015 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1018 internal void AnimateTo(Property target, PropertyValue destinationValue, TimePeriod period)
1020 NDalicPINVOKE.Animation_AnimateTo__SWIG_2(swigCPtr, Property.getCPtr(target), PropertyValue.getCPtr(destinationValue), TimePeriod.getCPtr(period));
1021 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1024 internal void AnimateTo(Property target, PropertyValue destinationValue, AlphaFunction alpha, TimePeriod period)
1026 NDalicPINVOKE.Animation_AnimateTo__SWIG_3(swigCPtr, Property.getCPtr(target), PropertyValue.getCPtr(destinationValue), AlphaFunction.getCPtr(alpha), TimePeriod.getCPtr(period));
1027 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1030 internal void AnimateBetween(Property target, KeyFrames keyFrames)
1032 NDalicPINVOKE.Animation_AnimateBetween__SWIG_0(swigCPtr, Property.getCPtr(target), KeyFrames.getCPtr(keyFrames));
1033 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1036 internal void AnimateBetween(Property target, KeyFrames keyFrames, Animation.Interpolation interpolation)
1038 NDalicPINVOKE.Animation_AnimateBetween__SWIG_1(swigCPtr, Property.getCPtr(target), KeyFrames.getCPtr(keyFrames), (int)interpolation);
1039 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1042 internal void AnimateBetween(Property target, KeyFrames keyFrames, AlphaFunction alpha)
1044 NDalicPINVOKE.Animation_AnimateBetween__SWIG_2(swigCPtr, Property.getCPtr(target), KeyFrames.getCPtr(keyFrames), AlphaFunction.getCPtr(alpha));
1045 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1048 internal void AnimateBetween(Property target, KeyFrames keyFrames, AlphaFunction alpha, Animation.Interpolation interpolation)
1050 NDalicPINVOKE.Animation_AnimateBetween__SWIG_3(swigCPtr, Property.getCPtr(target), KeyFrames.getCPtr(keyFrames), AlphaFunction.getCPtr(alpha), (int)interpolation);
1051 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1054 internal void AnimateBetween(Property target, KeyFrames keyFrames, TimePeriod period)
1056 NDalicPINVOKE.Animation_AnimateBetween__SWIG_4(swigCPtr, Property.getCPtr(target), KeyFrames.getCPtr(keyFrames), TimePeriod.getCPtr(period));
1057 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1060 internal void AnimateBetween(Property target, KeyFrames keyFrames, TimePeriod period, Animation.Interpolation interpolation)
1062 NDalicPINVOKE.Animation_AnimateBetween__SWIG_5(swigCPtr, Property.getCPtr(target), KeyFrames.getCPtr(keyFrames), TimePeriod.getCPtr(period), (int)interpolation);
1063 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1066 internal void AnimateBetween(Property target, KeyFrames keyFrames, AlphaFunction alpha, TimePeriod period)
1068 NDalicPINVOKE.Animation_AnimateBetween__SWIG_6(swigCPtr, Property.getCPtr(target), KeyFrames.getCPtr(keyFrames), AlphaFunction.getCPtr(alpha), TimePeriod.getCPtr(period));
1069 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1072 internal void AnimateBetween(Property target, KeyFrames keyFrames, AlphaFunction alpha, TimePeriod period, Animation.Interpolation interpolation)
1074 NDalicPINVOKE.Animation_AnimateBetween__SWIG_7(swigCPtr, Property.getCPtr(target), KeyFrames.getCPtr(keyFrames), AlphaFunction.getCPtr(alpha), TimePeriod.getCPtr(period), (int)interpolation);
1075 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1078 internal void Animate(View view, Path path, Vector3 forward)
1080 NDalicPINVOKE.Animation_Animate__SWIG_0(swigCPtr, View.getCPtr(view), Path.getCPtr(path), Vector3.getCPtr(forward));
1081 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1084 internal void Animate(View view, Path path, Vector3 forward, AlphaFunction alpha)
1086 NDalicPINVOKE.Animation_Animate__SWIG_1(swigCPtr, View.getCPtr(view), Path.getCPtr(path), Vector3.getCPtr(forward), AlphaFunction.getCPtr(alpha));
1087 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1090 internal void Animate(View view, Path path, Vector3 forward, TimePeriod period)
1092 NDalicPINVOKE.Animation_Animate__SWIG_2(swigCPtr, View.getCPtr(view), Path.getCPtr(path), Vector3.getCPtr(forward), TimePeriod.getCPtr(period));
1093 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1096 internal void Animate(View view, Path path, Vector3 forward, AlphaFunction alpha, TimePeriod period)
1098 NDalicPINVOKE.Animation_Animate__SWIG_3(swigCPtr, View.getCPtr(view), Path.getCPtr(path), Vector3.getCPtr(forward), AlphaFunction.getCPtr(alpha), TimePeriod.getCPtr(period));
1099 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1102 internal void Show(View view, float delaySeconds)
1104 NDalicPINVOKE.Animation_Show(swigCPtr, View.getCPtr(view), delaySeconds);
1105 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1108 internal void Hide(View view, float delaySeconds)
1110 NDalicPINVOKE.Animation_Hide(swigCPtr, View.getCPtr(view), delaySeconds);
1111 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1115 /// Enumeration for what to do when the animation ends, stopped, or destroyed.
1117 /// <since_tizen> 3 </since_tizen>
1118 public enum EndActions
1121 /// When the animation ends, the animated property values are saved.
1125 /// When the animation ends, the animated property values are forgotten.
1129 /// If the animation is stopped, the animated property values are saved as if the animation had run to completion, otherwise behaves like cancel.
1135 /// Enumeration for what interpolation method to use on key-frame animations.
1137 /// <since_tizen> 3 </since_tizen>
1138 public enum Interpolation
1141 /// Values in between key frames are interpolated using a linear polynomial. (Default)
1145 /// Values in between key frames are interpolated using a cubic polynomial.
1151 /// Enumeration for what state the animation is in.
1153 /// <remarks>Calling Reset() on this class will not reset the animation. It will call the BaseHandle.Reset() which drops the object handle.</remarks>
1154 /// <since_tizen> 3 </since_tizen>
1158 /// The animation has stopped.
1162 /// The animation is playing.
1166 /// The animation is paused.