Search in sources :

Example 91 with ObjectAnimator

use of android.animation.ObjectAnimator in project platform_frameworks_base by android.

the class DrawableHolder method addAnimTo.

/**
     *
     * Adds an animation that interpolates given property from its current value
     * to the given value.
     *
     * @param duration the duration, in ms.
     * @param delay the delay to start the animation, in ms.
     * @param property the property to animate
     * @param toValue the target value
     * @param replace if true, replace the current animation with this one.
     */
public ObjectAnimator addAnimTo(long duration, long delay, String property, float toValue, boolean replace) {
    if (replace)
        removeAnimationFor(property);
    ObjectAnimator anim = ObjectAnimator.ofFloat(this, property, toValue);
    anim.setDuration(duration);
    anim.setStartDelay(delay);
    anim.setInterpolator(EASE_OUT_INTERPOLATOR);
    this.addAnimation(anim, replace);
    if (DBG)
        Log.v(TAG, "animationCount = " + mAnimators.size());
    return anim;
}
Also used : ObjectAnimator(android.animation.ObjectAnimator)

Example 92 with ObjectAnimator

use of android.animation.ObjectAnimator in project FlyRefresh by race604.

the class FlyRefreshLayout method startRefresh.

@Override
public void startRefresh() {
    if (mFlyAnimator != null) {
        mFlyAnimator.end();
    }
    final View iconView = getIconView();
    UIUtils.clearAnimator(iconView);
    AnimatorSet flyUpAnim = new AnimatorSet();
    flyUpAnim.setDuration(800);
    ObjectAnimator transX = ObjectAnimator.ofFloat(iconView, "translationX", 0, getWidth());
    ObjectAnimator transY = ObjectAnimator.ofFloat(iconView, "translationY", 0, -mHeaderController.getHeight());
    transY.setInterpolator(PathInterpolatorCompat.create(0.7f, 1f));
    ObjectAnimator rotation = ObjectAnimator.ofFloat(iconView, "rotation", -45, 0);
    rotation.setInterpolator(new DecelerateInterpolator());
    ObjectAnimator rotationX = ObjectAnimator.ofFloat(iconView, "rotationX", 0, 60);
    rotationX.setInterpolator(new DecelerateInterpolator());
    flyUpAnim.playTogether(transX, transY, rotationX, ObjectAnimator.ofFloat(iconView, "scaleX", 1, 0.5f), ObjectAnimator.ofFloat(iconView, "scaleY", 1, 0.5f), rotation);
    mFlyAnimator = flyUpAnim;
    mFlyAnimator.start();
    if (mListener != null) {
        mListener.onRefresh(FlyRefreshLayout.this);
    }
}
Also used : DecelerateInterpolator(android.view.animation.DecelerateInterpolator) ObjectAnimator(android.animation.ObjectAnimator) AnimatorSet(android.animation.AnimatorSet) View(android.view.View) MountanScenceView(com.race604.flyrefresh.internal.MountanScenceView)

Example 93 with ObjectAnimator

use of android.animation.ObjectAnimator in project FloatingSearchView by renaudcerrato.

the class FloatingSearchView method fadeIn.

private void fadeIn(boolean enter) {
    ValueAnimator backgroundAnim;
    if (Build.VERSION.SDK_INT >= 19)
        backgroundAnim = ObjectAnimator.ofInt(mBackgroundDrawable, "alpha", enter ? 255 : 0);
    else {
        backgroundAnim = ValueAnimator.ofInt(enter ? 0 : 255, enter ? 255 : 0);
        backgroundAnim.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {

            @Override
            public void onAnimationUpdate(ValueAnimator animation) {
                int value = (Integer) animation.getAnimatedValue();
                mBackgroundDrawable.setAlpha(value);
            }
        });
    }
    backgroundAnim.setDuration(enter ? DEFAULT_DURATION_ENTER : DEFAULT_DURATION_EXIT);
    backgroundAnim.setInterpolator(enter ? DECELERATE : ACCELERATE);
    backgroundAnim.start();
    Drawable icon = unwrap(getIcon());
    if (icon != null) {
        ObjectAnimator iconAnim = ObjectAnimator.ofFloat(icon, "progress", enter ? 1 : 0);
        iconAnim.setDuration(backgroundAnim.getDuration());
        iconAnim.setInterpolator(backgroundAnim.getInterpolator());
        iconAnim.start();
    }
}
Also used : ObjectAnimator(android.animation.ObjectAnimator) ColorDrawable(android.graphics.drawable.ColorDrawable) Drawable(android.graphics.drawable.Drawable) ValueAnimator(android.animation.ValueAnimator)

