Skip to content

Set animation length #167

Closed Answered by Sebosek
Sebosek asked this question in Q&A
Discussion options

You must be logged in to vote

If someone would have a similar requirement, here is how you could do it using the Animation API.

    private void AnimationStart_OnClicked(object? sender, EventArgs e)
    {
        const string NAME = "lottie";
        
        // Requested length of animation
        var requested = TimeSpan.FromSeconds(2).TotalMilliseconds;
        // To manually move the progress of animation, compute multiplication
        var multiplication = Duration.TotalMilliseconds / requested;
        // Create an animation to make a progress in Lottie animation (IsAnimationEnabled has to set to false)
        var animation = new Animation(v => Progress = TimeSpan.FromMilliseconds(v * multiplication), 0, reque…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by Sebosek
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant