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)
56 if (_animationFinishedEventCallback != null)
58 FinishedSignal().Disconnect(_finishedCallbackOfNative);
61 if (_animationProgressReachedEventCallback != null)
64 ProgressReachedSignal().Disconnect(_animationProgressReachedEventCallback);
71 if(type == DisposeTypes.Explicit)
74 //Release your own managed resources here.
75 //You should release all of your own disposable objects here.
78 else if(type == DisposeTypes.Implicit)
87 NUILog.Error("Now Animation is playing! Clear and Reset here!");
88 //throw new System.InvalidOperationException("Animation Instance should not be disposed until getting Finished event. Should be a global variable");
91 //Release your own unmanaged resources here.
92 //You should not access any managed member here except static instance.
93 //because the execution order of Finalizes is non-deterministic.
95 if (swigCPtr.Handle != global::System.IntPtr.Zero)
100 NDalicPINVOKE.delete_Animation(swigCPtr);
102 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
109 /// Creates an initialized animation.<br />
110 /// The animation will not loop.<br />
111 /// The default end action is "Cancel".<br />
112 /// The default alpha function is linear.<br />
114 /// <remarks>DurationmSeconds must be greater than zero.</remarks>
115 /// <param name="durationMilliSeconds">The duration in milliseconds.</param>
116 /// <since_tizen> 3 </since_tizen>
117 public Animation(int durationMilliSeconds) : this(NDalicPINVOKE.Animation_New((float)durationMilliSeconds / 1000.0f), true)
119 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
122 private AnimationFinishedEventCallbackType _animationFinishedEventCallback;
123 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
124 private delegate void AnimationFinishedEventCallbackType(IntPtr data);
125 private event EventHandler _animationFinishedEventHandler;
127 private System.IntPtr _finishedCallbackOfNative;
130 * @brief Event for the finished signal which can be used to subscribe or unsubscribe the event handler.
131 * The finished signal is emitted when an animation's animations have finished.
133 /// <since_tizen> 3 </since_tizen>
134 public event EventHandler Finished
138 if (_animationFinishedEventHandler == null && disposed == false)
140 FinishedSignal().Connect(_finishedCallbackOfNative);
142 _animationFinishedEventHandler += value;
146 _animationFinishedEventHandler -= value;
148 if (_animationFinishedEventHandler == null && FinishedSignal().Empty() == false)
150 FinishedSignal().Disconnect(_finishedCallbackOfNative);
154 private void OnFinished(IntPtr data)
156 if (_animationFinishedEventHandler != null)
158 //here we send all data to user event handlers
159 _animationFinishedEventHandler(this, null);
163 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
164 private delegate void AnimationProgressReachedEventCallbackType(IntPtr data);
165 private AnimationProgressReachedEventCallbackType _animationProgressReachedEventCallback;
166 private event EventHandler _animationProgressReachedEventHandler;
168 * @brief Event for the ProgressReached signal, which can be used to subscribe or unsubscribe the event handler.
169 * The ProgressReached signal is emitted when the animation has reached a given progress percentage, this is set in the api SetProgressNotification.
171 /// <since_tizen> 3 </since_tizen>
172 public event EventHandler ProgressReached
176 if (_animationProgressReachedEventHandler == null)
178 _animationProgressReachedEventCallback = OnProgressReached;
179 ProgressReachedSignal().Connect(_animationProgressReachedEventCallback);
182 _animationProgressReachedEventHandler += value;
186 _animationProgressReachedEventHandler -= value;
188 if (_animationProgressReachedEventHandler == null && ProgressReachedSignal().Empty() == false)
190 ProgressReachedSignal().Disconnect(_animationProgressReachedEventCallback);
194 private void OnProgressReached(IntPtr data)
196 if (_animationProgressReachedEventHandler != null)
198 //here we send all data to user event handlers
199 _animationProgressReachedEventHandler(this, null);
203 private float MilliSecondsToSeconds(int millisec)
205 return (float)millisec / 1000.0f;
208 private int SecondsToMilliSeconds(float sec)
210 return (int)(sec * 1000);
215 /// Gets or sets the duration in milliseconds of the animation.
217 /// <since_tizen> 3 </since_tizen>
222 SetDuration(MilliSecondsToSeconds(value));
226 return SecondsToMilliSeconds(GetDuration());
231 /// Gets or sets the default alpha function for the animation.
233 /// <since_tizen> 3 </since_tizen>
234 public AlphaFunction DefaultAlphaFunction
238 SetDefaultAlphaFunction(value);
242 AlphaFunction ret = GetDefaultAlphaFunction();
248 /// Queries the state of the animation.
250 /// <since_tizen> 3 </since_tizen>
260 /// Set: Enables looping for a specified number of repeats. A zero is the same as Looping = true; i.e., repeat forever.<br />
261 /// This property resets the looping value and should not be used with the Looping property.<br />
262 /// Setting this parameter does not cause the animation to Play().<br />
263 /// Get: Gets the loop count. A zero is the same as Looping = true; i.e., repeat forever.<br />
264 /// The loop count is initially 1 for play once.<br />
266 /// <since_tizen> 3 </since_tizen>
275 int ret = GetLoopCount();
281 /// Gets or sets the status of whether the animation will loop.<br />
282 /// This property resets the loop count and should not be used with the LoopCount property.<br />
283 /// Setting this parameter does not cause the animation to Play().<br />
285 /// <since_tizen> 3 </since_tizen>
294 bool ret = IsLooping();
301 /// Gets or sets the end action of the animation.<br />
302 /// This action is performed when the animation ends or if it is stopped.<br />
303 /// The default end action is cancel.<br />
305 /// <since_tizen> 3 </since_tizen>
306 public EndActions EndAction
314 return GetEndAction();
320 /// Stops the animation.
322 /// <param name="action">The end action can be set.</param>
323 /// <since_tizen> 3 </since_tizen>
324 public void Stop(EndActions action = EndActions.Cancel)
326 SetEndAction(action);
327 NDalicPINVOKE.Animation_Stop(swigCPtr);
328 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
332 /// Gets the current loop count.<br />
333 /// A value 0 indicating the current loop count when looping.<br />
335 /// <since_tizen> 3 </since_tizen>
336 public int CurrentLoop
340 return GetCurrentLoop();
345 /// Gets or sets the disconnect action.<br />
346 /// If any of the animated property owners are disconnected from the stage while the animation is being played, then this action is performed.<br />
347 /// The default action is cancel.<br />
349 /// <since_tizen> 3 </since_tizen>
350 public EndActions DisconnectAction
354 NDalicPINVOKE.Animation_SetDisconnectAction(swigCPtr, (int)value);
355 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
359 Animation.EndActions ret = (Animation.EndActions)NDalicPINVOKE.Animation_GetDisconnectAction(swigCPtr);
360 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
367 /// Gets or sets the progress of the animation.<br />
368 /// The animation will play (or continue playing) from this point.<br />
369 /// The progress must be in the 0-1 interval or in the play range interval if defined<br />
370 /// otherwise, it will be ignored.<br />
372 /// <since_tizen> 3 </since_tizen>
373 public float CurrentProgress
377 NDalicPINVOKE.Animation_SetCurrentProgress(swigCPtr, value);
378 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
382 float ret = NDalicPINVOKE.Animation_GetCurrentProgress(swigCPtr);
383 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
389 /// Gets or sets specificifications of a speed factor for the animation.<br />
390 /// The speed factor is a multiplier of the normal velocity of the animation.<br />
391 /// Values between [0, 1] will slow down the animation and values above one will speed up the animation.<br />
392 /// It is also possible to specify a negative multiplier to play the animation in reverse.<br />
394 /// <since_tizen> 3 </since_tizen>
395 public float SpeedFactor
399 NDalicPINVOKE.Animation_SetSpeedFactor(swigCPtr, value);
400 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
404 float ret = NDalicPINVOKE.Animation_GetSpeedFactor(swigCPtr);
405 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
411 /// Gets or sets the playing range.<br />
412 /// Animation will play between the values specified. Both values (range.x and range.y ) should be between 0-1,
413 /// otherwise they will be ignored. If the range provided is not in proper order (minimum, maximum ), it will be reordered.<br />
415 /// <since_tizen> 3 </since_tizen>
416 public RelativeVector2 PlayRange
420 NDalicPINVOKE.Animation_SetPlayRange(swigCPtr, Vector2.getCPtr(value));
421 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
425 Vector2 ret = new Vector2(NDalicPINVOKE.Animation_GetPlayRange(swigCPtr), true);
426 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
433 /// Gets or sets the progress notification marker which triggers the ProgressReachedSignal.<br />
434 /// Percentage of animation progress should be greater than 0 and less than 1, for example, 0.3 for 30% <br />
435 /// One notification can be set on each animation.
437 /// <since_tizen> 3 </since_tizen>
438 public float ProgressNotification
442 NDalicPINVOKE.Animation_SetProgressNotification(swigCPtr, value);
443 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
447 float ret = NDalicPINVOKE.Animation_GetProgressNotification(swigCPtr);
448 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
454 /// Animates a property value by a relative amount.<br />
456 /// <param name="target">The target object to animate.</param>
457 /// <param name="property">The target property to animate.</param>
458 /// <param name="relativeValue">The property value will change by this amount.</param>
459 /// <param name="alphaFunction">The alpha function to apply.</param>
460 /// <since_tizen> 3 </since_tizen>
461 public void AnimateBy(View target, string property, object relativeValue, AlphaFunction alphaFunction = null)
463 Property _prop = PropertyHelper.GetPropertyFromString(target, property);
465 PropertyType propertyType = target.GetPropertyType(_prop.propertyIndex);
466 if(propertyType.Equals(PropertyType.Float))
468 System.Type type = relativeValue.GetType();
469 if (type.Equals(typeof(System.Int32)) || type.Equals(typeof(int)))
471 int num = (int)relativeValue;
472 relativeValue = (float)num;
476 PropertyValue val = PropertyValue.CreateFromObject(relativeValue);
478 if (alphaFunction != null)
480 AnimateBy(_prop, val, alphaFunction);
484 AnimateBy(_prop, val);
489 /// Animates a property value by a relative amount.<br />
491 /// <param name="target">The target object to animate.</param>
492 /// <param name="property">The target property to animate.</param>
493 /// <param name="relativeValue">The property value will change by this amount.</param>
494 /// <param name="startTime">The start time of the animation.</param>
495 /// <param name="endTime">The end time of the animation.</param>
496 /// <param name="alphaFunction">The alpha function to apply.</param>
497 /// <since_tizen> 3 </since_tizen>
498 public void AnimateBy(View target, string property, object relativeValue, int startTime, int endTime, AlphaFunction alphaFunction = null)
500 Property _prop = PropertyHelper.GetPropertyFromString(target, property);
502 PropertyType propertyType = target.GetPropertyType(_prop.propertyIndex);
503 if(propertyType.Equals(PropertyType.Float))
505 System.Type type = relativeValue.GetType();
506 if (type.Equals(typeof(System.Int32)) || type.Equals(typeof(int)))
508 int num = (int)relativeValue;
509 relativeValue = (float)num;
513 PropertyValue val = PropertyValue.CreateFromObject(relativeValue);
515 if (alphaFunction != null)
517 Tizen.NUI.TimePeriod time = new Tizen.NUI.TimePeriod(MilliSecondsToSeconds(startTime), MilliSecondsToSeconds(endTime - startTime));
518 AnimateBy(_prop, val, alphaFunction, time);
522 Tizen.NUI.TimePeriod time = new Tizen.NUI.TimePeriod(MilliSecondsToSeconds(startTime), MilliSecondsToSeconds(endTime - startTime));
523 AnimateBy(_prop, val, time);
528 /// Animates a property to a destination value.<br />
530 /// <param name="target">The target object to animate.</param>
531 /// <param name="property">The target property to animate.</param>
532 /// <param name="destinationValue">The destination value.</param>
533 /// <param name="alphaFunction">The alpha function to apply.</param>
534 /// <since_tizen> 3 </since_tizen>
535 public void AnimateTo(View target, string property, object destinationValue, AlphaFunction alphaFunction = null)
537 Property _prop = PropertyHelper.GetPropertyFromString(target, property);
539 PropertyType propertyType = target.GetPropertyType(_prop.propertyIndex);
540 if(propertyType.Equals(PropertyType.Float))
542 System.Type type = destinationValue.GetType();
543 if (type.Equals(typeof(System.Int32)) || type.Equals(typeof(int)))
545 int num = (int)destinationValue;
546 destinationValue = (float)num;
550 PropertyValue val = PropertyValue.CreateFromObject(destinationValue);
552 if (alphaFunction != null)
554 AnimateTo(_prop, val, alphaFunction);
558 AnimateTo(_prop, val);
563 /// Animates a property to a destination value.<br />
565 /// <param name="target">The target object to animate.</param>
566 /// <param name="property">The target property to animate.</param>
567 /// <param name="destinationValue">The destination value.</param>
568 /// <param name="startTime">The start time of the animation.</param>
569 /// <param name="endTime">The end time of the animation.</param>
570 /// <param name="alphaFunction">The alpha function to apply.</param>
571 /// <since_tizen> 3 </since_tizen>
572 public void AnimateTo(View target, string property, object destinationValue, int startTime, int endTime, AlphaFunction alphaFunction = null)
574 Property _prop = PropertyHelper.GetPropertyFromString(target, property);
576 PropertyType propertyType = target.GetPropertyType(_prop.propertyIndex);
577 if(propertyType.Equals(PropertyType.Float))
579 System.Type type = destinationValue.GetType();
580 if (type.Equals(typeof(System.Int32)) || type.Equals(typeof(int)))
582 int num = (int)destinationValue;
583 destinationValue = (float)num;
587 PropertyValue val = PropertyValue.CreateFromObject(destinationValue);
589 if (alphaFunction != null)
591 Tizen.NUI.TimePeriod time = new Tizen.NUI.TimePeriod(MilliSecondsToSeconds(startTime), MilliSecondsToSeconds(endTime - startTime));
592 AnimateTo(_prop, val, alphaFunction, time);
596 Tizen.NUI.TimePeriod time = new Tizen.NUI.TimePeriod(MilliSecondsToSeconds(startTime), MilliSecondsToSeconds(endTime - startTime));
597 AnimateTo(_prop, val, time);
602 /// Animates a property between keyframes.
604 /// <param name="target">The target object to animate.</param>
605 /// <param name="property">The target property to animate.</param>
606 /// <param name="keyFrames">The set of time or value pairs between which to animate.</param>
607 /// <param name="interpolation">The method used to interpolate between values.</param>
608 /// <param name="alphaFunction">The alpha function to apply.</param>
609 /// <since_tizen> 3 </since_tizen>
610 public void AnimateBetween(View target, string property, KeyFrames keyFrames, Interpolation interpolation = Interpolation.Linear, AlphaFunction alphaFunction = null)
612 Property _prop = PropertyHelper.GetPropertyFromString(target, property);
614 if (_prop.propertyIndex == Property.INVALID_INDEX)
616 throw new System.ArgumentException("second argument string property is invalid parameter!");
619 if (alphaFunction != null)
621 AnimateBetween(_prop, keyFrames, alphaFunction, interpolation);
625 AnimateBetween(_prop, keyFrames, interpolation);
631 /// Animates a property between keyframes.
633 /// <param name="target">The target object to animate</param>
634 /// <param name="property">The target property to animate</param>
635 /// <param name="keyFrames">The set of time/value pairs between which to animate</param>
636 /// <param name="startTime">The start time of animation in milliseconds.</param>
637 /// <param name="endTime">The end time of animation in milliseconds.</param>
638 /// <param name="interpolation">The method used to interpolate between values.</param>
639 /// <param name="alphaFunction">The alpha function to apply.</param>
640 /// <since_tizen> 3 </since_tizen>
641 public void AnimateBetween(View target, string property, KeyFrames keyFrames, int startTime, int endTime, Interpolation interpolation = Interpolation.Linear, AlphaFunction alphaFunction = null)
643 Property _prop = PropertyHelper.GetPropertyFromString(target, property);
645 Tizen.NUI.TimePeriod time = new Tizen.NUI.TimePeriod(MilliSecondsToSeconds(startTime), MilliSecondsToSeconds(endTime - startTime));
646 if (alphaFunction != null)
648 AnimateBetween(_prop, keyFrames, alphaFunction, time, interpolation);
652 AnimateBetween(_prop, keyFrames, time, interpolation);
657 /// Animates the view's position and orientation through a predefined path.<br />
658 /// The view will rotate to orient the supplied forward vector with the path's tangent.<br />
659 /// If forward is the zero vector then no rotation will happen.<br />
661 /// <param name="view">The view to animate.</param>
662 /// <param name="path">It defines position and orientation.</param>
663 /// <param name="forward">The vector (in local space coordinate system) will be oriented with the path's tangent direction.</param>
664 /// <param name="alphaFunction">The alpha function to apply.</param>
665 /// <since_tizen> 3 </since_tizen>
666 public void AnimatePath(View view, Path path, Vector3 forward, AlphaFunction alphaFunction = null)
668 if (alphaFunction == null)
670 Animate(view, path, forward);
674 Animate(view, path, forward, alphaFunction);
679 /// Animates the view's position and orientation through a predefined path.<br />
680 /// The view will rotate to orient the supplied forward vector with the path's tangent.<br />
681 /// If forward is the zero vector then no rotation will happen.<br />
683 /// <param name="view">The view to animate.</param>
684 /// <param name="path">It defines position and orientation.</param>
685 /// <param name="forward">The vector (in local space coordinate system) will be oriented with the path's tangent direction.</param>
686 /// <param name="startTime">The start time of the animation.</param>
687 /// <param name="endTime">The end time of the animation.</param>
688 /// <param name="alphaFunction">The alpha function to apply.</param>
689 /// <since_tizen> 3 </since_tizen>
690 public void AnimatePath(View view, Path path, Vector3 forward, int startTime, int endTime, AlphaFunction alphaFunction = null)
692 TimePeriod time = new TimePeriod(MilliSecondsToSeconds(startTime), MilliSecondsToSeconds(endTime - startTime));
693 if (alphaFunction == null)
695 Animate(view, path, forward, time);
699 Animate(view, path, forward, alphaFunction, time);
704 /// Creates an initialized animation.<br />
705 /// The animation will not loop.<br />
706 /// The default end action is "Cancel".<br />
707 /// The default alpha function is linear.<br />
709 /// <since_tizen> 3 </since_tizen>
710 public Animation() : this(NDalicPINVOKE.Animation_New(0.0f), true)
712 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
715 internal Animation(float durationSeconds) : this(NDalicPINVOKE.Animation_New(durationSeconds), true)
717 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
722 /// Downcasts a handle to animation handle.<br />
723 /// If handle points to an animation object, the downcast produces a valid handle.<br />
724 /// If not, the returned handle is left uninitialized.<br />
726 /// <param name="handle">Handle to an object.</param>
727 /// <returns>Handle to an animation object or an uninitialized handle.</returns>
728 /// <since_tizen> 3 </since_tizen>
729 public static Animation DownCast(BaseHandle handle)
731 Animation ret = Registry.GetManagedBaseHandleFromNativePtr(handle) as Animation;
732 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
736 internal Animation(Animation handle) : this(NDalicPINVOKE.new_Animation__SWIG_1(Animation.getCPtr(handle)), true)
738 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
741 internal Animation Assign(Animation rhs)
743 Animation ret = new Animation(NDalicPINVOKE.Animation_Assign(swigCPtr, Animation.getCPtr(rhs)), false);
744 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
748 internal void SetDuration(float seconds)
750 NDalicPINVOKE.Animation_SetDuration(swigCPtr, seconds);
751 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
754 internal float GetDuration()
756 float ret = NDalicPINVOKE.Animation_GetDuration(swigCPtr);
757 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
761 internal void SetLooping(bool looping)
763 NDalicPINVOKE.Animation_SetLooping(swigCPtr, looping);
764 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
767 internal void SetLoopCount(int count)
769 NDalicPINVOKE.Animation_SetLoopCount(swigCPtr, count);
770 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
773 internal int GetLoopCount()
775 int ret = NDalicPINVOKE.Animation_GetLoopCount(swigCPtr);
776 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
780 internal int GetCurrentLoop()
782 int ret = NDalicPINVOKE.Animation_GetCurrentLoop(swigCPtr);
783 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
787 internal bool IsLooping()
789 bool ret = NDalicPINVOKE.Animation_IsLooping(swigCPtr);
790 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
794 internal void SetEndAction(Animation.EndActions action)
796 NDalicPINVOKE.Animation_SetEndAction(swigCPtr, (int)action);
797 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
800 internal Animation.EndActions GetEndAction()
802 Animation.EndActions ret = (Animation.EndActions)NDalicPINVOKE.Animation_GetEndAction(swigCPtr);
803 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
807 internal void SetDisconnectAction(Animation.EndActions disconnectAction)
809 NDalicPINVOKE.Animation_SetDisconnectAction(swigCPtr, (int)disconnectAction);
810 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
813 internal Animation.EndActions GetDisconnectAction()
815 Animation.EndActions ret = (Animation.EndActions)NDalicPINVOKE.Animation_GetDisconnectAction(swigCPtr);
816 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
820 internal void SetDefaultAlphaFunction(AlphaFunction alpha)
822 NDalicPINVOKE.Animation_SetDefaultAlphaFunction(swigCPtr, AlphaFunction.getCPtr(alpha));
823 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
826 internal AlphaFunction GetDefaultAlphaFunction()
828 AlphaFunction ret = new AlphaFunction(NDalicPINVOKE.Animation_GetDefaultAlphaFunction(swigCPtr), true);
829 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
833 internal void SetCurrentProgress(float progress)
835 NDalicPINVOKE.Animation_SetCurrentProgress(swigCPtr, progress);
836 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
839 internal float GetCurrentProgress()
841 float ret = NDalicPINVOKE.Animation_GetCurrentProgress(swigCPtr);
842 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
846 internal void SetSpeedFactor(float factor)
848 NDalicPINVOKE.Animation_SetSpeedFactor(swigCPtr, factor);
849 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
852 internal float GetSpeedFactor()
854 float ret = NDalicPINVOKE.Animation_GetSpeedFactor(swigCPtr);
855 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
859 internal void SetPlayRange(Vector2 range)
861 NDalicPINVOKE.Animation_SetPlayRange(swigCPtr, Vector2.getCPtr(range));
862 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
865 internal Vector2 GetPlayRange()
867 Vector2 ret = new Vector2(NDalicPINVOKE.Animation_GetPlayRange(swigCPtr), true);
868 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
872 private static bool? disableAnimation = null;
873 private bool DisableAnimation
877 if (disableAnimation.HasValue == false)
879 string type = Environment.GetEnvironmentVariable("PlatformSmartType");
881 disableAnimation = true;
883 disableAnimation = false;
885 return disableAnimation.Value;
890 /// Plays the animation.
892 /// <since_tizen> 3 </since_tizen>
895 NDalicPINVOKE.Animation_Play(swigCPtr);
896 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
898 if (DisableAnimation == true)
899 Stop(EndActions.StopFinal);
903 /// Plays the animation from a given point.<br />
904 /// The progress must be in the 0-1 interval or in the play range interval if defined,
905 /// otherwise, it will be ignored.<br />
907 /// <param name="progress">A value between [0,1], or between the play range if specified, from where the animation should start playing.</param>
908 /// <since_tizen> 3 </since_tizen>
909 public void PlayFrom(float progress)
911 NDalicPINVOKE.Animation_PlayFrom(swigCPtr, progress);
912 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
916 /// Plays the animation after a given delay time.<br/>
917 /// The delay time is not included in the looping time.<br/>
918 /// When the delay time is a negative value, it would treat as play immediately.<br/>
920 /// <param name="delayMilliseconds">The delay time.</param>
921 /// <since_tizen> 4 </since_tizen>
922 public void PlayAfter(int delayMilliseconds)
924 NDalicPINVOKE.Animation_PlayAfter(swigCPtr, MilliSecondsToSeconds(delayMilliseconds));
925 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
929 /// Pauses the animation.
931 /// <since_tizen> 3 </since_tizen>
934 NDalicPINVOKE.Animation_Pause(swigCPtr);
935 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
938 internal Animation.States GetState()
940 Animation.States ret = (Animation.States)NDalicPINVOKE.Animation_GetState(swigCPtr);
941 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
946 /// Stops the animation.
948 /// <since_tizen> 3 </since_tizen>
951 NDalicPINVOKE.Animation_Stop(swigCPtr);
952 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
956 /// Clears the animation.<br />
957 /// This disconnects any objects that were being animated, effectively stopping the animation.<br />
959 /// <since_tizen> 3 </since_tizen>
962 NDalicPINVOKE.Animation_Clear(swigCPtr);
963 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
966 internal AnimationSignal FinishedSignal()
968 AnimationSignal ret = new AnimationSignal(NDalicPINVOKE.Animation_FinishedSignal(swigCPtr), false);
969 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
973 internal AnimationSignal ProgressReachedSignal()
975 AnimationSignal ret = new AnimationSignal(NDalicPINVOKE.Animation_ProgressReachedSignal(swigCPtr), false);
976 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
980 internal void AnimateBy(Property target, PropertyValue relativeValue)
982 NDalicPINVOKE.Animation_AnimateBy__SWIG_0(swigCPtr, Property.getCPtr(target), PropertyValue.getCPtr(relativeValue));
983 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
986 internal void AnimateBy(Property target, PropertyValue relativeValue, AlphaFunction alpha)
988 NDalicPINVOKE.Animation_AnimateBy__SWIG_1(swigCPtr, Property.getCPtr(target), PropertyValue.getCPtr(relativeValue), AlphaFunction.getCPtr(alpha));
989 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
992 internal void AnimateBy(Property target, PropertyValue relativeValue, TimePeriod period)
994 NDalicPINVOKE.Animation_AnimateBy__SWIG_2(swigCPtr, Property.getCPtr(target), PropertyValue.getCPtr(relativeValue), TimePeriod.getCPtr(period));
995 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
998 internal void AnimateBy(Property target, PropertyValue relativeValue, AlphaFunction alpha, TimePeriod period)
1000 NDalicPINVOKE.Animation_AnimateBy__SWIG_3(swigCPtr, Property.getCPtr(target), PropertyValue.getCPtr(relativeValue), AlphaFunction.getCPtr(alpha), TimePeriod.getCPtr(period));
1001 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1004 internal void AnimateTo(Property target, PropertyValue destinationValue)
1006 NDalicPINVOKE.Animation_AnimateTo__SWIG_0(swigCPtr, Property.getCPtr(target), PropertyValue.getCPtr(destinationValue));
1007 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1010 internal void AnimateTo(Property target, PropertyValue destinationValue, AlphaFunction alpha)
1012 NDalicPINVOKE.Animation_AnimateTo__SWIG_1(swigCPtr, Property.getCPtr(target), PropertyValue.getCPtr(destinationValue), AlphaFunction.getCPtr(alpha));
1013 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1016 internal void AnimateTo(Property target, PropertyValue destinationValue, TimePeriod period)
1018 NDalicPINVOKE.Animation_AnimateTo__SWIG_2(swigCPtr, Property.getCPtr(target), PropertyValue.getCPtr(destinationValue), TimePeriod.getCPtr(period));
1019 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1022 internal void AnimateTo(Property target, PropertyValue destinationValue, AlphaFunction alpha, TimePeriod period)
1024 NDalicPINVOKE.Animation_AnimateTo__SWIG_3(swigCPtr, Property.getCPtr(target), PropertyValue.getCPtr(destinationValue), AlphaFunction.getCPtr(alpha), TimePeriod.getCPtr(period));
1025 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1028 internal void AnimateBetween(Property target, KeyFrames keyFrames)
1030 NDalicPINVOKE.Animation_AnimateBetween__SWIG_0(swigCPtr, Property.getCPtr(target), KeyFrames.getCPtr(keyFrames));
1031 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1034 internal void AnimateBetween(Property target, KeyFrames keyFrames, Animation.Interpolation interpolation)
1036 NDalicPINVOKE.Animation_AnimateBetween__SWIG_1(swigCPtr, Property.getCPtr(target), KeyFrames.getCPtr(keyFrames), (int)interpolation);
1037 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1040 internal void AnimateBetween(Property target, KeyFrames keyFrames, AlphaFunction alpha)
1042 NDalicPINVOKE.Animation_AnimateBetween__SWIG_2(swigCPtr, Property.getCPtr(target), KeyFrames.getCPtr(keyFrames), AlphaFunction.getCPtr(alpha));
1043 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1046 internal void AnimateBetween(Property target, KeyFrames keyFrames, AlphaFunction alpha, Animation.Interpolation interpolation)
1048 NDalicPINVOKE.Animation_AnimateBetween__SWIG_3(swigCPtr, Property.getCPtr(target), KeyFrames.getCPtr(keyFrames), AlphaFunction.getCPtr(alpha), (int)interpolation);
1049 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1052 internal void AnimateBetween(Property target, KeyFrames keyFrames, TimePeriod period)
1054 NDalicPINVOKE.Animation_AnimateBetween__SWIG_4(swigCPtr, Property.getCPtr(target), KeyFrames.getCPtr(keyFrames), TimePeriod.getCPtr(period));
1055 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1058 internal void AnimateBetween(Property target, KeyFrames keyFrames, TimePeriod period, Animation.Interpolation interpolation)
1060 NDalicPINVOKE.Animation_AnimateBetween__SWIG_5(swigCPtr, Property.getCPtr(target), KeyFrames.getCPtr(keyFrames), TimePeriod.getCPtr(period), (int)interpolation);
1061 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1064 internal void AnimateBetween(Property target, KeyFrames keyFrames, AlphaFunction alpha, TimePeriod period)
1066 NDalicPINVOKE.Animation_AnimateBetween__SWIG_6(swigCPtr, Property.getCPtr(target), KeyFrames.getCPtr(keyFrames), AlphaFunction.getCPtr(alpha), TimePeriod.getCPtr(period));
1067 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1070 internal void AnimateBetween(Property target, KeyFrames keyFrames, AlphaFunction alpha, TimePeriod period, Animation.Interpolation interpolation)
1072 NDalicPINVOKE.Animation_AnimateBetween__SWIG_7(swigCPtr, Property.getCPtr(target), KeyFrames.getCPtr(keyFrames), AlphaFunction.getCPtr(alpha), TimePeriod.getCPtr(period), (int)interpolation);
1073 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1076 internal void Animate(View view, Path path, Vector3 forward)
1078 NDalicPINVOKE.Animation_Animate__SWIG_0(swigCPtr, View.getCPtr(view), Path.getCPtr(path), Vector3.getCPtr(forward));
1079 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1082 internal void Animate(View view, Path path, Vector3 forward, AlphaFunction alpha)
1084 NDalicPINVOKE.Animation_Animate__SWIG_1(swigCPtr, View.getCPtr(view), Path.getCPtr(path), Vector3.getCPtr(forward), AlphaFunction.getCPtr(alpha));
1085 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1088 internal void Animate(View view, Path path, Vector3 forward, TimePeriod period)
1090 NDalicPINVOKE.Animation_Animate__SWIG_2(swigCPtr, View.getCPtr(view), Path.getCPtr(path), Vector3.getCPtr(forward), TimePeriod.getCPtr(period));
1091 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1094 internal void Animate(View view, Path path, Vector3 forward, AlphaFunction alpha, TimePeriod period)
1096 NDalicPINVOKE.Animation_Animate__SWIG_3(swigCPtr, View.getCPtr(view), Path.getCPtr(path), Vector3.getCPtr(forward), AlphaFunction.getCPtr(alpha), TimePeriod.getCPtr(period));
1097 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1100 internal void Show(View view, float delaySeconds)
1102 NDalicPINVOKE.Animation_Show(swigCPtr, View.getCPtr(view), delaySeconds);
1103 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1106 internal void Hide(View view, float delaySeconds)
1108 NDalicPINVOKE.Animation_Hide(swigCPtr, View.getCPtr(view), delaySeconds);
1109 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1113 /// Enumeration for what to do when the animation ends, stopped, or destroyed.
1115 /// <since_tizen> 3 </since_tizen>
1116 public enum EndActions
1119 /// When the animation ends, the animated property values are saved.
1123 /// When the animation ends, the animated property values are forgotten.
1127 /// If the animation is stopped, the animated property values are saved as if the animation had run to completion, otherwise behaves like cancel.
1133 /// Enumeration for what interpolation method to use on key-frame animations.
1135 /// <since_tizen> 3 </since_tizen>
1136 public enum Interpolation
1139 /// Values in between key frames are interpolated using a linear polynomial. (Default)
1143 /// Values in between key frames are interpolated using a cubic polynomial.
1149 /// Enumeration for what state the animation is in.
1151 /// <remarks>Calling Reset() on this class will not reset the animation. It will call the BaseHandle.Reset() which drops the object handle.</remarks>
1152 /// <since_tizen> 3 </since_tizen>
1156 /// The animation has stopped.
1160 /// The animation is playing.
1164 /// The animation is paused.