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);
42 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Animation obj)
44 return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
48 /// To make animation instance be disposed.
50 /// <since_tizen> 3 </since_tizen>
51 protected override void Dispose(DisposeTypes type)
57 if(type == DisposeTypes.Explicit)
60 //Release your own managed resources here.
61 //You should release all of your own disposable objects here.
64 else if(type == DisposeTypes.Implicit)
69 if (_animationFinishedEventCallback != null)
71 FinishedSignal().Disconnect(_animationFinishedEventCallback);
74 if (_animationProgressReachedEventCallback != null)
77 ProgressReachedSignal().Disconnect(_animationProgressReachedEventCallback);
84 NUILog.Error("Now Animation is playing! Clear and Reset here!");
85 //throw new System.InvalidOperationException("Animation Instance should not be disposed until getting Finished event. Should be a global variable");
88 //Release your own unmanaged resources here.
89 //You should not access any managed member here except static instance.
90 //because the execution order of Finalizes is non-deterministic.
92 if (swigCPtr.Handle != global::System.IntPtr.Zero)
97 NDalicPINVOKE.delete_Animation(swigCPtr);
99 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
106 /// Creates an initialized animation.<br />
107 /// The animation will not loop.<br />
108 /// The default end action is "Cancel".<br />
109 /// The default alpha function is linear.<br />
111 /// <remarks>DurationmSeconds must be greater than zero.</remarks>
112 /// <param name="durationMilliSeconds">The duration in milliseconds.</param>
113 /// <since_tizen> 3 </since_tizen>
114 public Animation(int durationMilliSeconds) : this(NDalicPINVOKE.Animation_New((float)durationMilliSeconds / 1000.0f), true)
116 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
119 private AnimationFinishedEventCallbackType _animationFinishedEventCallback;
120 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
121 private delegate void AnimationFinishedEventCallbackType(IntPtr data);
122 private event EventHandler _animationFinishedEventHandler;
124 * @brief Event for the finished signal which can be used to subscribe or unsubscribe the event handler.
125 * The finished signal is emitted when an animation's animations have finished.
127 /// <since_tizen> 3 </since_tizen>
128 public event EventHandler Finished
132 if (_animationFinishedEventHandler == null)
134 NUILog.Debug("[add before]FinishedSignal().Empty=" + FinishedSignal().Empty() + " GetConnectionCount=" + FinishedSignal().GetConnectionCount());
135 _animationFinishedEventCallback = OnFinished;
136 FinishedSignal().Connect(_animationFinishedEventCallback);
137 NUILog.Debug("[add after]FinishedSignal().Empty=" + FinishedSignal().Empty() + " GetConnectionCount=" + FinishedSignal().GetConnectionCount());
139 _animationFinishedEventHandler += value;
143 _animationFinishedEventHandler -= value;
145 if (_animationFinishedEventHandler == null && FinishedSignal().Empty() == false)
147 NUILog.Debug("[remove before]FinishedSignal().Empty=" + FinishedSignal().Empty() + " GetConnectionCount=" + FinishedSignal().GetConnectionCount());
148 FinishedSignal().Disconnect(_animationFinishedEventCallback);
149 NUILog.Debug("[remove after]FinishedSignal().Empty=" + FinishedSignal().Empty() + " GetConnectionCount=" + FinishedSignal().GetConnectionCount());
153 private void OnFinished(IntPtr data)
155 if (_animationFinishedEventHandler != null)
157 //here we send all data to user event handlers
158 _animationFinishedEventHandler(this, null);
162 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
163 private delegate void AnimationProgressReachedEventCallbackType(IntPtr data);
164 private AnimationProgressReachedEventCallbackType _animationProgressReachedEventCallback;
165 private event EventHandler _animationProgressReachedEventHandler;
167 * @brief Event for the ProgressReached signal, which can be used to subscribe or unsubscribe the event handler.
168 * The ProgressReached signal is emitted when the animation has reached a given progress percentage, this is set in the api SetProgressNotification.
170 /// <since_tizen> 3 </since_tizen>
171 public event EventHandler ProgressReached
175 if (_animationProgressReachedEventHandler == null)
177 NUILog.Debug("[add before]ProgressReachedSignal().Empty=" + FinishedSignal().Empty() + " GetConnectionCount=" + FinishedSignal().GetConnectionCount());
178 _animationProgressReachedEventCallback = OnProgressReached;
179 ProgressReachedSignal().Connect(_animationProgressReachedEventCallback);
180 NUILog.Debug("[add after]ProgressReachedSignal().Empty=" + FinishedSignal().Empty() + " GetConnectionCount=" + FinishedSignal().GetConnectionCount());
183 _animationProgressReachedEventHandler += value;
187 _animationProgressReachedEventHandler -= value;
189 if (_animationProgressReachedEventHandler == null && ProgressReachedSignal().Empty() == false)
191 NUILog.Debug("[remove before]ProgressReachedSignal().Empty=" + FinishedSignal().Empty() + " GetConnectionCount=" + FinishedSignal().GetConnectionCount());
192 ProgressReachedSignal().Disconnect(_animationProgressReachedEventCallback);
193 NUILog.Debug("[remove after]ProgressReachedSignal().Empty=" + FinishedSignal().Empty() + " GetConnectionCount=" + FinishedSignal().GetConnectionCount());
197 private void OnProgressReached(IntPtr data)
199 if (_animationProgressReachedEventHandler != null)
201 //here we send all data to user event handlers
202 _animationProgressReachedEventHandler(this, null);
206 private float MilliSecondsToSeconds(int millisec)
208 return (float)millisec / 1000.0f;
211 private int SecondsToMilliSeconds(float sec)
213 return (int)(sec * 1000);
218 /// Gets or sets the duration in milliseconds of the animation.
220 /// <since_tizen> 3 </since_tizen>
225 SetDuration(MilliSecondsToSeconds(value));
229 return SecondsToMilliSeconds(GetDuration());
234 /// Gets or sets the default alpha function for the animation.
236 /// <since_tizen> 3 </since_tizen>
237 public AlphaFunction DefaultAlphaFunction
241 SetDefaultAlphaFunction(value);
245 AlphaFunction ret = GetDefaultAlphaFunction();
251 /// Queries the state of the animation.
253 /// <since_tizen> 3 </since_tizen>
263 /// Set: Enables looping for 'count' repeats. A zero is the same as Looping = true; i.e., repeat forever.<br />
264 /// If Play() Stop() or 'count' loops is reached, the loop counter will reset.<br />
265 /// Setting this parameter does not cause the animation to Play().<br />
266 /// Get: Gets the loop count. A zero is the same as Looping = true; i.e., repeat forever.<br />
267 /// The loop count is initially 1 for play once.<br />
269 /// <since_tizen> 3 </since_tizen>
278 int ret = GetLoopCount();
284 /// Gets or sets the status of whether the animation will loop.<br />
285 /// This property resets the loop count and should not be used with the LoopCount property.<br />
286 /// Setting this parameter does not cause the animation to Play().<br />
288 /// <since_tizen> 3 </since_tizen>
297 bool ret = IsLooping();
304 /// Gets or sets the end action of the animation.<br />
305 /// This action is performed when the animation ends or if it is stopped.<br />
306 /// The default end action is cancel.<br />
308 /// <since_tizen> 3 </since_tizen>
309 public EndActions EndAction
317 return GetEndAction();
323 /// Stops the animation.
325 /// <param name="action">The end action can be set.</param>
326 /// <since_tizen> 3 </since_tizen>
327 public void Stop(EndActions action = EndActions.Cancel)
329 SetEndAction(action);
330 NDalicPINVOKE.Animation_Stop(swigCPtr);
331 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
335 /// Gets the current loop count.<br />
336 /// A value 0 indicating the current loop count when looping.<br />
338 /// <since_tizen> 3 </since_tizen>
339 public int CurrentLoop
343 return GetCurrentLoop();
348 /// Gets or sets the disconnect action.<br />
349 /// If any of the animated property owners are disconnected from the stage while the animation is being played, then this action is performed.<br />
350 /// The default action is cancel.<br />
352 /// <since_tizen> 3 </since_tizen>
353 public EndActions DisconnectAction
357 NDalicPINVOKE.Animation_SetDisconnectAction(swigCPtr, (int)value);
358 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
362 Animation.EndActions ret = (Animation.EndActions)NDalicPINVOKE.Animation_GetDisconnectAction(swigCPtr);
363 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
370 /// Gets or sets the progress of the animation.<br />
371 /// The animation will play (or continue playing) from this point.<br />
372 /// The progress must be in the 0-1 interval or in the play range interval if defined<br />
373 /// otherwise, it will be ignored.<br />
375 /// <since_tizen> 3 </since_tizen>
376 public float CurrentProgress
380 NDalicPINVOKE.Animation_SetCurrentProgress(swigCPtr, value);
381 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
385 float ret = NDalicPINVOKE.Animation_GetCurrentProgress(swigCPtr);
386 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
392 /// Gets or sets specificifications of a speed factor for the animation.<br />
393 /// The speed factor is a multiplier of the normal velocity of the animation.<br />
394 /// Values between [0, 1] will slow down the animation and values above one will speed up the animation.<br />
395 /// It is also possible to specify a negative multiplier to play the animation in reverse.<br />
397 /// <since_tizen> 3 </since_tizen>
398 public float SpeedFactor
402 NDalicPINVOKE.Animation_SetSpeedFactor(swigCPtr, value);
403 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
407 float ret = NDalicPINVOKE.Animation_GetSpeedFactor(swigCPtr);
408 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
414 /// Gets or sets the playing range.<br />
415 /// Animation will play between the values specified. Both values (range.x and range.y ) should be between 0-1,
416 /// otherwise they will be ignored. If the range provided is not in proper order (minimum, maximum ), it will be reordered.<br />
418 /// <since_tizen> 3 </since_tizen>
419 public RelativeVector2 PlayRange
423 NDalicPINVOKE.Animation_SetPlayRange(swigCPtr, Vector2.getCPtr(value));
424 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
428 Vector2 ret = new Vector2(NDalicPINVOKE.Animation_GetPlayRange(swigCPtr), true);
429 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
436 /// Gets or sets the progress notification marker which triggers the ProgressReachedSignal.<br />
437 /// Percentage of animation progress should be greater than 0 and less than 1, for example, 0.3 for 30% <br />
438 /// One notification can be set on each animation.
440 /// <since_tizen> 3 </since_tizen>
441 public float ProgressNotification
445 NDalicPINVOKE.Animation_SetProgressNotification(swigCPtr, value);
446 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
450 float ret = NDalicPINVOKE.Animation_GetProgressNotification(swigCPtr);
451 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
457 /// Animates a property value by a relative amount.<br />
459 /// <param name="target">The target object to animate.</param>
460 /// <param name="property">The target property to animate.</param>
461 /// <param name="relativeValue">The property value will change by this amount.</param>
462 /// <param name="alphaFunction">The alpha function to apply.</param>
463 /// <since_tizen> 3 </since_tizen>
464 public void AnimateBy(View target, string property, object relativeValue, AlphaFunction alphaFunction = null)
466 Property _prop = PropertyHelper.GetPropertyFromString(target, property);
468 PropertyType propertyType = target.GetPropertyType(_prop.propertyIndex);
469 if(propertyType.Equals(PropertyType.Float))
471 System.Type type = relativeValue.GetType();
472 if (type.Equals(typeof(System.Int32)) || type.Equals(typeof(int)))
474 int num = (int)relativeValue;
475 relativeValue = (float)num;
479 PropertyValue val = PropertyValue.CreateFromObject(relativeValue);
481 if (alphaFunction != null)
483 AnimateBy(_prop, val, alphaFunction);
487 AnimateBy(_prop, val);
492 /// Animates a property value by a relative amount.<br />
494 /// <param name="target">The target object to animate.</param>
495 /// <param name="property">The target property to animate.</param>
496 /// <param name="relativeValue">The property value will change by this amount.</param>
497 /// <param name="startTime">The start time of the animation.</param>
498 /// <param name="endTime">The end time of the animation.</param>
499 /// <param name="alphaFunction">The alpha function to apply.</param>
500 /// <since_tizen> 3 </since_tizen>
501 public void AnimateBy(View target, string property, object relativeValue, int startTime, int endTime, AlphaFunction alphaFunction = null)
503 Property _prop = PropertyHelper.GetPropertyFromString(target, property);
505 PropertyType propertyType = target.GetPropertyType(_prop.propertyIndex);
506 if(propertyType.Equals(PropertyType.Float))
508 System.Type type = relativeValue.GetType();
509 if (type.Equals(typeof(System.Int32)) || type.Equals(typeof(int)))
511 int num = (int)relativeValue;
512 relativeValue = (float)num;
516 PropertyValue val = PropertyValue.CreateFromObject(relativeValue);
518 if (alphaFunction != null)
520 Tizen.NUI.TimePeriod time = new Tizen.NUI.TimePeriod(MilliSecondsToSeconds(startTime), MilliSecondsToSeconds(endTime - startTime));
521 AnimateBy(_prop, val, alphaFunction, time);
525 Tizen.NUI.TimePeriod time = new Tizen.NUI.TimePeriod(MilliSecondsToSeconds(startTime), MilliSecondsToSeconds(endTime - startTime));
526 AnimateBy(_prop, val, time);
531 /// Animates a property to a destination value.<br />
533 /// <param name="target">The target object to animate.</param>
534 /// <param name="property">The target property to animate.</param>
535 /// <param name="destinationValue">The destination value.</param>
536 /// <param name="alphaFunction">The alpha function to apply.</param>
537 /// <since_tizen> 3 </since_tizen>
538 public void AnimateTo(View target, string property, object destinationValue, AlphaFunction alphaFunction = null)
540 Property _prop = PropertyHelper.GetPropertyFromString(target, property);
542 PropertyType propertyType = target.GetPropertyType(_prop.propertyIndex);
543 if(propertyType.Equals(PropertyType.Float))
545 System.Type type = destinationValue.GetType();
546 if (type.Equals(typeof(System.Int32)) || type.Equals(typeof(int)))
548 int num = (int)destinationValue;
549 destinationValue = (float)num;
553 PropertyValue val = PropertyValue.CreateFromObject(destinationValue);
555 if (alphaFunction != null)
557 AnimateTo(_prop, val, alphaFunction);
561 AnimateTo(_prop, val);
566 /// Animates a property to a destination value.<br />
568 /// <param name="target">The target object to animate.</param>
569 /// <param name="property">The target property to animate.</param>
570 /// <param name="destinationValue">The destination value.</param>
571 /// <param name="startTime">The start time of the animation.</param>
572 /// <param name="endTime">The end time of the animation.</param>
573 /// <param name="alphaFunction">The alpha function to apply.</param>
574 /// <since_tizen> 3 </since_tizen>
575 public void AnimateTo(View target, string property, object destinationValue, int startTime, int endTime, AlphaFunction alphaFunction = null)
577 Property _prop = PropertyHelper.GetPropertyFromString(target, property);
579 PropertyType propertyType = target.GetPropertyType(_prop.propertyIndex);
580 if(propertyType.Equals(PropertyType.Float))
582 System.Type type = destinationValue.GetType();
583 if (type.Equals(typeof(System.Int32)) || type.Equals(typeof(int)))
585 int num = (int)destinationValue;
586 destinationValue = (float)num;
590 PropertyValue val = PropertyValue.CreateFromObject(destinationValue);
592 if (alphaFunction != null)
594 Tizen.NUI.TimePeriod time = new Tizen.NUI.TimePeriod(MilliSecondsToSeconds(startTime), MilliSecondsToSeconds(endTime - startTime));
595 AnimateTo(_prop, val, alphaFunction, time);
599 Tizen.NUI.TimePeriod time = new Tizen.NUI.TimePeriod(MilliSecondsToSeconds(startTime), MilliSecondsToSeconds(endTime - startTime));
600 AnimateTo(_prop, val, time);
605 /// Animates a property between keyframes.
607 /// <param name="target">The target object to animate.</param>
608 /// <param name="property">The target property to animate.</param>
609 /// <param name="keyFrames">The set of time or value pairs between which to animate.</param>
610 /// <param name="interpolation">The method used to interpolate between values.</param>
611 /// <param name="alphaFunction">The alpha function to apply.</param>
612 /// <since_tizen> 3 </since_tizen>
613 public void AnimateBetween(View target, string property, KeyFrames keyFrames, Interpolation interpolation = Interpolation.Linear, AlphaFunction alphaFunction = null)
615 Property _prop = PropertyHelper.GetPropertyFromString(target, property);
617 if (_prop.propertyIndex == Property.INVALID_INDEX)
619 throw new System.ArgumentException("second argument string property is invalid parameter!");
622 if (alphaFunction != null)
624 AnimateBetween(_prop, keyFrames, alphaFunction, interpolation);
628 AnimateBetween(_prop, keyFrames, interpolation);
634 /// Animates a property between keyframes.
636 /// <param name="target">The target object to animate</param>
637 /// <param name="property">The target property to animate</param>
638 /// <param name="keyFrames">The set of time/value pairs between which to animate</param>
639 /// <param name="startTime">The start time of animation in milliseconds.</param>
640 /// <param name="endTime">The end time of animation in milliseconds.</param>
641 /// <param name="interpolation">The method used to interpolate between values.</param>
642 /// <param name="alphaFunction">The alpha function to apply.</param>
643 /// <since_tizen> 3 </since_tizen>
644 public void AnimateBetween(View target, string property, KeyFrames keyFrames, int startTime, int endTime, Interpolation interpolation = Interpolation.Linear, AlphaFunction alphaFunction = null)
646 Property _prop = PropertyHelper.GetPropertyFromString(target, property);
648 Tizen.NUI.TimePeriod time = new Tizen.NUI.TimePeriod(MilliSecondsToSeconds(startTime), MilliSecondsToSeconds(endTime - startTime));
649 if (alphaFunction != null)
651 AnimateBetween(_prop, keyFrames, alphaFunction, time, interpolation);
655 AnimateBetween(_prop, keyFrames, time, interpolation);
660 /// Animates the view's position and orientation through a predefined path.<br />
661 /// The view will rotate to orient the supplied forward vector with the path's tangent.<br />
662 /// If forward is the zero vector then no rotation will happen.<br />
664 /// <param name="view">The view to animate.</param>
665 /// <param name="path">It defines position and orientation.</param>
666 /// <param name="forward">The vector (in local space coordinate system) will be oriented with the path's tangent direction.</param>
667 /// <param name="alphaFunction">The alpha function to apply.</param>
668 /// <since_tizen> 3 </since_tizen>
669 public void AnimatePath(View view, Path path, Vector3 forward, AlphaFunction alphaFunction = null)
671 if (alphaFunction == null)
673 Animate(view, path, forward);
677 Animate(view, path, forward, alphaFunction);
682 /// Animates the view's position and orientation through a predefined path.<br />
683 /// The view will rotate to orient the supplied forward vector with the path's tangent.<br />
684 /// If forward is the zero vector then no rotation will happen.<br />
686 /// <param name="view">The view to animate.</param>
687 /// <param name="path">It defines position and orientation.</param>
688 /// <param name="forward">The vector (in local space coordinate system) will be oriented with the path's tangent direction.</param>
689 /// <param name="startTime">The start time of the animation.</param>
690 /// <param name="endTime">The end time of the animation.</param>
691 /// <param name="alphaFunction">The alpha function to apply.</param>
692 /// <since_tizen> 3 </since_tizen>
693 public void AnimatePath(View view, Path path, Vector3 forward, int startTime, int endTime, AlphaFunction alphaFunction = null)
695 TimePeriod time = new TimePeriod(MilliSecondsToSeconds(startTime), MilliSecondsToSeconds(endTime - startTime));
696 if (alphaFunction == null)
698 Animate(view, path, forward, time);
702 Animate(view, path, forward, alphaFunction, time);
707 /// Creates an initialized animation.<br />
708 /// The animation will not loop.<br />
709 /// The default end action is "Cancel".<br />
710 /// The default alpha function is linear.<br />
712 /// <since_tizen> 3 </since_tizen>
713 public Animation() : this(NDalicPINVOKE.Animation_New(0.0f), true)
715 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
718 internal Animation(float durationSeconds) : this(NDalicPINVOKE.Animation_New(durationSeconds), true)
720 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
725 /// Downcasts a handle to animation handle.<br />
726 /// If handle points to an animation object, the downcast produces a valid handle.<br />
727 /// If not, the returned handle is left uninitialized.<br />
729 /// <param name="handle">Handle to an object.</param>
730 /// <returns>Handle to an animation object or an uninitialized handle.</returns>
731 /// <since_tizen> 3 </since_tizen>
732 public static Animation DownCast(BaseHandle handle)
734 Animation ret = Registry.GetManagedBaseHandleFromNativePtr(handle) as Animation;
735 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
739 internal Animation(Animation handle) : this(NDalicPINVOKE.new_Animation__SWIG_1(Animation.getCPtr(handle)), true)
741 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
744 internal Animation Assign(Animation rhs)
746 Animation ret = new Animation(NDalicPINVOKE.Animation_Assign(swigCPtr, Animation.getCPtr(rhs)), false);
747 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
751 internal void SetDuration(float seconds)
753 NDalicPINVOKE.Animation_SetDuration(swigCPtr, seconds);
754 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
757 internal float GetDuration()
759 float ret = NDalicPINVOKE.Animation_GetDuration(swigCPtr);
760 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
764 internal void SetLooping(bool looping)
766 NDalicPINVOKE.Animation_SetLooping(swigCPtr, looping);
767 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
770 internal void SetLoopCount(int count)
772 NDalicPINVOKE.Animation_SetLoopCount(swigCPtr, count);
773 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
776 internal int GetLoopCount()
778 int ret = NDalicPINVOKE.Animation_GetLoopCount(swigCPtr);
779 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
783 internal int GetCurrentLoop()
785 int ret = NDalicPINVOKE.Animation_GetCurrentLoop(swigCPtr);
786 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
790 internal bool IsLooping()
792 bool ret = NDalicPINVOKE.Animation_IsLooping(swigCPtr);
793 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
797 internal void SetEndAction(Animation.EndActions action)
799 NDalicPINVOKE.Animation_SetEndAction(swigCPtr, (int)action);
800 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
803 internal Animation.EndActions GetEndAction()
805 Animation.EndActions ret = (Animation.EndActions)NDalicPINVOKE.Animation_GetEndAction(swigCPtr);
806 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
810 internal void SetDisconnectAction(Animation.EndActions disconnectAction)
812 NDalicPINVOKE.Animation_SetDisconnectAction(swigCPtr, (int)disconnectAction);
813 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
816 internal Animation.EndActions GetDisconnectAction()
818 Animation.EndActions ret = (Animation.EndActions)NDalicPINVOKE.Animation_GetDisconnectAction(swigCPtr);
819 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
823 internal void SetDefaultAlphaFunction(AlphaFunction alpha)
825 NDalicPINVOKE.Animation_SetDefaultAlphaFunction(swigCPtr, AlphaFunction.getCPtr(alpha));
826 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
829 internal AlphaFunction GetDefaultAlphaFunction()
831 AlphaFunction ret = new AlphaFunction(NDalicPINVOKE.Animation_GetDefaultAlphaFunction(swigCPtr), true);
832 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
836 internal void SetCurrentProgress(float progress)
838 NDalicPINVOKE.Animation_SetCurrentProgress(swigCPtr, progress);
839 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
842 internal float GetCurrentProgress()
844 float ret = NDalicPINVOKE.Animation_GetCurrentProgress(swigCPtr);
845 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
849 internal void SetSpeedFactor(float factor)
851 NDalicPINVOKE.Animation_SetSpeedFactor(swigCPtr, factor);
852 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
855 internal float GetSpeedFactor()
857 float ret = NDalicPINVOKE.Animation_GetSpeedFactor(swigCPtr);
858 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
862 internal void SetPlayRange(Vector2 range)
864 NDalicPINVOKE.Animation_SetPlayRange(swigCPtr, Vector2.getCPtr(range));
865 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
868 internal Vector2 GetPlayRange()
870 Vector2 ret = new Vector2(NDalicPINVOKE.Animation_GetPlayRange(swigCPtr), true);
871 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
875 private static bool? disableAnimation = null;
876 private bool DisableAnimation
880 if (disableAnimation.HasValue == false)
882 string type = Environment.GetEnvironmentVariable("PlatformSmartType");
884 disableAnimation = true;
886 disableAnimation = false;
888 return disableAnimation.Value;
893 /// Plays the animation.
895 /// <since_tizen> 3 </since_tizen>
898 NDalicPINVOKE.Animation_Play(swigCPtr);
899 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
901 if (DisableAnimation == true)
902 Stop(EndActions.StopFinal);
906 /// Plays the animation from a given point.<br />
907 /// The progress must be in the 0-1 interval or in the play range interval if defined,
908 /// otherwise, it will be ignored.<br />
910 /// <param name="progress">A value between [0,1], or between the play range if specified, from where the animation should start playing.</param>
911 /// <since_tizen> 3 </since_tizen>
912 public void PlayFrom(float progress)
914 NDalicPINVOKE.Animation_PlayFrom(swigCPtr, progress);
915 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
919 /// Plays the animation after a given delay time.<br/>
920 /// The delay time is not included in the looping time.<br/>
921 /// When the delay time is a negative value, it would treat as play immediately.<br/>
923 /// <param name="delayMilliseconds">The delay time.</param>
924 /// <since_tizen> 4 </since_tizen>
925 public void PlayAfter(int delayMilliseconds)
927 NDalicPINVOKE.Animation_PlayAfter(swigCPtr, MilliSecondsToSeconds(delayMilliseconds));
928 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
932 /// Pauses the animation.
934 /// <since_tizen> 3 </since_tizen>
937 NDalicPINVOKE.Animation_Pause(swigCPtr);
938 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
941 internal Animation.States GetState()
943 Animation.States ret = (Animation.States)NDalicPINVOKE.Animation_GetState(swigCPtr);
944 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
949 /// Stops the animation.
951 /// <since_tizen> 3 </since_tizen>
954 NDalicPINVOKE.Animation_Stop(swigCPtr);
955 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
959 /// Clears the animation.<br />
960 /// This disconnects any objects that were being animated, effectively stopping the animation.<br />
962 /// <since_tizen> 3 </since_tizen>
965 NDalicPINVOKE.Animation_Clear(swigCPtr);
966 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
969 internal AnimationSignal FinishedSignal()
971 AnimationSignal ret = new AnimationSignal(NDalicPINVOKE.Animation_FinishedSignal(swigCPtr), false);
972 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
976 internal AnimationSignal ProgressReachedSignal()
978 AnimationSignal ret = new AnimationSignal(NDalicPINVOKE.Animation_ProgressReachedSignal(swigCPtr), false);
979 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
983 internal void AnimateBy(Property target, PropertyValue relativeValue)
985 NDalicPINVOKE.Animation_AnimateBy__SWIG_0(swigCPtr, Property.getCPtr(target), PropertyValue.getCPtr(relativeValue));
986 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
989 internal void AnimateBy(Property target, PropertyValue relativeValue, AlphaFunction alpha)
991 NDalicPINVOKE.Animation_AnimateBy__SWIG_1(swigCPtr, Property.getCPtr(target), PropertyValue.getCPtr(relativeValue), AlphaFunction.getCPtr(alpha));
992 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
995 internal void AnimateBy(Property target, PropertyValue relativeValue, TimePeriod period)
997 NDalicPINVOKE.Animation_AnimateBy__SWIG_2(swigCPtr, Property.getCPtr(target), PropertyValue.getCPtr(relativeValue), TimePeriod.getCPtr(period));
998 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1001 internal void AnimateBy(Property target, PropertyValue relativeValue, AlphaFunction alpha, TimePeriod period)
1003 NDalicPINVOKE.Animation_AnimateBy__SWIG_3(swigCPtr, Property.getCPtr(target), PropertyValue.getCPtr(relativeValue), AlphaFunction.getCPtr(alpha), TimePeriod.getCPtr(period));
1004 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1007 internal void AnimateTo(Property target, PropertyValue destinationValue)
1009 NDalicPINVOKE.Animation_AnimateTo__SWIG_0(swigCPtr, Property.getCPtr(target), PropertyValue.getCPtr(destinationValue));
1010 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1013 internal void AnimateTo(Property target, PropertyValue destinationValue, AlphaFunction alpha)
1015 NDalicPINVOKE.Animation_AnimateTo__SWIG_1(swigCPtr, Property.getCPtr(target), PropertyValue.getCPtr(destinationValue), AlphaFunction.getCPtr(alpha));
1016 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1019 internal void AnimateTo(Property target, PropertyValue destinationValue, TimePeriod period)
1021 NDalicPINVOKE.Animation_AnimateTo__SWIG_2(swigCPtr, Property.getCPtr(target), PropertyValue.getCPtr(destinationValue), TimePeriod.getCPtr(period));
1022 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1025 internal void AnimateTo(Property target, PropertyValue destinationValue, AlphaFunction alpha, TimePeriod period)
1027 NDalicPINVOKE.Animation_AnimateTo__SWIG_3(swigCPtr, Property.getCPtr(target), PropertyValue.getCPtr(destinationValue), AlphaFunction.getCPtr(alpha), TimePeriod.getCPtr(period));
1028 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1031 internal void AnimateBetween(Property target, KeyFrames keyFrames)
1033 NDalicPINVOKE.Animation_AnimateBetween__SWIG_0(swigCPtr, Property.getCPtr(target), KeyFrames.getCPtr(keyFrames));
1034 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1037 internal void AnimateBetween(Property target, KeyFrames keyFrames, Animation.Interpolation interpolation)
1039 NDalicPINVOKE.Animation_AnimateBetween__SWIG_1(swigCPtr, Property.getCPtr(target), KeyFrames.getCPtr(keyFrames), (int)interpolation);
1040 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1043 internal void AnimateBetween(Property target, KeyFrames keyFrames, AlphaFunction alpha)
1045 NDalicPINVOKE.Animation_AnimateBetween__SWIG_2(swigCPtr, Property.getCPtr(target), KeyFrames.getCPtr(keyFrames), AlphaFunction.getCPtr(alpha));
1046 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1049 internal void AnimateBetween(Property target, KeyFrames keyFrames, AlphaFunction alpha, Animation.Interpolation interpolation)
1051 NDalicPINVOKE.Animation_AnimateBetween__SWIG_3(swigCPtr, Property.getCPtr(target), KeyFrames.getCPtr(keyFrames), AlphaFunction.getCPtr(alpha), (int)interpolation);
1052 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1055 internal void AnimateBetween(Property target, KeyFrames keyFrames, TimePeriod period)
1057 NDalicPINVOKE.Animation_AnimateBetween__SWIG_4(swigCPtr, Property.getCPtr(target), KeyFrames.getCPtr(keyFrames), TimePeriod.getCPtr(period));
1058 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1061 internal void AnimateBetween(Property target, KeyFrames keyFrames, TimePeriod period, Animation.Interpolation interpolation)
1063 NDalicPINVOKE.Animation_AnimateBetween__SWIG_5(swigCPtr, Property.getCPtr(target), KeyFrames.getCPtr(keyFrames), TimePeriod.getCPtr(period), (int)interpolation);
1064 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1067 internal void AnimateBetween(Property target, KeyFrames keyFrames, AlphaFunction alpha, TimePeriod period)
1069 NDalicPINVOKE.Animation_AnimateBetween__SWIG_6(swigCPtr, Property.getCPtr(target), KeyFrames.getCPtr(keyFrames), AlphaFunction.getCPtr(alpha), TimePeriod.getCPtr(period));
1070 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1073 internal void AnimateBetween(Property target, KeyFrames keyFrames, AlphaFunction alpha, TimePeriod period, Animation.Interpolation interpolation)
1075 NDalicPINVOKE.Animation_AnimateBetween__SWIG_7(swigCPtr, Property.getCPtr(target), KeyFrames.getCPtr(keyFrames), AlphaFunction.getCPtr(alpha), TimePeriod.getCPtr(period), (int)interpolation);
1076 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1079 internal void Animate(View view, Path path, Vector3 forward)
1081 NDalicPINVOKE.Animation_Animate__SWIG_0(swigCPtr, View.getCPtr(view), Path.getCPtr(path), Vector3.getCPtr(forward));
1082 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1085 internal void Animate(View view, Path path, Vector3 forward, AlphaFunction alpha)
1087 NDalicPINVOKE.Animation_Animate__SWIG_1(swigCPtr, View.getCPtr(view), Path.getCPtr(path), Vector3.getCPtr(forward), AlphaFunction.getCPtr(alpha));
1088 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1091 internal void Animate(View view, Path path, Vector3 forward, TimePeriod period)
1093 NDalicPINVOKE.Animation_Animate__SWIG_2(swigCPtr, View.getCPtr(view), Path.getCPtr(path), Vector3.getCPtr(forward), TimePeriod.getCPtr(period));
1094 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1097 internal void Animate(View view, Path path, Vector3 forward, AlphaFunction alpha, TimePeriod period)
1099 NDalicPINVOKE.Animation_Animate__SWIG_3(swigCPtr, View.getCPtr(view), Path.getCPtr(path), Vector3.getCPtr(forward), AlphaFunction.getCPtr(alpha), TimePeriod.getCPtr(period));
1100 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1103 internal void Show(View view, float delaySeconds)
1105 NDalicPINVOKE.Animation_Show(swigCPtr, View.getCPtr(view), delaySeconds);
1106 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1109 internal void Hide(View view, float delaySeconds)
1111 NDalicPINVOKE.Animation_Hide(swigCPtr, View.getCPtr(view), delaySeconds);
1112 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1116 /// Enumeration for what to do when the animation ends, stopped, or destroyed.
1118 /// <since_tizen> 3 </since_tizen>
1119 public enum EndActions
1122 /// When the animation ends, the animated property values are saved.
1126 /// When the animation ends, the animated property values are forgotten.
1130 /// If the animation is stopped, the animated property values are saved as if the animation had run to completion, otherwise behaves like cancel.
1136 /// Enumeration for what interpolation method to use on key-frame animations.
1138 /// <since_tizen> 3 </since_tizen>
1139 public enum Interpolation
1142 /// Values in between key frames are interpolated using a linear polynomial. (Default)
1146 /// Values in between key frames are interpolated using a cubic polynomial.
1152 /// Enumeration for what state the animation is in.
1154 /// <remarks>Calling Reset() on this class will not reset the animation. It will call the BaseHandle.Reset() which drops the object handle.</remarks>
1155 /// <since_tizen> 3 </since_tizen>
1159 /// The animation has stopped.
1163 /// The animation is playing.
1167 /// The animation is paused.