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;
52 if (_animationFinishedEventCallback != null)
54 _finishedSignal?.Disconnect(_finishedCallbackOfNative);
59 /// To make animation instance be disposed.
61 /// <since_tizen> 3 </since_tizen>
62 protected override void Dispose(DisposeTypes type)
64 if (_animationFinishedEventCallback != null)
66 _finishedSignal?.Disconnect(_finishedCallbackOfNative);
69 if (_animationProgressReachedEventCallback != null)
71 ProgressReachedSignal().Disconnect(_animationProgressReachedEventCallback);
79 if(type == DisposeTypes.Explicit)
82 //Release your own managed resources here.
83 //You should release all of your own disposable objects here.
86 else if(type == DisposeTypes.Implicit)
95 NUILog.Error("Animation().Clear & Reset here!");
96 //throw new System.InvalidOperationException("Animation Instance should not be disposed until getting Finished event. Should be a global variable");
99 //Release your own unmanaged resources here.
100 //You should not access any managed member here except static instance.
101 //because the execution order of Finalizes is non-deterministic.
103 if (swigCPtr.Handle != global::System.IntPtr.Zero)
108 NDalicPINVOKE.delete_Animation(swigCPtr);
110 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
117 /// Creates an initialized animation.<br />
118 /// The animation will not loop.<br />
119 /// The default end action is "Cancel".<br />
120 /// The default alpha function is linear.<br />
122 /// <remarks>DurationmSeconds must be greater than zero.</remarks>
123 /// <param name="durationMilliSeconds">The duration in milliseconds.</param>
124 /// <since_tizen> 3 </since_tizen>
125 public Animation(int durationMilliSeconds) : this(NDalicPINVOKE.Animation_New((float)durationMilliSeconds / 1000.0f), true)
127 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
130 private AnimationFinishedEventCallbackType _animationFinishedEventCallback;
131 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
132 private delegate void AnimationFinishedEventCallbackType(IntPtr data);
133 private event EventHandler _animationFinishedEventHandler;
135 private System.IntPtr _finishedCallbackOfNative;
136 private AnimationSignal _finishedSignal;
139 * @brief Event for the finished signal which can be used to subscribe or unsubscribe the event handler.
140 * The finished signal is emitted when an animation's animations have finished.
142 /// <since_tizen> 3 </since_tizen>
143 public event EventHandler Finished
147 if (_animationFinishedEventHandler == null && disposed == false)
149 _finishedSignal = FinishedSignal();
150 _finishedSignal?.Connect(_finishedCallbackOfNative);
152 _animationFinishedEventHandler += value;
156 _animationFinishedEventHandler -= value;
158 if (_animationFinishedEventHandler == null && _finishedSignal?.Empty() == false)
160 _finishedSignal?.Disconnect(_finishedCallbackOfNative);
164 private void OnFinished(IntPtr data)
166 if (_animationFinishedEventHandler != null)
168 //here we send all data to user event handlers
169 _animationFinishedEventHandler(this, null);
173 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
174 private delegate void AnimationProgressReachedEventCallbackType(IntPtr data);
175 private AnimationProgressReachedEventCallbackType _animationProgressReachedEventCallback;
176 private event EventHandler _animationProgressReachedEventHandler;
178 * @brief Event for the ProgressReached signal, which can be used to subscribe or unsubscribe the event handler.
179 * The ProgressReached signal is emitted when the animation has reached a given progress percentage, this is set in the api SetProgressNotification.
181 /// <since_tizen> 3 </since_tizen>
182 public event EventHandler ProgressReached
186 if (_animationProgressReachedEventHandler == null)
188 _animationProgressReachedEventCallback = OnProgressReached;
189 ProgressReachedSignal().Connect(_animationProgressReachedEventCallback);
192 _animationProgressReachedEventHandler += value;
196 _animationProgressReachedEventHandler -= value;
198 if (_animationProgressReachedEventHandler == null && ProgressReachedSignal().Empty() == false)
200 ProgressReachedSignal().Disconnect(_animationProgressReachedEventCallback);
204 private void OnProgressReached(IntPtr data)
206 if (_animationProgressReachedEventHandler != null)
208 //here we send all data to user event handlers
209 _animationProgressReachedEventHandler(this, null);
213 private float MilliSecondsToSeconds(int millisec)
215 return (float)millisec / 1000.0f;
218 private int SecondsToMilliSeconds(float sec)
220 return (int)(sec * 1000);
225 /// Gets or sets the duration in milliseconds of the animation.
227 /// <since_tizen> 3 </since_tizen>
232 SetDuration(MilliSecondsToSeconds(value));
236 return SecondsToMilliSeconds(GetDuration());
241 /// Gets or sets the default alpha function for the animation.
243 /// <since_tizen> 3 </since_tizen>
244 public AlphaFunction DefaultAlphaFunction
248 SetDefaultAlphaFunction(value);
252 AlphaFunction ret = GetDefaultAlphaFunction();
258 /// Queries the state of the animation.
260 /// <since_tizen> 3 </since_tizen>
270 /// Set: Enables looping for a specified number of repeats. A zero is the same as Looping = true; i.e., repeat forever.<br />
271 /// This property resets the looping value and should not be used with the Looping property.<br />
272 /// Setting this parameter does not cause the animation to Play().<br />
273 /// Get: Gets the loop count. A zero is the same as Looping = true; i.e., repeat forever.<br />
274 /// The loop count is initially 1 for play once.<br />
276 /// <since_tizen> 3 </since_tizen>
285 int ret = GetLoopCount();
291 /// Gets or sets the status of whether the animation will loop.<br />
292 /// This property resets the loop count and should not be used with the LoopCount property.<br />
293 /// Setting this parameter does not cause the animation to Play().<br />
295 /// <since_tizen> 3 </since_tizen>
304 bool ret = IsLooping();
311 /// Gets or sets the end action of the animation.<br />
312 /// This action is performed when the animation ends or if it is stopped.<br />
313 /// The default end action is cancel.<br />
315 /// <since_tizen> 3 </since_tizen>
316 public EndActions EndAction
324 return GetEndAction();
330 /// Stops the animation.
332 /// <param name="action">The end action can be set.</param>
333 /// <since_tizen> 3 </since_tizen>
334 public void Stop(EndActions action = EndActions.Cancel)
336 SetEndAction(action);
337 NDalicPINVOKE.Animation_Stop(swigCPtr);
338 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
342 /// Gets the current loop count.<br />
343 /// A value 0 indicating the current loop count when looping.<br />
345 /// <since_tizen> 3 </since_tizen>
346 public int CurrentLoop
350 return GetCurrentLoop();
355 /// Gets or sets the disconnect action.<br />
356 /// If any of the animated property owners are disconnected from the stage while the animation is being played, then this action is performed.<br />
357 /// The default action is cancel.<br />
359 /// <since_tizen> 3 </since_tizen>
360 public EndActions DisconnectAction
364 NDalicPINVOKE.Animation_SetDisconnectAction(swigCPtr, (int)value);
365 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
369 Animation.EndActions ret = (Animation.EndActions)NDalicPINVOKE.Animation_GetDisconnectAction(swigCPtr);
370 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
377 /// Gets or sets the progress of the animation.<br />
378 /// The animation will play (or continue playing) from this point.<br />
379 /// The progress must be in the 0-1 interval or in the play range interval if defined<br />
380 /// otherwise, it will be ignored.<br />
382 /// <since_tizen> 3 </since_tizen>
383 public float CurrentProgress
387 NDalicPINVOKE.Animation_SetCurrentProgress(swigCPtr, value);
388 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
392 float ret = NDalicPINVOKE.Animation_GetCurrentProgress(swigCPtr);
393 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
399 /// Gets or sets specificifications of a speed factor for the animation.<br />
400 /// The speed factor is a multiplier of the normal velocity of the animation.<br />
401 /// Values between [0, 1] will slow down the animation and values above one will speed up the animation.<br />
402 /// It is also possible to specify a negative multiplier to play the animation in reverse.<br />
404 /// <since_tizen> 3 </since_tizen>
405 public float SpeedFactor
409 NDalicPINVOKE.Animation_SetSpeedFactor(swigCPtr, value);
410 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
414 float ret = NDalicPINVOKE.Animation_GetSpeedFactor(swigCPtr);
415 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
421 /// Gets or sets the playing range.<br />
422 /// Animation will play between the values specified. Both values (range.x and range.y ) should be between 0-1,
423 /// otherwise they will be ignored. If the range provided is not in proper order (minimum, maximum ), it will be reordered.<br />
425 /// <since_tizen> 3 </since_tizen>
426 public RelativeVector2 PlayRange
430 NDalicPINVOKE.Animation_SetPlayRange(swigCPtr, Vector2.getCPtr(value));
431 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
435 Vector2 ret = new Vector2(NDalicPINVOKE.Animation_GetPlayRange(swigCPtr), true);
436 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
443 /// Gets or sets the progress notification marker which triggers the ProgressReachedSignal.<br />
444 /// Percentage of animation progress should be greater than 0 and less than 1, for example, 0.3 for 30% <br />
445 /// One notification can be set on each animation.
447 /// <since_tizen> 3 </since_tizen>
448 public float ProgressNotification
452 NDalicPINVOKE.Animation_SetProgressNotification(swigCPtr, value);
453 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
457 float ret = NDalicPINVOKE.Animation_GetProgressNotification(swigCPtr);
458 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
464 /// Animates a property value by a relative amount.<br />
466 /// <param name="target">The target object to animate.</param>
467 /// <param name="property">The target property to animate.</param>
468 /// <param name="relativeValue">The property value will change by this amount.</param>
469 /// <param name="alphaFunction">The alpha function to apply.</param>
470 /// <since_tizen> 3 </since_tizen>
471 public void AnimateBy(View target, string property, object relativeValue, AlphaFunction alphaFunction = null)
473 Property _prop = PropertyHelper.GetPropertyFromString(target, property);
475 PropertyType propertyType = target.GetPropertyType(_prop.propertyIndex);
476 if(propertyType.Equals(PropertyType.Float))
478 System.Type type = relativeValue.GetType();
479 if (type.Equals(typeof(System.Int32)) || type.Equals(typeof(int)))
481 int num = (int)relativeValue;
482 relativeValue = (float)num;
486 PropertyValue val = PropertyValue.CreateFromObject(relativeValue);
488 if (alphaFunction != null)
490 AnimateBy(_prop, val, alphaFunction);
494 AnimateBy(_prop, val);
499 /// Animates a property value by a relative amount.<br />
501 /// <param name="target">The target object to animate.</param>
502 /// <param name="property">The target property to animate.</param>
503 /// <param name="relativeValue">The property value will change by this amount.</param>
504 /// <param name="startTime">The start time of the animation.</param>
505 /// <param name="endTime">The end time of the animation.</param>
506 /// <param name="alphaFunction">The alpha function to apply.</param>
507 /// <since_tizen> 3 </since_tizen>
508 public void AnimateBy(View target, string property, object relativeValue, int startTime, int endTime, AlphaFunction alphaFunction = null)
510 Property _prop = PropertyHelper.GetPropertyFromString(target, property);
512 PropertyType propertyType = target.GetPropertyType(_prop.propertyIndex);
513 if(propertyType.Equals(PropertyType.Float))
515 System.Type type = relativeValue.GetType();
516 if (type.Equals(typeof(System.Int32)) || type.Equals(typeof(int)))
518 int num = (int)relativeValue;
519 relativeValue = (float)num;
523 PropertyValue val = PropertyValue.CreateFromObject(relativeValue);
525 if (alphaFunction != null)
527 Tizen.NUI.TimePeriod time = new Tizen.NUI.TimePeriod(MilliSecondsToSeconds(startTime), MilliSecondsToSeconds(endTime - startTime));
528 AnimateBy(_prop, val, alphaFunction, time);
532 Tizen.NUI.TimePeriod time = new Tizen.NUI.TimePeriod(MilliSecondsToSeconds(startTime), MilliSecondsToSeconds(endTime - startTime));
533 AnimateBy(_prop, val, time);
538 /// Animates a property to a destination value.<br />
540 /// <param name="target">The target object to animate.</param>
541 /// <param name="property">The target property to animate.</param>
542 /// <param name="destinationValue">The destination value.</param>
543 /// <param name="alphaFunction">The alpha function to apply.</param>
544 /// <since_tizen> 3 </since_tizen>
545 public void AnimateTo(View target, string property, object destinationValue, AlphaFunction alphaFunction = null)
547 Property _prop = PropertyHelper.GetPropertyFromString(target, property);
549 PropertyType propertyType = target.GetPropertyType(_prop.propertyIndex);
550 if(propertyType.Equals(PropertyType.Float))
552 System.Type type = destinationValue.GetType();
553 if (type.Equals(typeof(System.Int32)) || type.Equals(typeof(int)))
555 int num = (int)destinationValue;
556 destinationValue = (float)num;
560 PropertyValue val = PropertyValue.CreateFromObject(destinationValue);
562 if (alphaFunction != null)
564 AnimateTo(_prop, val, alphaFunction);
568 AnimateTo(_prop, val);
573 /// Animates a property to a destination value.<br />
575 /// <param name="target">The target object to animate.</param>
576 /// <param name="property">The target property to animate.</param>
577 /// <param name="destinationValue">The destination value.</param>
578 /// <param name="startTime">The start time of the animation.</param>
579 /// <param name="endTime">The end time of the animation.</param>
580 /// <param name="alphaFunction">The alpha function to apply.</param>
581 /// <since_tizen> 3 </since_tizen>
582 public void AnimateTo(View target, string property, object destinationValue, int startTime, int endTime, AlphaFunction alphaFunction = null)
584 Property _prop = PropertyHelper.GetPropertyFromString(target, property);
586 PropertyType propertyType = target.GetPropertyType(_prop.propertyIndex);
587 if(propertyType.Equals(PropertyType.Float))
589 System.Type type = destinationValue.GetType();
590 if (type.Equals(typeof(System.Int32)) || type.Equals(typeof(int)))
592 int num = (int)destinationValue;
593 destinationValue = (float)num;
597 PropertyValue val = PropertyValue.CreateFromObject(destinationValue);
599 if (alphaFunction != null)
601 Tizen.NUI.TimePeriod time = new Tizen.NUI.TimePeriod(MilliSecondsToSeconds(startTime), MilliSecondsToSeconds(endTime - startTime));
602 AnimateTo(_prop, val, alphaFunction, time);
606 Tizen.NUI.TimePeriod time = new Tizen.NUI.TimePeriod(MilliSecondsToSeconds(startTime), MilliSecondsToSeconds(endTime - startTime));
607 AnimateTo(_prop, val, time);
612 /// Animates a property between keyframes.
614 /// <param name="target">The target object to animate.</param>
615 /// <param name="property">The target property to animate.</param>
616 /// <param name="keyFrames">The set of time or value pairs between which to animate.</param>
617 /// <param name="interpolation">The method used to interpolate between values.</param>
618 /// <param name="alphaFunction">The alpha function to apply.</param>
619 /// <since_tizen> 3 </since_tizen>
620 public void AnimateBetween(View target, string property, KeyFrames keyFrames, Interpolation interpolation = Interpolation.Linear, AlphaFunction alphaFunction = null)
622 Property _prop = PropertyHelper.GetPropertyFromString(target, property);
624 if (_prop.propertyIndex == Property.INVALID_INDEX)
626 throw new System.ArgumentException("second argument string property is invalid parameter!");
629 if (alphaFunction != null)
631 AnimateBetween(_prop, keyFrames, alphaFunction, interpolation);
635 AnimateBetween(_prop, keyFrames, interpolation);
641 /// Animates a property between keyframes.
643 /// <param name="target">The target object to animate</param>
644 /// <param name="property">The target property to animate</param>
645 /// <param name="keyFrames">The set of time/value pairs between which to animate</param>
646 /// <param name="startTime">The start time of animation in milliseconds.</param>
647 /// <param name="endTime">The end time of animation in milliseconds.</param>
648 /// <param name="interpolation">The method used to interpolate between values.</param>
649 /// <param name="alphaFunction">The alpha function to apply.</param>
650 /// <since_tizen> 3 </since_tizen>
651 public void AnimateBetween(View target, string property, KeyFrames keyFrames, int startTime, int endTime, Interpolation interpolation = Interpolation.Linear, AlphaFunction alphaFunction = null)
653 Property _prop = PropertyHelper.GetPropertyFromString(target, property);
655 Tizen.NUI.TimePeriod time = new Tizen.NUI.TimePeriod(MilliSecondsToSeconds(startTime), MilliSecondsToSeconds(endTime - startTime));
656 if (alphaFunction != null)
658 AnimateBetween(_prop, keyFrames, alphaFunction, time, interpolation);
662 AnimateBetween(_prop, keyFrames, time, interpolation);
667 /// Animates the view's position and orientation through a predefined path.<br />
668 /// The view will rotate to orient the supplied forward vector with the path's tangent.<br />
669 /// If forward is the zero vector then no rotation will happen.<br />
671 /// <param name="view">The view to animate.</param>
672 /// <param name="path">It defines position and orientation.</param>
673 /// <param name="forward">The vector (in local space coordinate system) will be oriented with the path's tangent direction.</param>
674 /// <param name="alphaFunction">The alpha function to apply.</param>
675 /// <since_tizen> 3 </since_tizen>
676 public void AnimatePath(View view, Path path, Vector3 forward, AlphaFunction alphaFunction = null)
678 if (alphaFunction == null)
680 Animate(view, path, forward);
684 Animate(view, path, forward, alphaFunction);
689 /// Animates the view's position and orientation through a predefined path.<br />
690 /// The view will rotate to orient the supplied forward vector with the path's tangent.<br />
691 /// If forward is the zero vector then no rotation will happen.<br />
693 /// <param name="view">The view to animate.</param>
694 /// <param name="path">It defines position and orientation.</param>
695 /// <param name="forward">The vector (in local space coordinate system) will be oriented with the path's tangent direction.</param>
696 /// <param name="startTime">The start time of the animation.</param>
697 /// <param name="endTime">The end time of the animation.</param>
698 /// <param name="alphaFunction">The alpha function to apply.</param>
699 /// <since_tizen> 3 </since_tizen>
700 public void AnimatePath(View view, Path path, Vector3 forward, int startTime, int endTime, AlphaFunction alphaFunction = null)
702 TimePeriod time = new TimePeriod(MilliSecondsToSeconds(startTime), MilliSecondsToSeconds(endTime - startTime));
703 if (alphaFunction == null)
705 Animate(view, path, forward, time);
709 Animate(view, path, forward, alphaFunction, time);
714 /// Creates an initialized animation.<br />
715 /// The animation will not loop.<br />
716 /// The default end action is "Cancel".<br />
717 /// The default alpha function is linear.<br />
719 /// <since_tizen> 3 </since_tizen>
720 public Animation() : this(NDalicPINVOKE.Animation_New(0.0f), true)
722 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
725 internal Animation(float durationSeconds) : this(NDalicPINVOKE.Animation_New(durationSeconds), true)
727 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
732 /// Downcasts a handle to animation handle.<br />
733 /// If handle points to an animation object, the downcast produces a valid handle.<br />
734 /// If not, the returned handle is left uninitialized.<br />
736 /// <param name="handle">Handle to an object.</param>
737 /// <returns>Handle to an animation object or an uninitialized handle.</returns>
738 /// <since_tizen> 3 </since_tizen>
739 public static Animation DownCast(BaseHandle handle)
741 Animation ret = Registry.GetManagedBaseHandleFromNativePtr(handle) as Animation;
742 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
746 internal Animation(Animation handle) : this(NDalicPINVOKE.new_Animation__SWIG_1(Animation.getCPtr(handle)), true)
748 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
751 internal Animation Assign(Animation rhs)
753 Animation ret = new Animation(NDalicPINVOKE.Animation_Assign(swigCPtr, Animation.getCPtr(rhs)), false);
754 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
758 internal void SetDuration(float seconds)
760 NDalicPINVOKE.Animation_SetDuration(swigCPtr, seconds);
761 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
764 internal float GetDuration()
766 float ret = NDalicPINVOKE.Animation_GetDuration(swigCPtr);
767 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
771 internal void SetLooping(bool looping)
773 NDalicPINVOKE.Animation_SetLooping(swigCPtr, looping);
774 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
777 internal void SetLoopCount(int count)
779 NDalicPINVOKE.Animation_SetLoopCount(swigCPtr, count);
780 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
783 internal int GetLoopCount()
785 int ret = NDalicPINVOKE.Animation_GetLoopCount(swigCPtr);
786 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
790 internal int GetCurrentLoop()
792 int ret = NDalicPINVOKE.Animation_GetCurrentLoop(swigCPtr);
793 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
797 internal bool IsLooping()
799 bool ret = NDalicPINVOKE.Animation_IsLooping(swigCPtr);
800 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
804 internal void SetEndAction(Animation.EndActions action)
806 NDalicPINVOKE.Animation_SetEndAction(swigCPtr, (int)action);
807 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
810 internal Animation.EndActions GetEndAction()
812 Animation.EndActions ret = (Animation.EndActions)NDalicPINVOKE.Animation_GetEndAction(swigCPtr);
813 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
817 internal void SetDisconnectAction(Animation.EndActions disconnectAction)
819 NDalicPINVOKE.Animation_SetDisconnectAction(swigCPtr, (int)disconnectAction);
820 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
823 internal Animation.EndActions GetDisconnectAction()
825 Animation.EndActions ret = (Animation.EndActions)NDalicPINVOKE.Animation_GetDisconnectAction(swigCPtr);
826 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
830 internal void SetDefaultAlphaFunction(AlphaFunction alpha)
832 NDalicPINVOKE.Animation_SetDefaultAlphaFunction(swigCPtr, AlphaFunction.getCPtr(alpha));
833 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
836 internal AlphaFunction GetDefaultAlphaFunction()
838 AlphaFunction ret = new AlphaFunction(NDalicPINVOKE.Animation_GetDefaultAlphaFunction(swigCPtr), true);
839 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
843 internal void SetCurrentProgress(float progress)
845 NDalicPINVOKE.Animation_SetCurrentProgress(swigCPtr, progress);
846 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
849 internal float GetCurrentProgress()
851 float ret = NDalicPINVOKE.Animation_GetCurrentProgress(swigCPtr);
852 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
856 internal void SetSpeedFactor(float factor)
858 NDalicPINVOKE.Animation_SetSpeedFactor(swigCPtr, factor);
859 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
862 internal float GetSpeedFactor()
864 float ret = NDalicPINVOKE.Animation_GetSpeedFactor(swigCPtr);
865 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
869 internal void SetPlayRange(Vector2 range)
871 NDalicPINVOKE.Animation_SetPlayRange(swigCPtr, Vector2.getCPtr(range));
872 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
875 internal Vector2 GetPlayRange()
877 Vector2 ret = new Vector2(NDalicPINVOKE.Animation_GetPlayRange(swigCPtr), true);
878 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
882 private static bool? disableAnimation = null;
883 private bool DisableAnimation
887 if (disableAnimation.HasValue == false)
889 string type = Environment.GetEnvironmentVariable("PlatformSmartType");
891 disableAnimation = true;
893 disableAnimation = false;
895 return disableAnimation.Value;
900 /// Plays the animation.
902 /// <since_tizen> 3 </since_tizen>
905 NDalicPINVOKE.Animation_Play(swigCPtr);
906 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
908 if (DisableAnimation == true)
909 Stop(EndActions.StopFinal);
913 /// Plays the animation from a given point.<br />
914 /// The progress must be in the 0-1 interval or in the play range interval if defined,
915 /// otherwise, it will be ignored.<br />
917 /// <param name="progress">A value between [0,1], or between the play range if specified, from where the animation should start playing.</param>
918 /// <since_tizen> 3 </since_tizen>
919 public void PlayFrom(float progress)
921 NDalicPINVOKE.Animation_PlayFrom(swigCPtr, progress);
922 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
926 /// Plays the animation after a given delay time.<br/>
927 /// The delay time is not included in the looping time.<br/>
928 /// When the delay time is a negative value, it would treat as play immediately.<br/>
930 /// <param name="delayMilliseconds">The delay time.</param>
931 /// <since_tizen> 4 </since_tizen>
932 public void PlayAfter(int delayMilliseconds)
934 NDalicPINVOKE.Animation_PlayAfter(swigCPtr, MilliSecondsToSeconds(delayMilliseconds));
935 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
939 /// Pauses the animation.
941 /// <since_tizen> 3 </since_tizen>
944 NDalicPINVOKE.Animation_Pause(swigCPtr);
945 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
948 internal Animation.States GetState()
950 Animation.States ret = (Animation.States)NDalicPINVOKE.Animation_GetState(swigCPtr);
951 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
956 /// Stops the animation.
958 /// <since_tizen> 3 </since_tizen>
961 NDalicPINVOKE.Animation_Stop(swigCPtr);
962 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
966 /// Clears the animation.<br />
967 /// This disconnects any objects that were being animated, effectively stopping the animation.<br />
969 /// <since_tizen> 3 </since_tizen>
972 NDalicPINVOKE.Animation_Clear(swigCPtr);
973 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
976 internal AnimationSignal FinishedSignal()
978 AnimationSignal ret = new AnimationSignal(NDalicPINVOKE.Animation_FinishedSignal(swigCPtr), false);
979 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
983 internal AnimationSignal ProgressReachedSignal()
985 AnimationSignal ret = new AnimationSignal(NDalicPINVOKE.Animation_ProgressReachedSignal(swigCPtr), false);
986 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
990 internal void AnimateBy(Property target, PropertyValue relativeValue)
992 NDalicPINVOKE.Animation_AnimateBy__SWIG_0(swigCPtr, Property.getCPtr(target), PropertyValue.getCPtr(relativeValue));
993 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
996 internal void AnimateBy(Property target, PropertyValue relativeValue, AlphaFunction alpha)
998 NDalicPINVOKE.Animation_AnimateBy__SWIG_1(swigCPtr, Property.getCPtr(target), PropertyValue.getCPtr(relativeValue), AlphaFunction.getCPtr(alpha));
999 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1002 internal void AnimateBy(Property target, PropertyValue relativeValue, TimePeriod period)
1004 NDalicPINVOKE.Animation_AnimateBy__SWIG_2(swigCPtr, Property.getCPtr(target), PropertyValue.getCPtr(relativeValue), TimePeriod.getCPtr(period));
1005 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1008 internal void AnimateBy(Property target, PropertyValue relativeValue, AlphaFunction alpha, TimePeriod period)
1010 NDalicPINVOKE.Animation_AnimateBy__SWIG_3(swigCPtr, Property.getCPtr(target), PropertyValue.getCPtr(relativeValue), AlphaFunction.getCPtr(alpha), TimePeriod.getCPtr(period));
1011 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1014 internal void AnimateTo(Property target, PropertyValue destinationValue)
1016 NDalicPINVOKE.Animation_AnimateTo__SWIG_0(swigCPtr, Property.getCPtr(target), PropertyValue.getCPtr(destinationValue));
1017 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1020 internal void AnimateTo(Property target, PropertyValue destinationValue, AlphaFunction alpha)
1022 NDalicPINVOKE.Animation_AnimateTo__SWIG_1(swigCPtr, Property.getCPtr(target), PropertyValue.getCPtr(destinationValue), AlphaFunction.getCPtr(alpha));
1023 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1026 internal void AnimateTo(Property target, PropertyValue destinationValue, TimePeriod period)
1028 NDalicPINVOKE.Animation_AnimateTo__SWIG_2(swigCPtr, Property.getCPtr(target), PropertyValue.getCPtr(destinationValue), TimePeriod.getCPtr(period));
1029 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1032 internal void AnimateTo(Property target, PropertyValue destinationValue, AlphaFunction alpha, TimePeriod period)
1034 NDalicPINVOKE.Animation_AnimateTo__SWIG_3(swigCPtr, Property.getCPtr(target), PropertyValue.getCPtr(destinationValue), AlphaFunction.getCPtr(alpha), TimePeriod.getCPtr(period));
1035 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1038 internal void AnimateBetween(Property target, KeyFrames keyFrames)
1040 NDalicPINVOKE.Animation_AnimateBetween__SWIG_0(swigCPtr, Property.getCPtr(target), KeyFrames.getCPtr(keyFrames));
1041 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1044 internal void AnimateBetween(Property target, KeyFrames keyFrames, Animation.Interpolation interpolation)
1046 NDalicPINVOKE.Animation_AnimateBetween__SWIG_1(swigCPtr, Property.getCPtr(target), KeyFrames.getCPtr(keyFrames), (int)interpolation);
1047 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1050 internal void AnimateBetween(Property target, KeyFrames keyFrames, AlphaFunction alpha)
1052 NDalicPINVOKE.Animation_AnimateBetween__SWIG_2(swigCPtr, Property.getCPtr(target), KeyFrames.getCPtr(keyFrames), AlphaFunction.getCPtr(alpha));
1053 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1056 internal void AnimateBetween(Property target, KeyFrames keyFrames, AlphaFunction alpha, Animation.Interpolation interpolation)
1058 NDalicPINVOKE.Animation_AnimateBetween__SWIG_3(swigCPtr, Property.getCPtr(target), KeyFrames.getCPtr(keyFrames), AlphaFunction.getCPtr(alpha), (int)interpolation);
1059 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1062 internal void AnimateBetween(Property target, KeyFrames keyFrames, TimePeriod period)
1064 NDalicPINVOKE.Animation_AnimateBetween__SWIG_4(swigCPtr, Property.getCPtr(target), KeyFrames.getCPtr(keyFrames), TimePeriod.getCPtr(period));
1065 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1068 internal void AnimateBetween(Property target, KeyFrames keyFrames, TimePeriod period, Animation.Interpolation interpolation)
1070 NDalicPINVOKE.Animation_AnimateBetween__SWIG_5(swigCPtr, Property.getCPtr(target), KeyFrames.getCPtr(keyFrames), TimePeriod.getCPtr(period), (int)interpolation);
1071 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1074 internal void AnimateBetween(Property target, KeyFrames keyFrames, AlphaFunction alpha, TimePeriod period)
1076 NDalicPINVOKE.Animation_AnimateBetween__SWIG_6(swigCPtr, Property.getCPtr(target), KeyFrames.getCPtr(keyFrames), AlphaFunction.getCPtr(alpha), TimePeriod.getCPtr(period));
1077 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1080 internal void AnimateBetween(Property target, KeyFrames keyFrames, AlphaFunction alpha, TimePeriod period, Animation.Interpolation interpolation)
1082 NDalicPINVOKE.Animation_AnimateBetween__SWIG_7(swigCPtr, Property.getCPtr(target), KeyFrames.getCPtr(keyFrames), AlphaFunction.getCPtr(alpha), TimePeriod.getCPtr(period), (int)interpolation);
1083 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1086 internal void Animate(View view, Path path, Vector3 forward)
1088 NDalicPINVOKE.Animation_Animate__SWIG_0(swigCPtr, View.getCPtr(view), Path.getCPtr(path), Vector3.getCPtr(forward));
1089 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1092 internal void Animate(View view, Path path, Vector3 forward, AlphaFunction alpha)
1094 NDalicPINVOKE.Animation_Animate__SWIG_1(swigCPtr, View.getCPtr(view), Path.getCPtr(path), Vector3.getCPtr(forward), AlphaFunction.getCPtr(alpha));
1095 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1098 internal void Animate(View view, Path path, Vector3 forward, TimePeriod period)
1100 NDalicPINVOKE.Animation_Animate__SWIG_2(swigCPtr, View.getCPtr(view), Path.getCPtr(path), Vector3.getCPtr(forward), TimePeriod.getCPtr(period));
1101 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1104 internal void Animate(View view, Path path, Vector3 forward, AlphaFunction alpha, TimePeriod period)
1106 NDalicPINVOKE.Animation_Animate__SWIG_3(swigCPtr, View.getCPtr(view), Path.getCPtr(path), Vector3.getCPtr(forward), AlphaFunction.getCPtr(alpha), TimePeriod.getCPtr(period));
1107 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1110 internal void Show(View view, float delaySeconds)
1112 NDalicPINVOKE.Animation_Show(swigCPtr, View.getCPtr(view), delaySeconds);
1113 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1116 internal void Hide(View view, float delaySeconds)
1118 NDalicPINVOKE.Animation_Hide(swigCPtr, View.getCPtr(view), delaySeconds);
1119 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1123 /// Enumeration for what to do when the animation ends, stopped, or destroyed.
1125 /// <since_tizen> 3 </since_tizen>
1126 public enum EndActions
1129 /// When the animation ends, the animated property values are saved.
1133 /// When the animation ends, the animated property values are forgotten.
1137 /// If the animation is stopped, the animated property values are saved as if the animation had run to completion, otherwise behaves like cancel.
1143 /// Enumeration for what interpolation method to use on key-frame animations.
1145 /// <since_tizen> 3 </since_tizen>
1146 public enum Interpolation
1149 /// Values in between key frames are interpolated using a linear polynomial. (Default)
1153 /// Values in between key frames are interpolated using a cubic polynomial.
1159 /// Enumeration for what state the animation is in.
1161 /// <remarks>Calling Reset() on this class will not reset the animation. It will call the BaseHandle.Reset() which drops the object handle.</remarks>
1162 /// <since_tizen> 3 </since_tizen>
1166 /// The animation has stopped.
1170 /// The animation is playing.
1174 /// The animation is paused.