Class LottieAnimationView
Definition
- Namespace:
- Tizen.NUI.BaseComponents
- Assembly:
- Tizen.NUI.dll
LottieAnimationView renders an animated vector image (Lottie file).
public class LottieAnimationView : ImageView, IDynamicResourceHandler, INameScope, System.IDisposable, IResourcesProvider
- Inheritance
- Derived
- Implements
-
System.IDisposable
Constructors
View SourceLottieAnimationView(float, bool)
LottieAnimationView constructor
Declaration
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
LottieAnimationView myLottie = new LottieAnimationView();
LottieAnimationView myLottie2 = new LottieAnimationView(2.0f);
LottieAnimationView myLottie3 = new LottieAnimationView(1.0f, false);
Fields
View SourceCurrentFrameProperty
CurrentFrameProperty
Declaration
public static readonly BindableProperty CurrentFrameProperty
Field Value
Type | Description |
---|---|
BindableProperty |
EnableFrameCacheProperty
EnableFrameCacheProperty
Declaration
public static readonly BindableProperty EnableFrameCacheProperty
Field Value
Type | Description |
---|---|
BindableProperty |
LoopCountProperty
LoopCountProperty
Declaration
public static readonly BindableProperty LoopCountProperty
Field Value
Type | Description |
---|---|
BindableProperty |
LoopingModeProperty
LoopingModeProperty
Declaration
public static readonly BindableProperty LoopingModeProperty
Field Value
Type | Description |
---|---|
BindableProperty |
RedrawInScalingDownProperty
RedrawInScalingDownProperty
Declaration
public static readonly BindableProperty RedrawInScalingDownProperty
Field Value
Type | Description |
---|---|
BindableProperty |
StopBehaviorProperty
StopBehaviorProperty
Declaration
public static readonly BindableProperty StopBehaviorProperty
Field Value
Type | Description |
---|---|
BindableProperty |
URLProperty
URLProperty
Declaration
public static readonly BindableProperty URLProperty
Field Value
Type | Description |
---|---|
BindableProperty |
Properties
View SourceCurrentFrame
Set or get the current frame. When setting a specific frame, it is displayed as a still image.
Declaration
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.
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
DesiredHeight
Gets or sets the desired image height for LottieAnimationView
Declaration
public int DesiredHeight { get; set; }
Property Value
Type | Description |
---|---|
int |
DesiredWidth
Gets or sets the desired image width for LottieAnimationView
Declaration
public int DesiredWidth { get; set; }
Property Value
Type | Description |
---|---|
int |
EnableFrameCache
Declaration
public bool EnableFrameCache { get; set; }
Property Value
Type | Description |
---|---|
bool |
LoopCount
Sets or gets the loop count.
Declaration
public int LoopCount { get; set; }
Property Value
Type | Description |
---|---|
int |
Remarks
The minus value means the infinite loop count.
Examples
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
public LottieAnimationView.LoopingModeType LoopingMode { get; set; }
Property Value
Type | Description |
---|---|
LottieAnimationView.LoopingModeType |
PlayState
Gets the playing state
Declaration
public LottieAnimationView.PlayStateType PlayState { get; }
Property Value
Type | Description |
---|---|
LottieAnimationView.PlayStateType |
RedrawInScalingDown
Whether to redraw the image when the visual is scaled down.
Declaration
public bool RedrawInScalingDown { get; set; }
Property Value
Type | Description |
---|---|
bool |
Remarks
Inhouse API. It is used in the AnimatedVectorImageVisual.The default is true.
ResourceUrl
Set or Get resource URL of Lottie file.
Declaration
public string ResourceUrl { get; set; }
Property Value
Type | Description |
---|---|
string |
StopBehavior
Sets or gets the stop behavior.
Declaration
public LottieAnimationView.StopBehaviorType StopBehavior { get; set; }
Property Value
Type | Description |
---|---|
LottieAnimationView.StopBehaviorType |
SynchronousLoading
Gets or sets the SynchronousLoading for LottieAnimationView
We should set it before setup ResourceUrl, URL property.
Declaration
public bool SynchronousLoading { get; set; }
Property Value
Type | Description |
---|---|
bool |
TotalFrame
Get the number of total frames. If resouce is still not be loaded, or invalid resource, the value is 0.
Declaration
public int TotalFrame { get; }
Property Value
Type | Description |
---|---|
int |
URL
Set or Get resource URL of Lottie file.
Declaration
public string URL { get; set; }
Property Value
Type | Description |
---|---|
string |
Methods
View SourceDispose(bool)
Declaration
protected override void Dispose(bool disposing)
Parameters
Type | Name | Description |
---|---|---|
bool | disposing |
Overrides
View SourceDispose(DisposeTypes)
Dispose(DisposeTypes type)
Declaration
protected override void Dispose(DisposeTypes type)
Parameters
Type | Name | Description |
---|---|---|
DisposeTypes | type |
Overrides
View SourceDoActionExtension(LottieAnimationViewDynamicProperty)
Declaration
public void DoActionExtension(LottieAnimationViewDynamicProperty info)
Parameters
Type | Name | Description |
---|---|---|
LottieAnimationViewDynamicProperty | info |
GetContentInfo()
Get the list of layers' information such as the start frame and the end frame in the Lottie file.
Declaration
public List<Tuple<string, int, int>> GetContentInfo()
Returns
Type | Description |
---|---|
List<><Tuple<string, int, int>> | List of Tuple (string of layer name, integer of start frame, integer of end frame) |
GetMarkerInfo()
Get the list of markers' information such as the start frame and the end frame in the Lottie file.
Declaration
public List<Tuple<string, int, int>> GetMarkerInfo()
Returns
Type | Description |
---|---|
List<><Tuple<string, int, int>> | List of Tuple (string of marker name, integer of start frame, integer of end frame) |
GetMinMaxFrame()
Get MinMax Frame
Declaration
public Tuple<int, int> GetMinMaxFrame()
Returns
Type | Description |
---|---|
Tuple<, ><int, int> | Tuple of Min and Max frames |
MergeCachedImageVisualProperty(PropertyMap)
Update NUI cached animated image visual property map by inputed property map. And call base.MergeCachedImageVisualProperty()
Declaration
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.
Pause()
Pause Animation.
Declaration
public void Pause()
Play()
Play Animation.
Declaration
public void Play()
SetMinMaxFrame(int, int)
Set the minimum and the maximum frame.
Declaration
public void SetMinMaxFrame(int minFrame, int maxFrame)
Parameters
Type | Name | Description |
---|---|---|
int | minFrame | minimum frame |
int | maxFrame | maximum frame |
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
public void SetMinMaxFrameByMarker(string marker1, string marker2 = null)
Parameters
Type | Name | Description |
---|---|---|
string | marker1 | First marker |
string | marker2 | Second marker |
Stop()
Stop Animation.
Declaration
public void Stop()
UpdateImage()
Update lottie-image-relative properties synchronously. After call this API, All image properties updated.
Declaration
protected override void UpdateImage()
Overrides
Events
View SourceFinished
Animation finished event.
Declaration
public event EventHandler Finished
Event Type
Type | Description |
---|---|
EventHandler |