florent37 / ViewAnimator

A fluent Android animation library
Apache License 2.0
2.71k stars 423 forks source link

Can I stop the animation? #27

Closed Jimweb3 closed 7 years ago

Jimweb3 commented 7 years ago

when I set repeat count , like 200 , then view repeats 100 , I want stop it , How can I do ?

shahimclt commented 7 years ago

This was added in 9809cd49131ad9dda503606fe762656dcd607b9b. Implementation can be found in sample.

final ViewAnimator viewAnimator = ViewAnimator.animate(mountain, image)
    ....
    ....
    .start();

new Handler(Looper.getMainLooper()).postDelayed(new Runnable() {
    @Override
    public void run() {
        viewAnimator.cancel();
    }
}, 3000);