Class SkiaLottie
public class SkiaLottie : AnimatedFramesRenderer, INotifyPropertyChanged, IEffectControlProvider, IToolTipElement, IContextFlyoutElement, IAnimatable, IVisualElementController, IElementController, IView, ITransform, IElement, IVisualTreeElement, IContainer, IList<IView>, ICollection<IView>, IEnumerable<IView>, IEnumerable, ISkiaGestureListener, IHasAfterEffects, ISkiaControl, IDrawnBase, ICanBeUpdatedWithContext, ICanBeUpdated, ISkiaDisposable, IDisposable
- Inheritance
-
SkiaLottie
- Implements
- Inherited Members
- Extension Methods
Constructors
SkiaLottie()
public SkiaLottie()
Fields
ApplyIsOnWhenNotPlayingProperty
public static readonly BindableProperty ApplyIsOnWhenNotPlayingProperty
Field Value
CachedAnimations
To avoid reloading same files multiple times..
public static ConcurrentDictionary<string, string> CachedAnimations
Field Value
ColorTintProperty
public static readonly BindableProperty ColorTintProperty
Field Value
ColorsProperty
public static readonly BindableProperty ColorsProperty
Field Value
DefaultFrameWhenOnProperty
public static readonly BindableProperty DefaultFrameWhenOnProperty
Field Value
IsOnProperty
public static readonly BindableProperty IsOnProperty
Field Value
ProcessJson
public Func<string, string> ProcessJson
Field Value
SourceProperty
public static readonly BindableProperty SourceProperty
Field Value
Properties
Animation
public Animation Animation { get; set; }
Property Value
ApplyIsOnWhenNotPlaying
Gets or sets whether the IsOn state should be applied when the animation is not playing. When true (default), changing IsOn will immediately seek to the appropriate frame. When false, IsOn state is only applied during animation playback.
public bool ApplyIsOnWhenNotPlaying { get; set; }
Property Value
ColorTint
Gets or sets a global color tint applied to the entire Lottie animation. This provides a quick way to theme animations without modifying the source file. For multiple color replacements, use the Colors collection instead.
public Color ColorTint { get; set; }
Property Value
Colors
public IList<Color> Colors { get; set; }
Property Value
DefaultFrameWhenOn
For the case IsOn = True. What frame should we display at start or when stopped. 0 (START) is default, can specify other number. if value is less than 0 then will seek to the last available frame (END).
public int DefaultFrameWhenOn { get; set; }
Property Value
IsOn
Gets or sets the toggle state for animations with distinct on/off states. When true, displays DefaultFrameWhenOn frame when stopped. When false, displays DefaultFrame when stopped. Perfect for animated toggles, checkboxes, or switch controls.
public bool IsOn { get; set; }
Property Value
Source
Gets or sets the path or URL to the Lottie JSON file. Supports web URLs, native file system paths (file://), and bundled resources from Resources/Raw folder. Example: "Lottie/animation.json" loads from Resources/Raw/Lottie/animation.json
public string Source { get; set; }
Property Value
Methods
ApplyDefaultFrame()
protected override void ApplyDefaultFrame()
ApplySpeed()
protected override void ApplySpeed()
ApplyTint(string, IList<Color>)
public static string ApplyTint(string json, IList<Color> newTints)
Parameters
Returns
CalculateSaturation(Color)
public static float CalculateSaturation(Color color)
Parameters
colorColor
Returns
CheckCanStartAnimator()
protected override bool CheckCanStartAnimator()
Returns
ColorToArrayString(Color)
public static string ColorToArrayString(Color color)
Parameters
colorColor
Returns
ColorToHexString(Color)
public static string ColorToHexString(Color color)
Parameters
colorColor
Returns
ColorToRGBHexString(Color)
public static string ColorToRGBHexString(Color color)
Parameters
colorColor
Returns
ColorToString(Color)
public static string ColorToString(Color color)
Parameters
colorColor
Returns
CreateAnimation(string)
public Animation CreateAnimation(string json)
Parameters
jsonstring
Returns
FindColorProperties(JToken, List<(JToken Token, Color Color)>)
public static void FindColorProperties(JToken token, List<(JToken Token, Color Color)> colorList)
Parameters
GoToEnd()
public virtual void GoToEnd()
GoToStart()
public virtual void GoToStart()
LoadAnimationFromJson(string)
This is not replacing current animation, use SetAnimation for that.
public Animation LoadAnimationFromJson(string json)
Parameters
jsonstring
Returns
LoadLocalJson(string)
public string LoadLocalJson(string fileName)
Parameters
fileNamestring
Returns
LoadSource(string)
This is not replacing current animation, only pre-loading! Use SetAnimation after that if needed.
public Task<Animation> LoadSource(string fileName)
Parameters
fileNamestring
Returns
OnAnimatorInitializing()
protected override void OnAnimatorInitializing()
OnAnimatorSeeking(double)
protected override void OnAnimatorSeeking(double frame)
Parameters
framedouble
OnAnimatorStarting()
protected override void OnAnimatorStarting()
OnAnimatorUpdated(double)
Override this to react on animator running.
protected override void OnAnimatorUpdated(double value)
Parameters
valuedouble
OnDisposing()
Base performs some cleanup actions with Superview
public override void OnDisposing()
OnFinished()
protected override void OnFinished()
OnJsonLoaded(string)
Called by LoadAnimationFromResources after file was loaded so we can modify json if needed before it it consumed. Return json to be used. This is not called by LoadAnimationFromJson.
protected virtual string OnJsonLoaded(string json)
Parameters
jsonstring
Returns
OnLayoutChanged()
DrawingRect size changed
protected override void OnLayoutChanged()
ReloadSource()
public virtual void ReloadSource()
RenderFrame(DrawingContext)
protected override void RenderFrame(DrawingContext ctx)
Parameters
ctxDrawingContext
SeekToDefaultFrame()
public virtual void SeekToDefaultFrame()
SetAnimation(Animation, bool)
public void SetAnimation(Animation animation, bool disposePrevious)
Parameters
Stop()
public override void Stop()
StreamFromResourceUrl(string, Assembly)
public static Stream StreamFromResourceUrl(string url, Assembly assembly = null)
Parameters
Returns
StringToXamarinColor(string)
public static Color StringToXamarinColor(string colorString)
Parameters
colorStringstring
Returns
StringToXamarinColorFromHex(string)
public static Color StringToXamarinColorFromHex(string hexColor)
Parameters
hexColorstring