List of usage examples for android.animation ObjectAnimator ofFloat
public static <T> ObjectAnimator ofFloat(T target, Property<T, Float> xProperty, Property<T, Float> yProperty, Path path)
Path
using two properties. From source file:Main.java
public static Animator slide(@NonNull View view, int fromY, int toY, int time) { ObjectAnimator animatorY = ObjectAnimator.ofFloat(view, "translationY", fromY, toY); animatorY.setDuration(time);/*from w w w. j a va2 s. c o m*/ animatorY.start(); return animatorY; }
From source file:Main.java
public static void rotate(ImageView iv, boolean ivDownFlag) { float startRotation = iv.getRotation(); float endRotation = ivDownFlag ? startRotation + 180 : startRotation - 180; ObjectAnimator.ofFloat(iv, "rotation", startRotation, endRotation).setDuration(500).start(); }
From source file:Main.java
public static ObjectAnimator tranY(View view, int duration, float pos) { float currentY = view.getTranslationY(); ObjectAnimator animator = ObjectAnimator.ofFloat(view, TRANSLATION_Y, pos, currentY); return animator.setDuration(duration); }
From source file:Main.java
public static void changeImageSize(ImageView image, float fromScale, float toScale) { ObjectAnimator scaleX;/*from w w w . j a va2 s . co m*/ ObjectAnimator scaleY; scaleX = ObjectAnimator.ofFloat(image, "scaleX", fromScale, toScale); scaleY = ObjectAnimator.ofFloat(image, "scaleY", fromScale, toScale); AnimatorSet set = new AnimatorSet(); set.setDuration(150); set.playTogether(scaleX, scaleY); set.start(); }
From source file:Main.java
public static Animator createFadeInAnimator(View view) { ObjectAnimator anim = ObjectAnimator.ofFloat(view, "alpha", 0f, 1f); anim.setInterpolator(new LinearInterpolator()); anim.setDuration(250);//from w w w.ja v a 2 s . c o m return anim; }
From source file:Main.java
public static Animator createFadeOutAnimator(View view) { ObjectAnimator anim = ObjectAnimator.ofFloat(view, "alpha", 1f, 0f); anim.setInterpolator(new LinearInterpolator()); anim.setDuration(250);// ww w . ja v a2s. c o m return anim; }
From source file:Main.java
public static void doSimpleRefresh(Object view) { LinearInterpolator interpolator = new LinearInterpolator(); ObjectAnimator refreshAnimator = ObjectAnimator.ofFloat(view, "rotation", 0f, 360f); refreshAnimator.setInterpolator(interpolator); refreshAnimator.setDuration(300);/*from w ww .j av a2s . c o m*/ refreshAnimator.setRepeatCount(3); refreshAnimator.start(); }
From source file:Main.java
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;/* w w w. ja v a 2s.c om*/ }
From source file:Main.java
public static void animFlicker(View view, long duration, int repeatCount) { AnimatorSet animatorSet = new AnimatorSet(); ObjectAnimator alphaIn = ObjectAnimator.ofFloat(view, "alpha", 0.0f, 1.0f); ObjectAnimator alphaOut = ObjectAnimator.ofFloat(view, "alpha", 1.0f, 0.0f); alphaIn.setDuration(duration);/*from w w w .j a v a 2 s . c om*/ alphaIn.setStartDelay(duration); alphaOut.setDuration(duration); alphaOut.setRepeatCount(repeatCount); alphaIn.setRepeatCount(repeatCount); animatorSet.playTogether(alphaOut, alphaIn); animatorSet.start(); }
From source file:Main.java
public static ObjectAnimator fadeIn(final View v) { ObjectAnimator alphaAnim = ObjectAnimator.ofFloat(v, "alpha", 0f, 1f); alphaAnim.setDuration(ANIM_DURATION_FADEIN); alphaAnim.addListener(new AnimatorListenerAdapter() { @Override//from w ww. j ava2s . co m public void onAnimationStart(Animator animation) { v.setVisibility(View.VISIBLE); } }); return alphaAnim; }