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;
}
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);
}
}
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();
}
}
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);
}
}
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;
}
Aggregations