Search in sources :

Example 1 with ArcAnimator

use of org.aisen.weibo.sina.ui.widget.io.codetail.animation.arcanimator.ArcAnimator in project AisenWeiBo by wangdan.

the class FabAnimation method startArcAnim.

protected void startArcAnim(View view, float endX, float endY, float degrees, Side side, long duration, Interpolator interpolator, final AnimationListener listener) {
    // Setup animation
    // Cast end coordinates to ints so that the FAB will be animated to the same position even
    // when there are minute differences in the coordinates
    ArcAnimator anim = ArcAnimator.createArcAnimator(view, (int) endX, (int) endY, degrees, side);
    anim.setDuration(duration);
    anim.setInterpolator(interpolator);
    // Add listener
    anim.addListener(new AnimatorListenerAdapter() {

        @Override
        public void onAnimationStart(Animator animation) {
            if (listener != null) {
                listener.onStart();
            }
        }

        @Override
        public void onAnimationEnd(Animator animation) {
            if (listener != null) {
                listener.onEnd();
            }
        }
    });
    // Start animation
    anim.start();
}
Also used : Animator(com.nineoldandroids.animation.Animator) ArcAnimator(org.aisen.weibo.sina.ui.widget.io.codetail.animation.arcanimator.ArcAnimator) AnimatorListenerAdapter(com.nineoldandroids.animation.AnimatorListenerAdapter) ArcAnimator(org.aisen.weibo.sina.ui.widget.io.codetail.animation.arcanimator.ArcAnimator)

Aggregations

Animator (com.nineoldandroids.animation.Animator)1 AnimatorListenerAdapter (com.nineoldandroids.animation.AnimatorListenerAdapter)1 ArcAnimator (org.aisen.weibo.sina.ui.widget.io.codetail.animation.arcanimator.ArcAnimator)1