Class LottieAnimationView

Definition

Namespace:
Tizen.NUI.BaseComponents
Assembly:
Tizen.NUI.dll
API Level:
7

LottieAnimationView renders an animated vector image (Lottie file).

C#
Copy
public class LottieAnimationView : ImageView, IDynamicResourceHandler, IElement, INameScope, IElementController, System.IDisposable, IResourcesProvider
Inheritance
Derived
Implements

Constructors

View Source

LottieAnimationView(Single, Boolean)

LottieAnimationView constructor

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

The factor of scaling image, default : 1.0f

Boolean 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);
API Level: 7

Fields

View Source

CurrentFrameProperty

CurrentFrameProperty

Declaration
C#
Copy
public static readonly BindableProperty CurrentFrameProperty
Field Value
Type Description
BindableProperty
View Source

LoopCountProperty

LoopCountProperty

Declaration
C#
Copy
public static readonly BindableProperty LoopCountProperty
Field Value
Type Description
BindableProperty
View Source

LoopingModeProperty

LoopingModeProperty

Declaration
C#
Copy
public static readonly BindableProperty LoopingModeProperty
Field Value
Type Description
BindableProperty
View Source

RedrawInScalingDownProperty

RedrawInScalingDownProperty

Declaration
C#
Copy
public static readonly BindableProperty RedrawInScalingDownProperty
Field Value
Type Description
BindableProperty
View Source

StopBehaviorProperty

StopBehaviorProperty

Declaration
C#
Copy
public static readonly BindableProperty StopBehaviorProperty
Field Value
Type Description
BindableProperty
View Source

URLProperty

URLProperty

Declaration
C#
Copy
public static readonly BindableProperty URLProperty
Field Value
Type Description
BindableProperty

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
Int32
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
API Level: 7
View Source

DesiredHeight

Gets or sets the desired image height for LottieAnimationView

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

DesiredWidth

Gets or sets the desired image width for LottieAnimationView

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

LoopCount

Sets or gets the loop count.

Declaration
C#
Copy
public int LoopCount { get; set; }
Property Value
Type Description
Int32
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
API Level: 7
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
API Level: 7
View Source

PlayState

Gets the playing state

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

RedrawInScalingDown

Whether to redraw the image when the visual is scaled down.

Declaration
C#
Copy
public bool RedrawInScalingDown { get; set; }
Property Value
Type Description
Boolean
Remarks

Inhouse API. It is used in the AnimatedVectorImageVisual.The default is true.

View Source

ResourceUrl

Set or Get resource URL of Lottie file.

Declaration
C#
Copy
public string ResourceUrl { get; set; }
Property Value
Type Description
String
View Source

StopBehavior

Sets or gets the stop behavior.

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

SynchronousLoading

Gets or sets the SynchronousLoading for LottieAnimationView
We should set it before setup ResourceUrl, URL property.

Declaration
C#
Copy
public bool SynchronousLoading { get; set; }
Property Value
Type Description
Boolean
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
Int32
API Level: 7
View Source

URL

Set or Get resource URL of Lottie file.

Declaration
C#
Copy
public string URL { get; set; }
Property Value
Type Description
String
API Level: 7

Methods

View Source

Dispose(Boolean)

Declaration
C#
Copy
protected override void Dispose(bool disposing)
Parameters
Type Name Description
Boolean disposing
Overrides
View Source

Dispose(DisposeTypes)

Dispose(DisposeTypes type)

Declaration
C#
Copy
protected override void Dispose(DisposeTypes type)
Parameters
Type Name Description
DisposeTypes type
Overrides
View Source

DoActionExtension(LottieAnimationViewDynamicProperty)

Declaration
C#
Copy
public void DoActionExtension(LottieAnimationViewDynamicProperty info)
Parameters
Type Name Description
LottieAnimationViewDynamicProperty info
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
List<Tuple<String, Int32, Int32>>

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

API Level: 7
View Source

GetMarkerInfo()

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

Declaration
C#
Copy
public List<Tuple<string, int, int>> GetMarkerInfo()
Returns
Type Description
List<Tuple<String, Int32, Int32>>

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

View Source

GetMinMaxFrame()

Get MinMax Frame

Declaration
C#
Copy
public Tuple<int, int> GetMinMaxFrame()
Returns
Type Description
Tuple<Int32, Int32>

Tuple of Min and Max frames

View Source

MergeCachedImageVisualProperty(PropertyMap)

Update NUI cached animated image visual property map by inputed property map. And call base.MergeCachedImageVisualProperty()

Declaration
C#
Copy
protected override void MergeCachedImageVisualProperty(PropertyMap map)
Parameters
Type Name Description
PropertyMap map
Overrides
Remarks

For performance issue, we will collect only "cachedLottieAnimationPropertyKeyList" hold in this class.

View Source

Pause()

Pause Animation.

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

Play()

Play Animation.

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

SetMinMaxFrame(Int32, Int32)

Set the minimum and the maximum frame.

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

minimum frame

Int32 maxFrame

maximum frame

API Level: 7
View Source

SetMinMaxFrameByMarker(String, String)

A marker has its start frame and end frame. Animation will play between the start frame and the end frame of the marker if one marker is specified. Or animation will play between the start frame of the first marker and the end frame of the second marker if two markers are specified.

Declaration
C#
Copy
public void SetMinMaxFrameByMarker(string marker1, string marker2 = null)
Parameters
Type Name Description
String marker1

First marker

String marker2

Second marker

View Source

Stop()

Stop Animation.

Declaration
C#
Copy
public void Stop()
API Level: 7
View Source

UpdateImage()

Update lottie-image-relative properties synchronously. After call this API, All image properties updated.

Declaration
C#
Copy
protected override void UpdateImage()
Overrides

Events

View Source

Finished

Animation finished event.

Declaration
C#
Copy
public event EventHandler Finished
Event Type
Type Description
EventHandler
API Level: 7

Implements

Extension Methods