Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a SKLottieView to play Lottie animations #118

Merged
merged 19 commits into from
Jun 29, 2022
Merged

Add a SKLottieView to play Lottie animations #118

merged 19 commits into from
Jun 29, 2022

Conversation

mattleibow
Copy link
Contributor

Description of Change

This is the initial set of views and types needed to play Lottie animations from just a single line of XAML:

<controls:SKLottieView Source="Lottie/trophy.json" />

API Changes

public class SKLottieView : SKAnimatedSurfaceView
{
    public static readonly BindableProperty SourceProperty;
    public static readonly BindableProperty DurationProperty;
    public static readonly BindableProperty ProgressProperty;
    public static readonly BindableProperty IsCompleteProperty;

    public SKLottieView();

    public SKLottieImageSource? Source { get; set; }
    public TimeSpan Duration { get; }
    public TimeSpan Progress { get; set; }
    public bool IsComplete { get; }
}
public class SKLottieImageSource : Element
{
    public bool IsEmpty { get; }
}

public class SKFileLottieImageSource : SKLottieImageSource
{
    public string? File { get; set; }
}

public class SKStreamLottieImageSource : SKLottieImageSource
{
    public Func<CancellationToken, Task<Stream?>>? Stream { get; set; }
}

public class SKUriLottieImageSource : SKLottieImageSource
{
    public Uri? Uri { get; set; }
}

Behavioral Changes

None.

PR Checklist

  • Has tests (if omitted, state reason in description)
  • Has samples (if omitted, state reason in description)
  • Rebased on top of main at time of PR
  • Changes adhere to coding standard
  • Updated documentation

@mattleibow mattleibow merged commit 9e2015e into main Jun 29, 2022
@mattleibow mattleibow deleted the dev/lottie branch June 29, 2022 00:20
@amirvenus
Copy link

Is there a way to specify the AssetsFolder path for the png images of the animation?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants