Search in sources :

Example 1 with ViewAnimator

use of com.github.florent37.viewanimator.ViewAnimator in project ViewAnimator by florent37.

the class MainActivity method animateParallel.

protected void animateParallel() {
    final ViewAnimator viewAnimator = ViewAnimator.animate(mountain, image).dp().translationY(-1000, 0).alpha(0, 1).singleInterpolator(new OvershootInterpolator()).andAnimate(percent).scale(0, 1).andAnimate(text).textColor(Color.BLACK, Color.WHITE).backgroundColor(Color.WHITE, Color.BLACK).waitForHeight().singleInterpolator(new AccelerateDecelerateInterpolator()).duration(2000).thenAnimate(percent).custom(new AnimationListener.Update<TextView>() {

        @Override
        public void update(TextView view, float value) {
            view.setText(String.format(Locale.US, "%.02f%%", value));
        }
    }, 0, 1).andAnimate(image).rotation(0, 360).duration(5000).start();
    new Handler(Looper.getMainLooper()).postDelayed(new Runnable() {

        @Override
        public void run() {
            viewAnimator.cancel();
        }
    }, 3000);
}
Also used : ViewAnimator(com.github.florent37.viewanimator.ViewAnimator) OvershootInterpolator(android.view.animation.OvershootInterpolator) AccelerateDecelerateInterpolator(android.view.animation.AccelerateDecelerateInterpolator) Handler(android.os.Handler) TextView(android.widget.TextView) AnimationListener(com.github.florent37.viewanimator.AnimationListener)

Example 2 with ViewAnimator

use of com.github.florent37.viewanimator.ViewAnimator in project ViewAnimator by florent37.

the class ViewAnimatorMainActivity method animateParallel.

protected void animateParallel() {
    final ViewAnimator viewAnimator = ViewAnimator.animate(mountain, image).dp().translationY(-1000, 0).alpha(0, 1).singleInterpolator(new OvershootInterpolator()).andAnimate(percent).scale(0, 1).andAnimate(text).textColor(Color.BLACK, Color.WHITE).backgroundColor(Color.WHITE, Color.BLACK).waitForHeight().singleInterpolator(new AccelerateDecelerateInterpolator()).duration(2000).thenAnimate(percent).custom(new AnimationListener.Update<TextView>() {

        @Override
        public void update(TextView view, float value) {
            view.setText(String.format(Locale.US, "%.02f%%", value));
        }
    }, 0, 1).andAnimate(image).rotation(0, 360).duration(5000).start();
    new Handler(Looper.getMainLooper()).postDelayed(new Runnable() {

        @Override
        public void run() {
            viewAnimator.cancel();
        }
    }, 3000);
}
Also used : ViewAnimator(com.github.florent37.viewanimator.ViewAnimator) OvershootInterpolator(android.view.animation.OvershootInterpolator) AccelerateDecelerateInterpolator(android.view.animation.AccelerateDecelerateInterpolator) Handler(android.os.Handler) TextView(android.widget.TextView) AnimationListener(com.github.florent37.viewanimator.AnimationListener)

Aggregations

Handler (android.os.Handler)2 AccelerateDecelerateInterpolator (android.view.animation.AccelerateDecelerateInterpolator)2 OvershootInterpolator (android.view.animation.OvershootInterpolator)2 TextView (android.widget.TextView)2 AnimationListener (com.github.florent37.viewanimator.AnimationListener)2 ViewAnimator (com.github.florent37.viewanimator.ViewAnimator)2