Class AnimationView

Definition

Namespace:
ElmSharp
Assembly:
ElmSharp.dll
API Level:
preview

The AnimationView is designed to show and play animation of vector graphics based content. Currently ElmSharp AnimationView is supporting only json format (known for Lottie file as well).

C#
Copy
public class AnimationView : EvasObject
Inheritance
System.Object
AnimationView

Constructors

View Source

AnimationView(EvasObject)

Creates and initializes a new instance of the AnimationView class.

Declaration
C#
Copy
public AnimationView(EvasObject parent)
Parameters
Type Name Description
EvasObject parent

The parent is a given container, which will be attached by AnimationView as a child. It's EvasObject type.

API Level: preview

Properties

View Source

AutoPlay

Sets or gets whether to play animation automatically. If AutoPlay is true, animation will be started when it's readied. The condition of AutoPlay is when AnimationView opened file successfully, yet to play it plus when the object is visible. If AnimationView is disabled, invisible, it turns to pause state then resume animation when it's visible again. This AutoPlay will be only affected to the next animation source. So must be called before SetAnimation()

Declaration
C#
Copy
public bool AutoPlay { get; set; }
Property Value
Type Description
System.Boolean
API Level: preview
View Source

AutoRepeat

Sets or gets whether to turn on/off animation looping. If AutoRepeat is true, it repeats animation when animation frame is reached to end. This AutoRepeat mode is valid to both Play and ReversePlay cases.

Declaration
C#
Copy
public bool AutoRepeat { get; set; }
Property Value
Type Description
System.Boolean
API Level: preview
View Source

DefaultSize

Get the default view size that specified from vector resource.

Declaration
C#
Copy
public Size DefaultSize { get; }
Property Value
Type Description
Size
API Level: preview
View Source

DurationTime

Get the duration of animation in seconds.

Declaration
C#
Copy
public double DurationTime { get; }
Property Value
Type Description
System.Double
Remarks

Returns total duration time of current animation in the seconds. If current animation source isn't animatable, it returns zero.

API Level: preview
View Source

Frame

Sets or gets current frame position of animation view. The range of frame is from 0 to FrameCount - 1

Declaration
C#
Copy
public int Frame { get; set; }
Property Value
Type Description
System.Int32
API Level: preview
View Source

FrameCount

Get the index of end frame of the AnimationView, if it's animated.

Declaration
C#
Copy
public int FrameCount { get; }
Property Value
Type Description
System.Int32
Remarks

Frame number starts with 0.

API Level: preview
View Source

IsReversedPlaying

Get the status whether current animation is on playing forward or backward.

Declaration
C#
Copy
public bool IsReversedPlaying { get; }
Property Value
Type Description
System.Boolean
Remarks

If AnimationView is not on playing, it will return False.

API Level: preview
View Source

MaxFrame

Sets or Gets the last frame of the play

Declaration
C#
Copy
public int MaxFrame { get; set; }
Property Value
Type Description
System.Int32
Remarks

Default value is FrameCount -1.

API Level: preview
View Source

MaxProgress

Sets or Gets the last progress of the play

Declaration
C#
Copy
public double MaxProgress { get; set; }
Property Value
Type Description
System.Double
Remarks

Default value is 1.

API Level: preview
View Source

MinFrame

Sets or Gets the start frame of the play

Declaration
C#
Copy
public int MinFrame { get; set; }
Property Value
Type Description
System.Int32
Remarks

Default value is 0.

API Level: preview
View Source

MinProgress

Sets or Gets the start progress of the play

Declaration
C#
Copy
public double MinProgress { get; set; }
Property Value
Type Description
System.Double
Remarks

Default value is 0.

API Level: preview
View Source

Progress

Sets or gets current progress position of animation view. When you required to jump on a certain progress instantly, you can change current position by using this property The range of progress is 0 ~ 1.

Declaration
C#
Copy
public double Progress { get; set; }
Property Value
Type Description
System.Double
API Level: preview
View Source

Speed

Sets or gets the animation speed. Control animation speed by multiplying Speed value. If you want to play animation double-time faster, you can give Speed 2. If you want to play animation double-time slower, you can give Speed 0.5. Speed must be greater than zero.

Declaration
C#
Copy
public double Speed { get; set; }
Property Value
Type Description
System.Double
API Level: preview
View Source

State

Get current animation view state.

Declaration
C#
Copy
public AnimationViewState State { get; }
Property Value
Type Description
AnimationViewState
API Level: preview

Methods

View Source

CreateHandle(EvasObject)

Creates a AnimationView handle.

Declaration
C#
Copy
protected override IntPtr CreateHandle(EvasObject parent)
Parameters
Type Name Description
EvasObject parent

Parent EvasObject.

Returns
Type Description
System.IntPtr

Handle IntPtr.

Overrides
API Level: preview
View Source

Pause()

Pause current animation instantly. Once animation is paused, animation view must get resume to play continue again. Animation must be on playing or playing back status.

Declaration
C#
Copy
public void Pause()
API Level: preview
View Source

Play()

Play animation one time instantly when it's available. If current keyframe is on a certain position by playing reverse, this will play forward from there. Play request will be ignored if animation source is not set yet or animation is paused state or it's already on playing.

Declaration
C#
Copy
public void Play()
API Level: preview
View Source

Play(Boolean)

Play animation one time instantly when it's available. If current keyframe is on a certain position by playing reverse and isReverse is ture, this will play forward from there. And if current keyframe is on a certain position by playing and isReverse is false, this will play backward from there. Play request will be ignored if animation source is not set yet or animation is paused state or it's already on playing.

Declaration
C#
Copy
public void Play(bool isReverse)
Parameters
Type Name Description
System.Boolean isReverse

Whether the animation play or reverse play.

API Level: preview
View Source

Resume()

Resume paused animation to continue animation.

Declaration
C#
Copy
public void Resume()
Remarks

This resume must be called on animation paused status.

API Level: preview
View Source

SetAnimation(String)

Sets the animation source file.

Declaration
C#
Copy
public void SetAnimation(string file)
Parameters
Type Name Description
System.String file

The animation file path.

API Level: preview
View Source

Stop()

Stop playing animation. Stop animation instatly regardless of it's status and reset to show first frame of animation.Even though current animation is paused, the animation status will be stopped.

Declaration
C#
Copy
public void Stop()
API Level: preview

Events

View Source

Finished

It occurs when the animation is just finished.

Declaration
C#
Copy
public event EventHandler Finished
Event Type
Type Description
System.EventHandler
API Level: preview
View Source

Paused

It occurs when the animation is just paused.

Declaration
C#
Copy
public event EventHandler Paused
Event Type
Type Description
System.EventHandler
API Level: preview
View Source

Repeated

It occurs when the animation is just repeated.

Declaration
C#
Copy
public event EventHandler Repeated
Event Type
Type Description
System.EventHandler
API Level: preview
View Source

Resumed

It occurs when the animation is just resumed.

Declaration
C#
Copy
public event EventHandler Resumed
Event Type
Type Description
System.EventHandler
API Level: preview
View Source

Started

It occurs when the animation is just started.

Declaration
C#
Copy
public event EventHandler Started
Event Type
Type Description
System.EventHandler
API Level: preview
View Source

Stopped

It occurs when the animation is just stopped.

Declaration
C#
Copy
public event EventHandler Stopped
Event Type
Type Description
System.EventHandler
API Level: preview
View Source

Updated

It occurs when the animation is updated to the next frame.

Declaration
C#
Copy
public event EventHandler Updated
Event Type
Type Description
System.EventHandler
API Level: preview

Extension Methods