A WPF UI Element that reproduces animations based on sprite sheet files.
This project is licensed under the terms of Apache 2.0 license.
[ You can check the full documentation in wavessystems.com.br/projector. ]
I worked to make it as familiar as possible with other WPF controls, so using this control is quite simple! Check the following steps:
First thing, define the namespace in the parent object attributes.
xmlns:visual="clr-namespace:Waves.Visual;assembly=Waves.Visual.Projector"
Right! Now you can place the element like this:
<visual:Projector FrameCount="293"
ColumnCount="15"
Source="/Assets/nooooooo.png"
Width="800"
Height="450" />
You got to define the URI of the sprite sheet and then define the number of frames and the number of columns. The number of rows, let me automatically calculate for you.
Please do not forget: the frame and column count are especially important to run the animation properly. Mistaking these property values will create a visual mess.
I have not implemented the Width and Height automatic calculation for when these properties are set as "Auto" just like when you set source of an Image object, but it is on the plan.
This control implements some properties from Timeline, so we have basic animation properties such as FillBehavior, RepeatBehavior and AutoReverse, as shown in the following table:
Property | Description |
---|---|
AutoReverse | Gets or sets a value that indicates whether the animation plays in reverse after it completes a forward iteration. |
AutoStart | Gets of sets a value that indicates whether the animation starts automatically after loading. |
ColumnCount | Gets or Sets the amount of columns in the sprite animation sheet. |
Duration | Gets the length of time for which this Animation plays, not counting repetitions. |
FillBehavior | Gets or sets a value that specifies how the animation behaves after it reaches the end of its active period. |
FrameCount | Gets or Sets the amount of frames in the sprite animation file. |
FrameRate | Gets or Sets the frame per second rate of animation. |
IsPlaying | Gets or sets a value that indicates whether the animation is running. |
RepeatBehavior | Gets or sets the repeating behavior of this animation. |
Source | Gets or Sets the animated image displayed in the view. |
TotalDuration | Gets the length of time for which this Animation plays, counting repetitions. |
Method | Description |
---|---|
BeginAnimation() | Starts or resumes the animation. |
BeginAnimationAsync() | Starts or resumes the animation and holds the execution until the animation completes its active period. |
Dispose() | Releases all resources used by the Projector |
StopAnimation() | Stops the animation. |
Event | Description |
---|---|
Completed | Occurs when this animation has completely finished playing and will no longer enter its active period. |
v3.0.3.0:
- Restored repeat behavior feature.