VectSharp 2.6.1
A light library for C# vector graphics
Loading...
Searching...
No Matches
VectSharp.Canvas.AnimatedCanvas Class Reference

An Avalonia.Controls.Canvas containing an animation. More...

Inheritance diagram for VectSharp.Canvas.AnimatedCanvas:

Public Member Functions

override void Render (DrawingContext context)
 

Static Public Attributes

static readonly StyledProperty< int > CurrentFrameProperty
 Defines the CurrentFrame property. More...
 
static readonly DirectProperty< AnimatedCanvas, int > FrameCountProperty = AvaloniaProperty.RegisterDirect<AnimatedCanvas, int>(nameof(FrameCount), o => o.maxFrameIndex)
 Defines the FrameCount property. More...
 
static readonly DirectProperty< AnimatedCanvas, double > FrameRateProperty = AvaloniaProperty.RegisterDirect<AnimatedCanvas, double>(nameof(FrameRate), o => o.FrameRate)
 Defines the FrameRate property. More...
 
static readonly StyledProperty< bool > IsPlayingProperty
 Defines the IsPlaying property. More...
 

Properties

int CurrentFrame [get, set]
 The current frame in the animation. More...
 
int FrameCount [get]
 The number of frames in the animation. More...
 
double FrameRate [get]
 The target frame rate of the animation. More...
 
bool IsPlaying [get, set]
 The current frame in the animation. More...
 

Detailed Description

An Avalonia.Controls.Canvas containing an animation.

Definition at line 28 of file AnimatedCanvas.cs.

Member Function Documentation

◆ Render()

override void VectSharp.Canvas.AnimatedCanvas.Render ( DrawingContext  context)

Definition at line 203 of file AnimatedCanvas.cs.

Member Data Documentation

◆ CurrentFrameProperty

readonly StyledProperty<int> VectSharp.Canvas.AnimatedCanvas.CurrentFrameProperty
static
Initial value:
= AvaloniaProperty.Register<AnimatedCanvas, int>(nameof(CurrentFrame), coerce: (ownerObject, val) =>
{
AnimatedCanvas owner = (AnimatedCanvas)ownerObject;
if (owner.maxFrameIndex > 0)
{
if (val < owner.maxFrameIndex)
{
return val;
}
else
{
owner.IsPlaying = false;
return owner.maxFrameIndex - 1;
}
}
else
{
return val % owner.RenderActions.Length;
}
})
int CurrentFrame
The current frame in the animation.

Defines the CurrentFrame property.

Definition at line 33 of file AnimatedCanvas.cs.

◆ FrameCountProperty

readonly DirectProperty<AnimatedCanvas, int> VectSharp.Canvas.AnimatedCanvas.FrameCountProperty = AvaloniaProperty.RegisterDirect<AnimatedCanvas, int>(nameof(FrameCount), o => o.maxFrameIndex)
static

Defines the FrameCount property.

Definition at line 67 of file AnimatedCanvas.cs.

◆ FrameRateProperty

readonly DirectProperty<AnimatedCanvas, double> VectSharp.Canvas.AnimatedCanvas.FrameRateProperty = AvaloniaProperty.RegisterDirect<AnimatedCanvas, double>(nameof(FrameRate), o => o.FrameRate)
static

Defines the FrameRate property.

Definition at line 91 of file AnimatedCanvas.cs.

◆ IsPlayingProperty

readonly StyledProperty<bool> VectSharp.Canvas.AnimatedCanvas.IsPlayingProperty
static
Initial value:
= AvaloniaProperty.Register<AnimatedCanvas, bool>(nameof(IsPlaying), false, coerce: (ownerObject, val) =>
{
AnimatedCanvas owner = (AnimatedCanvas)ownerObject;
if (owner.IsPlaying && !val)
{
owner.RefreshTimer.Dispose();
}
else if (!owner.IsPlaying && val)
{
owner.RefreshTimer = new System.Threading.Timer(_ =>
{
_ = Avalonia.Threading.Dispatcher.UIThread.InvokeAsync(() =>
{
owner.CurrentFrame++;
});
}, null, 0, (long)(1000.0 / owner.FrameRate));
}
return val;
})
bool IsPlaying
The current frame in the animation.

Defines the IsPlaying property.

Definition at line 115 of file AnimatedCanvas.cs.

Property Documentation

◆ CurrentFrame

int VectSharp.Canvas.AnimatedCanvas.CurrentFrame
getset

The current frame in the animation.

Definition at line 58 of file AnimatedCanvas.cs.

◆ FrameCount

int VectSharp.Canvas.AnimatedCanvas.FrameCount
get

The number of frames in the animation.

Definition at line 74 of file AnimatedCanvas.cs.

◆ FrameRate

double VectSharp.Canvas.AnimatedCanvas.FrameRate
get

The target frame rate of the animation.

Definition at line 98 of file AnimatedCanvas.cs.

◆ IsPlaying

bool VectSharp.Canvas.AnimatedCanvas.IsPlaying
getset

The current frame in the animation.

Definition at line 140 of file AnimatedCanvas.cs.


The documentation for this class was generated from the following file: