Table of Contents

Class SkiaSpriteSet

Namespace
DrawnUi.Controls
Assembly
DrawnUi.Maui.dll

Stateful sprite switcher that PRE-CREATES one SkiaSprite per integer state via Define(). Base OnChangeState swaps the active child to the precreated sprite atomically. Subclasses can override OnChangeState, call base, then adjust CurrentSprite (e.g., ScaleX).

public class SkiaSpriteSet : ContentLayout, INotifyPropertyChanged, IEffectControlProvider, IToolTipElement, IContextFlyoutElement, IAnimatable, IVisualElementController, IElementController, IView, ITransform, IElement, IVisualTreeElement, IContainer, IList<IView>, ICollection<IView>, IEnumerable<IView>, IEnumerable, IHasAfterEffects, ISkiaDisposable, ISkiaGridLayout, ISkiaLayout, ISkiaControl, IDrawnBase, ICanBeUpdatedWithContext, ICanBeUpdated, ILayoutInsideViewport, IInsideViewport, IDisposable, IVisibilityAware, ISkiaGestureListener, IWithContent
Inheritance
SkiaSpriteSet
Implements
Inherited Members
Extension Methods

Fields

StateProperty

public static readonly BindableProperty StateProperty

Field Value

BindableProperty

Properties

CurrentSprite

The currently active SkiaSprite instance.

public SkiaSprite CurrentSprite { get; }

Property Value

SkiaSprite

State

Current integer state. Setting this triggers OnChangeState.

public int State { get; set; }

Property Value

int

Methods

Define(int, string, int, int, double, int, bool)

Create and register a sprite for a state, preconfiguring Source, Columns, Rows, FPS and Repeat. If this state equals the current State and no active sprite exists yet, it becomes active immediately.

public SkiaSpriteSet Define(int state, string source, int columns, int rows, double fps = 15, int repeat = -1, bool autoPlay = true)

Parameters

state int
source string
columns int
rows int
fps double
repeat int
autoPlay bool

Returns

SkiaSpriteSet

OnChangeState(int, int)

Base: swap active child to the precreated sprite for newState. Subclasses should call base first, then adjust CurrentSprite (e.g., ScaleX).

protected virtual void OnChangeState(int oldState, int newState)

Parameters

oldState int
newState int