Search in sources :

Example 61 with OvershootInterpolator

use of android.view.animation.OvershootInterpolator in project FloatingActionButton by Clans.

the class MenusFragment method createCustomAnimation.

private void createCustomAnimation() {
    AnimatorSet set = new AnimatorSet();
    ObjectAnimator scaleOutX = ObjectAnimator.ofFloat(menuGreen.getMenuIconView(), "scaleX", 1.0f, 0.2f);
    ObjectAnimator scaleOutY = ObjectAnimator.ofFloat(menuGreen.getMenuIconView(), "scaleY", 1.0f, 0.2f);
    ObjectAnimator scaleInX = ObjectAnimator.ofFloat(menuGreen.getMenuIconView(), "scaleX", 0.2f, 1.0f);
    ObjectAnimator scaleInY = ObjectAnimator.ofFloat(menuGreen.getMenuIconView(), "scaleY", 0.2f, 1.0f);
    scaleOutX.setDuration(50);
    scaleOutY.setDuration(50);
    scaleInX.setDuration(150);
    scaleInY.setDuration(150);
    scaleInX.addListener(new AnimatorListenerAdapter() {

        @Override
        public void onAnimationStart(Animator animation) {
            menuGreen.getMenuIconView().setImageResource(menuGreen.isOpened() ? R.drawable.ic_close : R.drawable.ic_star);
        }
    });
    set.play(scaleOutX).with(scaleOutY);
    set.play(scaleInX).with(scaleInY).after(scaleOutX);
    set.setInterpolator(new OvershootInterpolator(2));
    menuGreen.setIconToggleAnimatorSet(set);
}
Also used : ObjectAnimator(android.animation.ObjectAnimator) Animator(android.animation.Animator) OvershootInterpolator(android.view.animation.OvershootInterpolator) ObjectAnimator(android.animation.ObjectAnimator) AnimatorListenerAdapter(android.animation.AnimatorListenerAdapter) AnimatorSet(android.animation.AnimatorSet)

Example 62 with OvershootInterpolator

use of android.view.animation.OvershootInterpolator in project GSYVideoPlayer by CarGuo.

the class ENDownloadView method start.

public void start() {
    if (mValueAnimator != null) {
        mValueAnimator.removeAllListeners();
        mValueAnimator.removeAllUpdateListeners();
        if (mValueAnimator.isRunning())
            mValueAnimator.cancel();
        mValueAnimator = null;
    }
    mCurrentState = STATE_DOWNLOADING;
    mValueAnimator = ValueAnimator.ofFloat(1.f, 100.f);
    mValueAnimator.setDuration(1500);
    mValueAnimator.setInterpolator(new OvershootInterpolator());
    mValueAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {

        @Override
        public void onAnimationUpdate(ValueAnimator valueAnimator) {
            mFraction = valueAnimator.getAnimatedFraction();
            invalidate();
        }
    });
    mValueAnimator.addListener(new AnimatorListenerAdapter() {

        @Override
        public void onAnimationEnd(Animator animation) {
            mCurrentState = STATE_DOWNLOADING;
            downloadAnim();
        }
    });
    mValueAnimator.start();
}
Also used : Animator(android.animation.Animator) ValueAnimator(android.animation.ValueAnimator) OvershootInterpolator(android.view.animation.OvershootInterpolator) AnimatorListenerAdapter(android.animation.AnimatorListenerAdapter) ValueAnimator(android.animation.ValueAnimator)

Example 63 with OvershootInterpolator

use of android.view.animation.OvershootInterpolator in project ElasticDownload by Tibolte.

the class ProgressDownloadView method drawFail.

public void drawFail() {
    mState = State.STATE_FAILED;
    ObjectAnimator failAnim = ObjectAnimator.ofFloat(this, "failAngle", 0, 180);
    failAnim.setInterpolator(new OvershootInterpolator());
    //This one doesn't do much actually, we just use it to take advantage of associating two different interpolators
    ObjectAnimator anim = ObjectAnimator.ofFloat(this, "progress", getProgress(), mTarget);
    anim.setInterpolator(new AccelerateInterpolator());
    AnimatorSet set = new AnimatorSet();
    set.setDuration((long) (ANIMATION_DURATION_BASE / 1.7f));
    set.playTogether(failAnim, anim);
    set.start();
}
Also used : OvershootInterpolator(android.view.animation.OvershootInterpolator) AccelerateInterpolator(android.view.animation.AccelerateInterpolator) ObjectAnimator(com.nineoldandroids.animation.ObjectAnimator) AnimatorSet(com.nineoldandroids.animation.AnimatorSet)

Example 64 with OvershootInterpolator

use of android.view.animation.OvershootInterpolator in project ElasticDownload by Tibolte.

the class ProgressDownloadView method drawSuccess.

