Class AnimatedFramesRenderer
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
DefaultFrameProperty
public static readonly BindableProperty DefaultFrameProperty
Field Value
RepeatProperty
public static readonly BindableProperty RepeatProperty
Field Value
SpeedRatioProperty
public static readonly BindableProperty SpeedRatioProperty
Field Value
WasPlayingBeforeVisibilityChanged
protected bool WasPlayingBeforeVisibilityChanged
Field Value
WasStarted
protected bool WasStarted
Field Value
Properties
Animator
public RangeAnimator Animator { get; protected set; }
Property Value
AutoPlay
public bool AutoPlay { get; set; }
Property Value
CanPlay
protected bool CanPlay { get; }
Property Value
DefaultFrame
Default is 0. If you set to -1 that would mean "last frame".
public int DefaultFrame { get; set; }
Property Value
IsPlaying
public bool IsPlaying { get; }
Property Value
IsStandalone
protected bool IsStandalone { get; set; }
Property Value
PlayWhenAvailable
public bool PlayWhenAvailable { get; protected set; }
Property Value
Repeat
0 how many times should repeat, if less than 0 will loop forever
public int Repeat { get; set; }
Property Value
SpeedRatio
public double SpeedRatio { get; set; }
Property Value
Methods
ApplyDefaultFrame()
protected virtual void ApplyDefaultFrame()
ApplySpeed()
protected virtual void ApplySpeed()
CheckCanStartAnimator()
protected virtual bool CheckCanStartAnimator()
Returns
GetAnimatorParent()
protected virtual SkiaControl GetAnimatorParent()
Returns
GetFrameAt(float)
ratio 0-1
public double GetFrameAt(float ratio)
Parameters
ratiofloat
Returns
GetSourceType(string)
public SourceType GetSourceType(string fileName)
Parameters
fileNamestring
Returns
InitializeAnimator()
public void InitializeAnimator()
OnAnimatorInitializing()
protected virtual void OnAnimatorInitializing()
OnAnimatorSeeking(double)
protected virtual void OnAnimatorSeeking(double frame)
Parameters
framedouble
OnAnimatorStarting()
protected virtual void OnAnimatorStarting()
OnAnimatorUpdated(double)
Override this to react on animator running.
protected virtual void OnAnimatorUpdated(double value)
Parameters
valuedouble
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
newvaluebool
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
ctxDrawingContext
PlayIfNeeded()
public void PlayIfNeeded()
PlayWhenAvailableIfNeeded()
protected virtual void PlayWhenAvailableIfNeeded()
RenderFrame(DrawingContext)
protected virtual void RenderFrame(DrawingContext ctx)
Parameters
ctxDrawingContext
Seek(double)
public void Seek(double frame)
Parameters
framedouble
Start(int)
public virtual void Start(int delayMs = 0)
Parameters
delayMsint
Stop()
public virtual void Stop()
Events
Finished
All repeats completed
public event EventHandler Finished
Event Type
Started
public event EventHandler Started