Example 94 with ObjectAnimator

use of android.animation.ObjectAnimator in project ToggleDrawable by renaudcerrato.

the class MainActivity method toggle.

private void toggle() {
    isFaded = !isFaded;
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
        AnimatorSet set = new AnimatorSet();
        ObjectAnimator backgroundAnim = ObjectAnimator.ofInt(mContainer.getBackground(), "alpha", isFaded ? 128 : 0);
        ObjectAnimator drawableAnim = ObjectAnimator.ofInt(mSeekBar, "progress", isFaded ? mSeekBar.getMax() : 0);
        set.setDuration(700);
        set.setInterpolator(new DecelerateInterpolator(3f));
        set.playTogether(backgroundAnim, drawableAnim);
        set.start();
    } else {
        Animation set = new ToggleAnimationSet(isFaded);
        set.setDuration(700);
        set.setInterpolator(new DecelerateInterpolator(3f));
        mContainer.startAnimation(set);
    }
}
Also used : DecelerateInterpolator(android.view.animation.DecelerateInterpolator) ObjectAnimator(android.animation.ObjectAnimator) Animation(android.view.animation.Animation) AnimatorSet(android.animation.AnimatorSet)

Example 95 with ObjectAnimator

use of android.animation.ObjectAnimator in project kickmaterial by byoutline.

the class AnimatorUtils method getScaleAnimator.

public static AnimatorSet getScaleAnimator(View view, float startScale, float endScale) {
    AnimatorSet set = new AnimatorSet();
    ObjectAnimator scaleXAnimator = ObjectAnimator.ofFloat(view, View.SCALE_X, startScale, endScale);
    ObjectAnimator scaleYAnimator = ObjectAnimator.ofFloat(view, View.SCALE_Y, startScale, endScale);
    set.playTogether(scaleXAnimator, scaleYAnimator);
    return set;
}
Also used : ObjectAnimator(android.animation.ObjectAnimator) AnimatorSet(android.animation.AnimatorSet)

Aggregations

ObjectAnimator (android.animation.ObjectAnimator)791 Animator (android.animation.Animator)313 AnimatorSet (android.animation.AnimatorSet)214 AnimatorListenerAdapter (android.animation.AnimatorListenerAdapter)208 PropertyValuesHolder (android.animation.PropertyValuesHolder)128 ValueAnimator (android.animation.ValueAnimator)111 View (android.view.View)102 Paint (android.graphics.Paint)68 TextView (android.widget.TextView)49 DecelerateInterpolator (android.view.animation.DecelerateInterpolator)48 ViewGroup (android.view.ViewGroup)45 Rect (android.graphics.Rect)35 LinearInterpolator (android.view.animation.LinearInterpolator)35 ImageView (android.widget.ImageView)31 AccelerateDecelerateInterpolator (android.view.animation.AccelerateDecelerateInterpolator)30 AccelerateInterpolator (android.view.animation.AccelerateInterpolator)29 OvershootInterpolator (android.view.animation.OvershootInterpolator)29 ArrayList (java.util.ArrayList)22 TargetApi (android.annotation.TargetApi)21 Interpolator (android.view.animation.Interpolator)20