Class Animation
Definition
- Assembly:
- Tizen.NUI.dll
Animation can be used to animate the properties of any number of objects, typically view.
If the "Finished" event is connected to a member function of an object, it must be disconnected before the object is destroyed.
This is typically done in the object destructor, and requires either the animation handle to be stored.
The overall animation time is superseded by the values given in the animation time used when calling the AnimateTo(), AnimateBy(), AnimateBetween() and AnimatePath() methods.
If any of the individual calls to those functions exceeds the overall animation time (Duration), then the overall animation time is automatically extended.
public class Animation : BaseHandle, INotifyPropertyChanged, IDisposable
- Inheritance
- Implements
-
System.ComponentModel.INotifyPropertyChangedSystem.IDisposable
Constructors
View SourceAnimation()
Creates an initialized animation.
The animation will not loop.
The default end action is "Cancel".
The default alpha function is linear.
Declaration
public Animation()
Animation(int)
Creates an initialized animation.
The animation will not loop.
The default end action is "Cancel".
The default alpha function is linear.
Declaration
public Animation(int durationMilliSeconds)
Parameters
Type | Name | Description |
---|---|---|
int | durationMilliSeconds | The duration in milliseconds. |
Remarks
DurationmSeconds must be greater than zero.
Properties
View SourceBlendPoint
Sets and Gets the blend point to interpolate animate property
BlendPoint is a value between [0,1], If the value of the keyframe whose progress is 0 is different from the current value, the property is animated as it smoothly blends until the progress reaches the blendPoint.
Declaration
public float BlendPoint { get; set; }
Property Value
Type | Description |
---|---|
float |
Remarks
The blend point only affects animation registered with AnimateBetween. Other animations operate the same as when Play() is called. And the blend point needs to be set before this animation plays. If the blend point changes after playback, animation continuity cannot be guaranteed.
CurrentLoop
Gets the current loop count.
A value 0 indicating the current loop count when looping.
Declaration
public int CurrentLoop { get; }
Property Value
Type | Description |
---|---|
int |
CurrentProgress
Gets or sets the progress of the animation.
The animation will play (or continue playing) from this point.
The progress must be in the 0-1 interval or in the play range interval if defined
otherwise, it will be ignored.
Declaration
public float CurrentProgress { get; set; }
Property Value
Type | Description |
---|---|
float |
DefaultAlphaFunction
Gets or sets the default alpha function for the animation. This DefaultAlphaFunction is only applied to the animations are added after the DefaultAlphaFunction is set.
Declaration
public AlphaFunction DefaultAlphaFunction { get; set; }
Property Value
Type | Description |
---|---|
AlphaFunction |
Examples
animation.AnimateTo(actor, "position", destination);
animation.DefaultAlphaFunction = newAlphaFunction; // This newAlphaFunction is applied only for the size animation.
animation.AnimateTo(actor, "size", size);
View Source
DestValue
Gets or sets the destination value for each property of the animation.
Declaration
public string[] DestValue { get; set; }
Property Value
Type | Description |
---|---|
string[] |
DestValueList
Get the list of the destination value for each property of the animation.
Declaration
public IList<string> DestValueList { get; }
Property Value
Type | Description |
---|---|
IList<><string> |
DisconnectAction
Gets or sets the disconnect action.
If any of the animated property owners are disconnected from the stage while the animation is being played, then this action is performed.
The default action is EndActions.StopFinal.
Declaration
public Animation.EndActions DisconnectAction { get; set; }
Property Value
Type | Description |
---|---|
Animation.EndActions |
Duration
Gets or sets the duration in milliseconds of the animation. This duration is applied to the animations are added after the Duration is set.
Declaration
public int Duration { get; set; }
Property Value
Type | Description |
---|---|
int |
Examples
animation.AnimateTo(actor, "position", destination);
animation.Duration = 500; // This duration 500 is only applied to the size animation.
animation.AnimateTo(actor, "size", size);
View Source
EndAction
Gets or sets the end action of the animation.
This action is performed when the animation ends or if it is stopped.
The default end action is EndActions.Cancel.
Declaration
public Animation.EndActions EndAction { get; set; }
Property Value
Type | Description |
---|---|
Animation.EndActions |
EndTime
Gets or sets the end time for each property of the animation.
Declaration
public int[] EndTime { get; set; }
Property Value
Type | Description |
---|---|
int[] |
EndTimeList
Get the list of end time for each property of the animation.
Declaration
public IList<int> EndTimeList { get; }
Property Value
Type | Description |
---|---|
IList<><int> |
LoopCount
Set: Enables looping for a specified number of repeats. A zero is the same as Looping = true; i.e., repeat forever.
This property resets the looping value and should not be used with the Looping property.
Setting this parameter does not cause the animation to Play().
Get: Gets the loop count. A zero is the same as Looping = true; i.e., repeat forever.
The loop count is initially 1 for play once.
Declaration
public int LoopCount { get; set; }
Property Value
Type | Description |
---|---|
int |
Looping
Gets or sets the status of whether the animation will loop.
This property resets the loop count and should not be used with the LoopCount property.
Setting this parameter does not cause the animation to Play().
Declaration
public bool Looping { get; set; }
Property Value
Type | Description |
---|---|
bool |
LoopingMode
Enumeration for what looping mode is in.
Declaration
public Animation.LoopingModes LoopingMode { get; set; }
Property Value
Type | Description |
---|---|
Animation.LoopingModes |
PlayRange
Gets or sets the playing range.
Animation will play between the values specified. Both values (range.x and range.y ) should be between 0-1,
otherwise they will be ignored. If the range provided is not in proper order (minimum, maximum ), it will be reordered.
Declaration
public RelativeVector2 PlayRange { get; set; }
Property Value
Type | Description |
---|---|
RelativeVector2 |
ProgressNotification
Gets or sets the progress notification marker which triggers the ProgressReachedSignal.
Percentage of animation progress should be greater than 0 and less than 1, for example, 0.3 for 30%
One notification can be set on each animation.
Declaration
public float ProgressNotification { get; set; }
Property Value
Type | Description |
---|---|
float |
Properties
Gets or sets the properties of the animation.
Declaration
public string[] Properties { get; set; }
Property Value
Type | Description |
---|---|
string[] |
PropertyList
Get the list of the properties of the animation.
Declaration
public IList<string> PropertyList { get; }
Property Value
Type | Description |
---|---|
IList<><string> |
SpeedFactor
Gets or sets specifications of a speed factor for the animation.
The speed factor is a multiplier of the normal velocity of the animation.
Values between [0, 1] will slow down the animation and values above one will speed up the animation.
It is also possible to specify a negative multiplier to play the animation in reverse.
Declaration
public float SpeedFactor { get; set; }
Property Value
Type | Description |
---|---|
float |
StartTime
Gets or sets the start time for each property of the animation.
Declaration
public int[] StartTime { get; set; }
Property Value
Type | Description |
---|---|
int[] |
StartTimeList
Get the list of the start time for each property of the animation.
Declaration
public IList<int> StartTimeList { get; }
Property Value
Type | Description |
---|---|
IList<><int> |
State
Queries the state of the animation.
Declaration
public Animation.States State { get; }
Property Value
Type | Description |
---|---|
Animation.States |
Methods
View SourceAnimateBetween(Animatable, string, KeyFrames, int, int, Interpolation, AlphaFunction)
Animates a property between keyframes.
Declaration
public void AnimateBetween(Animatable target, string property, KeyFrames keyFrames, int startTime, int endTime, Animation.Interpolation interpolation = Interpolation.Linear, AlphaFunction alphaFunction = null)
Parameters
Type | Name | Description |
---|---|---|
Animatable | target | The target animatable object to animate |
string | property | The target property to animate |
KeyFrames | keyFrames | The set of time/value pairs between which to animate |
int | startTime | The start time of animation in milliseconds. |
int | endTime | The end time of animation in milliseconds. |
Animation.Interpolation | interpolation | The method used to interpolate between values. |
AlphaFunction | alphaFunction | The alpha function to apply. |
AnimateBetween(Animatable, string, KeyFrames, Interpolation, AlphaFunction)
Animates a property between keyframes.
Declaration
public void AnimateBetween(Animatable target, string property, KeyFrames keyFrames, Animation.Interpolation interpolation = Interpolation.Linear, AlphaFunction alphaFunction = null)
Parameters
Type | Name | Description |
---|---|---|
Animatable | target | The target animatable object to animate. |
string | property | The target property to animate. |
KeyFrames | keyFrames | The set of time or value pairs between which to animate. |
Animation.Interpolation | interpolation | The method used to interpolate between values. |
AlphaFunction | alphaFunction | The alpha function to apply. |
AnimateBetween(View, string, KeyFrames, int, int, Interpolation, AlphaFunction)
Animates a property between keyframes.
Declaration
public void AnimateBetween(View target, string property, KeyFrames keyFrames, int startTime, int endTime, Animation.Interpolation interpolation = Interpolation.Linear, AlphaFunction alphaFunction = null)
Parameters
Type | Name | Description |
---|---|---|
View | target | The target object to animate |
string | property | The target property to animate |
KeyFrames | keyFrames | The set of time/value pairs between which to animate |
int | startTime | The start time of animation in milliseconds. |
int | endTime | The end time of animation in milliseconds. |
Animation.Interpolation | interpolation | The method used to interpolate between values. |
AlphaFunction | alphaFunction | The alpha function to apply. |
AnimateBetween(View, string, KeyFrames, Interpolation, AlphaFunction)
Animates a property between keyframes.
Declaration
public void AnimateBetween(View target, string property, KeyFrames keyFrames, Animation.Interpolation interpolation = Interpolation.Linear, AlphaFunction alphaFunction = null)
Parameters
Type | Name | Description |
---|---|---|
View | target | The target object to animate. |
string | property | The target property to animate. |
KeyFrames | keyFrames | The set of time or value pairs between which to animate. |
Animation.Interpolation | interpolation | The method used to interpolate between values. |
AlphaFunction | alphaFunction | The alpha function to apply. |
AnimateBy(Animatable, string, object, int, int, AlphaFunction)
Animates a property value by a relative amount.
Declaration
public void AnimateBy(Animatable target, string property, object relativeValue, int startTime, int endTime, AlphaFunction alphaFunction = null)
Parameters
Type | Name | Description |
---|---|---|
Animatable | target | The target animatable object to animate. |
string | property | The target property to animate. |
object | relativeValue | The property value will change by this amount. |
int | startTime | The start time of the animation. |
int | endTime | The end time of the animation. |
AlphaFunction | alphaFunction | The alpha function to apply. |
AnimateBy(Animatable, string, object, AlphaFunction)
Animates a property value by a relative amount.
Declaration
public void AnimateBy(Animatable target, string property, object relativeValue, AlphaFunction alphaFunction = null)
Parameters
Type | Name | Description |
---|---|---|
Animatable | target | The target animatable object to animate. |
string | property | The target property to animate. |
object | relativeValue | The property value will change by this amount. |
AlphaFunction | alphaFunction | The alpha function to apply. |
AnimateBy(View, string, object, int, int, AlphaFunction)
Animates a property value by a relative amount.
Declaration
public void AnimateBy(View target, string property, object relativeValue, int startTime, int endTime, AlphaFunction alphaFunction = null)
Parameters
Type | Name | Description |
---|---|---|
View | target | The target object to animate. |
string | property | The target property to animate. |
object | relativeValue | The property value will change by this amount. |
int | startTime | The start time of the animation. |
int | endTime | The end time of the animation. |
AlphaFunction | alphaFunction | The alpha function to apply. |
AnimateBy(View, string, object, AlphaFunction)
Animates a property value by a relative amount.
Declaration
public void AnimateBy(View target, string property, object relativeValue, AlphaFunction alphaFunction = null)
Parameters
Type | Name | Description |
---|---|---|
View | target | The target object to animate. |
string | property | The target property to animate. |
object | relativeValue | The property value will change by this amount. |
AlphaFunction | alphaFunction | The alpha function to apply. |
AnimatePath(View, Path, Vector3, int, int, AlphaFunction)
Animates the view's position and orientation through a predefined path.
The view will rotate to orient the supplied forward vector with the path's tangent.
If forward is the zero vector then no rotation will happen.
Declaration
public void AnimatePath(View view, Path path, Vector3 forward, int startTime, int endTime, AlphaFunction alphaFunction = null)
Parameters
Type | Name | Description |
---|---|---|
View | view | The view to animate. |
Path | path | It defines position and orientation. |
Vector3 | forward | The vector (in local space coordinate system) will be oriented with the path's tangent direction. |
int | startTime | The start time of the animation. |
int | endTime | The end time of the animation. |
AlphaFunction | alphaFunction | The alpha function to apply. |
AnimatePath(View, Path, Vector3, AlphaFunction)
Animates the view's position and orientation through a predefined path.
The view will rotate to orient the supplied forward vector with the path's tangent.
If forward is the zero vector then no rotation will happen.
Declaration
public void AnimatePath(View view, Path path, Vector3 forward, AlphaFunction alphaFunction = null)
Parameters
Type | Name | Description |
---|---|---|
View | view | The view to animate. |
Path | path | It defines position and orientation. |
Vector3 | forward | The vector (in local space coordinate system) will be oriented with the path's tangent direction. |
AlphaFunction | alphaFunction | The alpha function to apply. |
AnimateTo(Animatable, string, object, int, int, AlphaFunction)
Animates a property to a destination value.
Declaration
public void AnimateTo(Animatable target, string property, object destinationValue, int startTime, int endTime, AlphaFunction alphaFunction = null)
Parameters
Type | Name | Description |
---|---|---|
Animatable | target | The target animatable object to animate. |
string | property | The target property to animate. |
object | destinationValue | The destination value. |
int | startTime | The start time of the animation. |
int | endTime | The end time of the animation. |
AlphaFunction | alphaFunction | The alpha function to apply. |
AnimateTo(Animatable, string, object, AlphaFunction)
Animates a property to a destination value.
Declaration
public void AnimateTo(Animatable target, string property, object destinationValue, AlphaFunction alphaFunction = null)
Parameters
Type | Name | Description |
---|---|---|
Animatable | target | The target animatable object to animate. |
string | property | The target property to animate. |
object | destinationValue | The destination value. |
AlphaFunction | alphaFunction | The alpha function to apply. |
AnimateTo(View, string, object, int, int, AlphaFunction)
Animates a property to a destination value.
Declaration
public void AnimateTo(View target, string property, object destinationValue, int startTime, int endTime, AlphaFunction alphaFunction = null)
Parameters
Type | Name | Description |
---|---|---|
View | target | The target object to animate. |
string | property | The target property to animate. |
object | destinationValue | The destination value. |
int | startTime | The start time of the animation. |
int | endTime | The end time of the animation. |
AlphaFunction | alphaFunction | The alpha function to apply. |
AnimateTo(View, string, object, AlphaFunction)
Animates a property to a destination value.
Declaration
public void AnimateTo(View target, string property, object destinationValue, AlphaFunction alphaFunction = null)
Parameters
Type | Name | Description |
---|---|---|
View | target | The target object to animate. |
string | property | The target property to animate. |
object | destinationValue | The destination value. |
AlphaFunction | alphaFunction | The alpha function to apply. |
Clear()
Clears the animation.
This disconnects any objects that were being animated, effectively stopping the animation.
Declaration
public void Clear()
Dispose(DisposeTypes)
To make animation instance be disposed.
Declaration
protected override void Dispose(DisposeTypes type)
Parameters
Type | Name | Description |
---|---|---|
DisposeTypes | type |
Overrides
View SourcePause()
Pauses the animation.
Declaration
public void Pause()
Play()
Plays the animation.
Declaration
public void Play()
PlayAfter(int)
Plays the animation after a given delay time.
The delay time is not included in the looping time.
When the delay time is a negative value, it would treat as play immediately.
Declaration
public void PlayAfter(int delayMilliseconds)
Parameters
Type | Name | Description |
---|---|---|
int | delayMilliseconds | The delay time. |
PlayAnimateTo(View)
Animates one or more properties to a destination value.
Declaration
public void PlayAnimateTo(View target)
Parameters
Type | Name | Description |
---|---|---|
View | target | The target object to animate. |
PlayFrom(float)
Plays the animation from a given point.
The progress must be in the 0-1 interval or in the play range interval if defined,
otherwise, it will be ignored.
Declaration
public void PlayFrom(float progress)
Parameters
Type | Name | Description |
---|---|---|
float | progress | A value between [0,1], or between the play range if specified, from where the animation should start playing. |
ReleaseSwigCPtr(HandleRef)
Declaration
protected override void ReleaseSwigCPtr(Runtime.InteropServices.HandleRef swigCPtr)
Parameters
Type | Name | Description |
---|---|---|
Tizen.System.Runtime.InteropServices.HandleRef | swigCPtr |
Overrides
Stop()
Stops the animation.
Declaration
public void Stop()
Stop(EndActions)
Stops the animation. It will change this animation's EndAction property.
Declaration
public void Stop(Animation.EndActions action)
Parameters
Type | Name | Description |
---|---|---|
Animation.EndActions | action | The end action can be set. |
Remarks
Change the value from EndActions.Discard, or to EndActions.Discard during animation is playing / paused will not works well.
If you want to stop by EndActions.Discard, EndAction property also should be EndActions.Discard before Play API called.
This method is deprecated since API11 because EndActions property concept is not matched with Stop().
Use EndAction property instead.
Events
View SourceFinished
Event for the finished signal which can be used to subscribe or unsubscribe the event handler.
The finished signal is emitted when an animation's animations have finished.
Declaration
public event EventHandler Finished
Event Type
Type | Description |
---|---|
EventHandler |
ProgressReached
Event for the ProgressReached signal, which can be used to subscribe or unsubscribe the event handler.
The ProgressReached signal is emitted when the animation has reached a given progress percentage, this is set in the api SetProgressNotification.
Declaration
public event EventHandler ProgressReached
Event Type
Type | Description |
---|---|
EventHandler |