Edit

Share via


Animation Class

Definition

Represents a Lottie animation that can be loaded, positioned, and rendered to a canvas.

public class Animation : SkiaSharp.SKObject
Inheritance

Remarks

Skottie is a Lottie animation player built on top of the Skia graphics library. Lottie is an animation file format that allows designers to create animations in tools like Adobe After Effects and export them as JSON files for use in applications.

Use the Create(String) or Parse(String) factory methods to load an animation, then use Seek(Double, InvalidationController) or SeekFrame(Double, InvalidationController) to set the animation state, and finally call Render(SKCanvas, SKRect) to draw the current frame.

For more control over the animation loading process, use CreateBuilder(AnimationBuilderFlags) to obtain an AnimationBuilder.

Properties

Name Description
Duration

Gets the animation duration.

Fps

Gets the animation frame rate.

InPoint

Gets the animation "in" point.

OutPoint

Gets the animation "out" point.

Size

Gets the animation size.

Version

Gets the animation Lottie bodymovin version.

Methods

Name Description
Create(SKData)

Creates an animation from Lottie JSON data.

Create(SKStream)

Creates an animation from a Skia stream containing Lottie JSON data.

Create(Stream)

Creates an animation from a .NET stream containing Lottie JSON data.

Create(String)

Creates an animation from a Lottie JSON file.

CreateBuilder(AnimationBuilderFlags)

Creates a new animation builder with the specified flags.

DisposeNative()

Disposes of the native resources associated with this animation.

Parse(String)

Parses an animation from a Lottie JSON string.

Render(SKCanvas, SKRect, AnimationRenderFlags)

Renders the current animation frame to a canvas with the specified render flags.

Render(SKCanvas, SKRect)

Renders the current animation frame to a canvas.

Seek(Double, InvalidationController)

Sets the animation state at a normalized position.

SeekFrame(Double, InvalidationController)

Sets the animation state at a specific frame number.

SeekFrameTime(Double, InvalidationController)

Sets the animation state at a specific time position in seconds.

SeekFrameTime(TimeSpan, InvalidationController)

Sets the animation state at a specific time position.

TryCreate(SKData, Animation)

Attempts to create an animation from Lottie JSON data.

TryCreate(SKStream, Animation)

Attempts to create an animation from a Skia stream containing Lottie JSON data.

TryCreate(Stream, Animation)

Attempts to create an animation from a .NET stream containing Lottie JSON data.

TryCreate(String, Animation)

Attempts to create an animation from a Lottie JSON file.

TryParse(String, Animation)

Attempts to parse an animation from a Lottie JSON string.

Applies to