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
@TargetApi(Build.VERSION_CODES.HONEYCOMB) private static void fadeInHoneyComb(final View view) { view.setAlpha(0.0F);//w w w .j a va 2 s. co m view.setVisibility(View.VISIBLE); ObjectAnimator.ofFloat(view, "alpha", 0.0F, 1.0F).setDuration(ANIMATION_DURATION).start(); }
From source file:Main.java
/** * shake x/*from w ww . j ava 2s . c o m*/ * * @param v * @param offset * @param duration * @param times */ public static void shakeX(View v, float offset, long duration, float times) { ObjectAnimator animator = ObjectAnimator.ofFloat(v, View.TRANSLATION_X, 0, offset); animator.setDuration(duration); animator.setInterpolator(new CycleInterpolator(times)); animator.start(); }
From source file:Main.java
/** * shake y/*from w ww .j a v a2 s . c om*/ * * @param v * @param offset * @param duration * @param times */ public static void shakeY(View v, float offset, long duration, float times) { ObjectAnimator animator = ObjectAnimator.ofFloat(v, View.TRANSLATION_Y, 0, offset); animator.setDuration(duration); animator.setInterpolator(new CycleInterpolator(times)); animator.start(); }
From source file:Main.java
public static void scaleShow(final View view, final Runnable rWhenEnd) { if (view.getVisibility() == View.VISIBLE) { view.setVisibility(View.VISIBLE); if (rWhenEnd != null) { rWhenEnd.run();//from w w w . j ava 2s. c om } return; } if (view.getWindowToken() == null) { view.addOnAttachStateChangeListener(new View.OnAttachStateChangeListener() { @Override public void onViewAttachedToWindow(View v) { scaleShow(view); } @Override public void onViewDetachedFromWindow(View v) { } }); } ObjectAnimator scaleX = ObjectAnimator.ofFloat(view, "scaleX", 0f, 1f); ObjectAnimator scaleY = ObjectAnimator.ofFloat(view, "scaleY", 0f, 1f); AnimatorSet set = new AnimatorSet(); set.playTogether(scaleX, scaleY); set.setDuration(DURATION_SHORT); set.addListener(new Animator.AnimatorListener() { @Override public void onAnimationStart(Animator animation) { } @Override public void onAnimationEnd(Animator animation) { view.setVisibility(View.VISIBLE); if (rWhenEnd != null) { rWhenEnd.run(); } } @Override public void onAnimationCancel(Animator animation) { view.setVisibility(View.VISIBLE); if (rWhenEnd != null) { rWhenEnd.run(); } } @Override public void onAnimationRepeat(Animator animation) { } }); set.start(); }
From source file:Main.java
@TargetApi(Build.VERSION_CODES.HONEYCOMB) private static void fadeOutHoneyComb(final View view) { view.setAlpha(1.0F);/*from w w w .jav a 2 s . c om*/ ObjectAnimator animator = ObjectAnimator.ofFloat(view, "alpha", 1.0F, 0.0F).setDuration(ANIMATION_DURATION); animator.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(android.animation.Animator animation) { view.setVisibility(View.GONE); view.setAlpha(1.0F); } }); animator.start(); }
From source file:Main.java
/** * scale y/*www .ja va 2 s . c o m*/ * * @param v * @param fromY * @param toY * @param duration * @param animatorListener */ public static void scaleY(View v, float fromY, float toY, int duration, Animator.AnimatorListener animatorListener) { ObjectAnimator animator = ObjectAnimator.ofFloat(v, View.SCALE_Y, fromY, toY); animator.setDuration(duration); if (animatorListener != null) { animator.addListener(animatorListener); } animator.start(); }
From source file:Main.java
/** * scale x//w w w . j ava2 s.c o m * * @param v * @param fromX * @param toX * @param duration * @param animatorListener */ public static void scaleX(View v, float fromX, float toX, int duration, Animator.AnimatorListener animatorListener) { ObjectAnimator animator = ObjectAnimator.ofFloat(v, View.SCALE_X, fromX, toX); animator.setDuration(duration); if (animatorListener != null) { animator.addListener(animatorListener); } animator.start(); }
From source file:Main.java
/** * rotation y//from w w w.jav a2 s .c o m * * @param v * @param fromY * @param toY * @param duration * @param animatorListener */ public static void rotationY(View v, float fromY, float toY, int duration, Animator.AnimatorListener animatorListener) { ObjectAnimator animator = ObjectAnimator.ofFloat(v, View.ROTATION_Y, fromY, toY); animator.setDuration(duration); if (animatorListener != null) { animator.addListener(animatorListener); } animator.start(); }
From source file:Main.java
/** * rotation x/* w w w .j av a2s .c o m*/ * * @param v * @param fromX * @param toX * @param duration * @param animatorListener */ public static void rotationX(View v, float fromX, float toX, int duration, Animator.AnimatorListener animatorListener) { ObjectAnimator animator = ObjectAnimator.ofFloat(v, View.ROTATION_X, fromX, toX); animator.setDuration(duration); if (animatorListener != null) { animator.addListener(animatorListener); } animator.start(); }
From source file:Main.java
/** * translation y/* w w w .ja v a2 s. c om*/ * * @param v * @param fromY * @param toY * @param duration * @param animatorListener */ public static void translationY(View v, float fromY, float toY, int duration, Animator.AnimatorListener animatorListener) { ObjectAnimator animator = ObjectAnimator.ofFloat(v, View.TRANSLATION_Y, fromY, toY); animator.setDuration(duration); if (animatorListener != null) { animator.addListener(animatorListener); } animator.start(); }