Table of Contents

Class AnimatedFramesRenderer

Namespace
DrawnUi.Controls
Assembly
DrawnUi.Maui.dll

Base class for playing frames. Subclass to play spritesheets, gifs, custom animations etc.

public class AnimatedFramesRenderer : SkiaControl, 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
AnimatedFramesRenderer
Implements
Derived
Inherited Members
Extension Methods

Constructors

AnimatedFramesRenderer()

public AnimatedFramesRenderer()

Fields

AutoPlayProperty

public static readonly BindableProperty AutoPlayProperty

Field Value

BindableProperty

DefaultFrameProperty

public static readonly BindableProperty DefaultFrameProperty

Field Value

BindableProperty

RepeatProperty

public static readonly BindableProperty RepeatProperty

Field Value

BindableProperty

SpeedRatioProperty

public static readonly BindableProperty SpeedRatioProperty

Field Value

BindableProperty

WasPlayingBeforeVisibilityChanged

protected bool WasPlayingBeforeVisibilityChanged

Field Value

bool

WasStarted

protected bool WasStarted

Field Value

bool

Properties

Animator

public RangeAnimator Animator { get; protected set; }

Property Value

RangeAnimator

AutoPlay

public bool AutoPlay { get; set; }

Property Value

bool

CanPlay

protected bool CanPlay { get; }

Property Value

bool

DefaultFrame

Default is 0. If you set to -1 that would mean "last frame".

public int DefaultFrame { get; set; }

Property Value

int

IsPlaying

public bool IsPlaying { get; }

Property Value

bool

IsStandalone

protected bool IsStandalone { get; set; }

Property Value

bool

PlayWhenAvailable

public bool PlayWhenAvailable { get; protected set; }

Property Value

bool

Repeat

0 how many times should repeat, if less than 0 will loop forever

public int Repeat { get; set; }

Property Value

int

SpeedRatio

public double SpeedRatio { get; set; }

Property Value

double

Methods

ApplyDefaultFrame()

protected virtual void ApplyDefaultFrame()

ApplySpeed()

protected virtual void ApplySpeed()

CheckCanStartAnimator()

protected virtual bool CheckCanStartAnimator()

Returns

bool

GetAnimatorParent()

protected virtual SkiaControl GetAnimatorParent()

Returns

SkiaControl

GetFrameAt(float)

ratio 0-1

public double GetFrameAt(float ratio)

Parameters

ratio float

Returns

double

GetSourceType(string)

public SourceType GetSourceType(string fileName)

Parameters

fileName string

Returns

SourceType

InitializeAnimator()

public void InitializeAnimator()

OnAnimatorInitializing()

protected virtual void OnAnimatorInitializing()

OnAnimatorSeeking(double)

protected virtual void OnAnimatorSeeking(double frame)

Parameters

frame double

OnAnimatorStarting()

protected virtual void OnAnimatorStarting()

OnAnimatorUpdated(double)

Override this to react on animator running.

protected virtual void OnAnimatorUpdated(double value)

Parameters

value double

OnDisposing()

Base performs some cleanup actions with Superview

public override void OnDisposing()

OnFinished()

protected virtual void OnFinished()

OnLayoutChanged()

DrawingRect size changed

protected override void OnLayoutChanged()

OnStarted()

protected virtual void OnStarted()

OnVisibilityChanged(bool)

todo override for templated skialayout to use ViewsProvider

public override void OnVisibilityChanged(bool newvalue)

Parameters

newvalue bool

OnWillDisposeWithChildren()

The OnDisposing might come with a delay to avoid disposing resources at use. This method will be called without delay when Dispose() is invoked. Disposed will set to True and for Views their OnWillDisposeWithChildren will be called.

public override void OnWillDisposeWithChildren()

Paint(DrawingContext)

This is the main drawing routine you should override to draw something. Base one paints background color inside DrawingRect that was defined by Arrange inside base.Draw. Pass arguments if you want to use some time-frozen data for painting at any time from any thread..

protected override void Paint(DrawingContext ctx)

Parameters

ctx DrawingContext

PlayIfNeeded()

public void PlayIfNeeded()

PlayWhenAvailableIfNeeded()

protected virtual void PlayWhenAvailableIfNeeded()

RenderFrame(DrawingContext)

protected virtual void RenderFrame(DrawingContext ctx)

Parameters

ctx DrawingContext

Seek(double)

public void Seek(double frame)

Parameters

frame double

Start(int)

public virtual void Start(int delayMs = 0)

Parameters

delayMs int

Stop()

public virtual void Stop()

Events

Finished

All repeats completed

public event EventHandler Finished

Event Type

EventHandler

Started

public event EventHandler Started

Event Type

EventHandler