Class LottieAnimationView

Definition

Namespace:
Tizen.NUI.BaseComponents
Assembly:
Tizen.NUI.dll

LottieAnimationView renders an animated vector image (Lottie file).

C#
Copy
public class LottieAnimationView : ImageView, INotifyPropertyChanged, IDisposable
Inheritance
object
Tizen.NUI.Binding.Element
LottieAnimationView
Implements
System.ComponentModel.INotifyPropertyChanged
System.IDisposable

Constructors

View Source

LottieAnimationView(float, bool)

LottieAnimationView constructor

Declaration
C#
Copy
public LottieAnimationView(float scale = 1, bool shown = true)
Parameters
Type Name Description
float scale

The factor of scaling image, default : 1.0f

bool shown

false : not displayed (hidden), true : displayed (shown), default : true

Remarks

If the shown parameter is false, the animation is not visible even if the LottieAnimationView instance is created.

Examples
Copy
LottieAnimationView myLottie = new LottieAnimationView(); LottieAnimationView myLottie2 = new LottieAnimationView(2.0f); LottieAnimationView myLottie3 = new LottieAnimationView(1.0f, false);

Properties

View Source

CurrentFrame

Set or get the current frame. When setting a specific frame, it is displayed as a still image.

Declaration
C#
Copy
public int CurrentFrame { get; set; }
Property Value
Type Description
int
Remarks

Gets the value set by a user. If the setting value is out-ranged, it is reset as a minimum frame or a maximum frame.

Examples

We assume that the animation in myLottie.json file has 100 frames originally. If so, its frame index will be 0 - 99.

Copy
LottieAnimationView myLottie = new LottieAnimationView(); myLottie.URL = Tizen.Applications.Application.Current.DirectoryInfo.Resource + "myLottie.json"; //myLottie.json's total frame is 100 (frame: 0~99) NUIApplication.GetDefaultWindow().GetDefaultLayer().Add(myLottie); myLottie.CurrentFrame = 200; //display 99 frame myLottie.SetMinMaxFrame(10, 20); myLottie.CurrentFrame = 15; //display 15 frame myLottie.CurrentFrame = 50; //display 20 frame, because the MinMax is set (10,20) above
View Source

LoopCount

Sets or gets the loop count.

Declaration
C#
Copy
public int LoopCount { get; set; }
Property Value
Type Description
int
Remarks

The minus value means the infinite loop count.

Examples
Copy
LottieAnimationView myLottie = new LottieAnimationView(); myLottie.URL = Tizen.Applications.Application.Current.DirectoryInfo.Resource + "myLottie.json"; //myLottie.json's total frame is 100 (frame: 0~99) NUIApplication.GetDefaultWindow().GetDefaultLayer().Add(myLottie); myLottie.LoopCount = -1; //infinite loop myLottie.Play(); myLottie.Stop(); //it plays continuously unless Stop() is called myLottie.LoopCount = 2; myLottie.Play(); //it plays only 2 times and stops automatically
View Source

LoopingMode

Sets or gets the looping mode of Lottie animation.

Declaration
C#
Copy
public LottieAnimationView.LoopingModeType LoopingMode { get; set; }
Property Value
Type Description
LottieAnimationView.LoopingModeType
View Source

PlayState

Gets the playing state of the LottieAnimationView. This property returns the current play state of the LottieAnimationView.

Declaration
C#
Copy
public LottieAnimationView.PlayStateType PlayState { get; }
Property Value
Type Description
LottieAnimationView.PlayStateType
View Source

StopBehavior

Sets or gets the stop behavior of the LottieAnimationView. This property determines how the animation behaves when it stops.

Declaration
C#
Copy
public LottieAnimationView.StopBehaviorType StopBehavior { get; set; }
Property Value
Type Description
LottieAnimationView.StopBehaviorType
View Source

TotalFrame

Get the number of total frames. If resouce is still not be loaded, or invalid resource, the value is 0.

Declaration
C#
Copy
public int TotalFrame { get; }
Property Value
Type Description
int
View Source

URL

Set or Get resource URL of Lottie file.

Declaration
C#
Copy
public string URL { get; set; }
Property Value
Type Description
string

Methods

View Source

GetContentInfo()

Get the list of layers' information such as the start frame and the end frame in the Lottie file.

Declaration
C#
Copy
public List<Tuple<string, int, int>> GetContentInfo()
Returns
Type Description
System.Collections.Generic.List<T><Tuple<string, int, int>>

List of Tuple (string of layer name, integer of start frame, integer of end frame)

View Source

Pause()

Pauses the Lottie animation. This method pauses the animation without resetting its progress.

Declaration
C#
Copy
public void Pause()
View Source

Play()

Plays the Lottie animation. This method starts the playback of the Lottie animation.

Declaration
C#
Copy
public void Play()
View Source

SetMinMaxFrame(int, int)

Set the minimum and the maximum frame.

Declaration
C#
Copy
public void SetMinMaxFrame(int minFrame, int maxFrame)
Parameters
Type Name Description
int minFrame

minimum frame

int maxFrame

maximum frame

View Source

Stop()

Stops the Lottie animation. This method stops the currently playing Lottie animation.

Declaration
C#
Copy
public void Stop()

Events

View Source

Finished

The event handler for the animation finished event.

Declaration
C#
Copy
public event EventHandler Finished
Event Type
Type Description
System.EventHandler

Implements

System.ComponentModel.INotifyPropertyChanged
System.IDisposable