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

Support For Lottie Animation Start/Stop #93

Open
asliujinhe opened this issue Nov 23, 2024 · 1 comment
Open

Support For Lottie Animation Start/Stop #93

asliujinhe opened this issue Nov 23, 2024 · 1 comment

Comments

@asliujinhe
Copy link

I attempted to use reflection to invoke the private Start and Stop methods in Lottie.cs. While this approach works in certain scenarios, some specific Lottie files exhibit issues where the animation continues to play indefinitely, even after invoking Stop. It seems that these problematic files also render the RepeatCount property ineffective, as the property value does not appear to influence the playback behavior.

private void ChangeLottieStatus(bool animating)
    {
        var lottie = LottieLoading;
        
        var type = lottie.GetType();
        
        var methodName = animating ? "Start" : "Stop";

        var methodInfo = type.GetMethod(methodName, BindingFlags.NonPublic | BindingFlags.Instance);

        if (methodInfo != null)
        {
            methodInfo.Invoke(lottie, null);
        }
        else
        {
            Console.WriteLine($"Method '{methodName}' Not Found.");
        }
    }

Thanks!

@emmauss
Copy link
Collaborator

emmauss commented Nov 23, 2024

There's already a PR for this. #89

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

No branches or pull requests

2 participants