public void drawSuccess() {
    mTarget = 100;
    final ObjectAnimator successAnim = ObjectAnimator.ofFloat(this, "flip", 1, -1);
    successAnim.setInterpolator(new OvershootInterpolator());
    successAnim.setDuration(ANIMATION_DURATION_BASE);
    ObjectAnimator anim = ObjectAnimator.ofFloat(this, "progress", getProgress(), mTarget);
    anim.setInterpolator(new DecelerateInterpolator());
    anim.setDuration((long) (ANIMATION_DURATION_BASE + Math.abs(mTarget * 10 - getProgress() * 10) / 2));
    anim.addListener(new Animator.AnimatorListener() {

        @Override
        public void onAnimationStart(Animator animation) {
        }

        @Override
        public void onAnimationEnd(Animator animation) {
            mState = State.STATE_SUCCESS;
            successAnim.start();
        }

        @Override
        public void onAnimationCancel(Animator animation) {
        }

        @Override
        public void onAnimationRepeat(Animator animation) {
        }
    });
    anim.start();
}
Also used : DecelerateInterpolator(android.view.animation.DecelerateInterpolator) Animator(com.nineoldandroids.animation.Animator) ObjectAnimator(com.nineoldandroids.animation.ObjectAnimator) OvershootInterpolator(android.view.animation.OvershootInterpolator) ObjectAnimator(com.nineoldandroids.animation.ObjectAnimator)

Example 65 with OvershootInterpolator

use of android.view.animation.OvershootInterpolator in project android-floating-action-menu by sephiroth74.

the class MainActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    Log.i(TAG, "onCreate: " + savedInstanceState);
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    List<String> objects = new ArrayList<>();
    populateData(objects);
    ArrayAdapter<String> adapter = new ArrayAdapter<>(this, android.R.layout.simple_list_item_1, android.R.id.text1, objects);
    mListView.setAdapter(adapter);
    mListView.setOnItemClickListener(this);
    boolean visible = true;
    if (null != savedInstanceState) {
        visible = savedInstanceState.getBoolean("floating-menu-visible", true);
    }
    FloatingActionItem item1 = new FloatingActionItem.Builder(this, 0, R.style.FloatingActionMenuItemStyle).withResId(R.drawable.ic_facebook).withDelay(0).build();
    FloatingActionItem item2 = new FloatingActionItem.Builder(this, 1, R.style.FloatingActionMenuItemStyle).withResId(R.drawable.ic_googleplus).withDelay(50).build();
    FloatingActionItem item3 = new FloatingActionItem.Builder(this, 2, R.style.FloatingActionMenuItemStyle).withResId(R.drawable.ic_twitter).withDelay(100).build();
    mFloatingMenu = new FloatingActionMenu.Builder(this, R.style.FloatingActionMenuStyle).addItem(item1).addItem(item2).addItem(item3).withScrollDelegate(new FloatingActionMenu.AbsListViewScrollDelegate(mListView)).withThreshold(R.dimen.float_action_threshold).withGap(R.dimen.float_action_item_gap).withVerticalPadding(R.dimen.float_action_v_padding).withGravity(FloatingActionMenu.Gravity.CENTER_HORIZONTAL | FloatingActionMenu.Gravity.BOTTOM).withDirection(FloatingActionMenu.Direction.Vertical).animationDuration(400).animationInterpolator(new OvershootInterpolator()).visible(visible).build();
    mFloatingMenu.setOnItemClickListener(this);
}
Also used : OvershootInterpolator(android.view.animation.OvershootInterpolator) ArrayList(java.util.ArrayList) FloatingActionItem(it.sephiroth.android.library.floatingmenu.FloatingActionItem) ArrayAdapter(android.widget.ArrayAdapter) FloatingActionMenu(it.sephiroth.android.library.floatingmenu.FloatingActionMenu)

Aggregations

OvershootInterpolator (android.view.animation.OvershootInterpolator)85 ObjectAnimator (android.animation.ObjectAnimator)32 Animator (android.animation.Animator)21 View (android.view.View)21 AnimatorSet (android.animation.AnimatorSet)15 AnimatorListenerAdapter (android.animation.AnimatorListenerAdapter)14 TextView (android.widget.TextView)14 AccelerateInterpolator (android.view.animation.AccelerateInterpolator)13 Handler (android.os.Handler)12 ValueAnimator (android.animation.ValueAnimator)10 LinearInterpolator (android.view.animation.LinearInterpolator)10 DecelerateInterpolator (android.view.animation.DecelerateInterpolator)8 Drawable (android.graphics.drawable.Drawable)7 RecyclerView (android.support.v7.widget.RecyclerView)7 AccelerateDecelerateInterpolator (android.view.animation.AccelerateDecelerateInterpolator)7 LayerDrawable (android.graphics.drawable.LayerDrawable)6 PropertyValuesHolder (android.animation.PropertyValuesHolder)5 Rect (android.graphics.Rect)5 Interpolator (android.view.animation.Interpolator)5 Point (android.graphics.Point)4