List of usage examples for android.view View SCALE_X
Property SCALE_X
To view the source code for android.view View SCALE_X.
Click Source Link
scaleX
functionality handled by the View#setScaleX(float) and View#getScaleX() methods. 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;//www . ja v a2 s. c o m }
From source file:Main.java
public static ObjectAnimator tada(View view, float shakeFactor) { PropertyValuesHolder pvhScaleX = PropertyValuesHolder.ofKeyframe(View.SCALE_X, Keyframe.ofFloat(0f, 1f), Keyframe.ofFloat(.1f, .9f), Keyframe.ofFloat(.2f, .9f), Keyframe.ofFloat(.3f, 1.1f), Keyframe.ofFloat(.4f, 1.1f), Keyframe.ofFloat(.5f, 1.1f), Keyframe.ofFloat(.6f, 1.1f), Keyframe.ofFloat(.7f, 1.1f), Keyframe.ofFloat(.8f, 1.1f), Keyframe.ofFloat(.9f, 1.1f), Keyframe.ofFloat(1f, 1f));/*from w w w. j a v a 2s. com*/ PropertyValuesHolder pvhScaleY = PropertyValuesHolder.ofKeyframe(View.SCALE_Y, Keyframe.ofFloat(0f, 1f), Keyframe.ofFloat(.1f, .9f), Keyframe.ofFloat(.2f, .9f), Keyframe.ofFloat(.3f, 1.1f), Keyframe.ofFloat(.4f, 1.1f), Keyframe.ofFloat(.5f, 1.1f), Keyframe.ofFloat(.6f, 1.1f), Keyframe.ofFloat(.7f, 1.1f), Keyframe.ofFloat(.8f, 1.1f), Keyframe.ofFloat(.9f, 1.1f), Keyframe.ofFloat(1f, 1f)); PropertyValuesHolder pvhRotate = PropertyValuesHolder.ofKeyframe(View.ROTATION, Keyframe.ofFloat(0f, 0f), Keyframe.ofFloat(.1f, -3f * shakeFactor), Keyframe.ofFloat(.2f, -3f * shakeFactor), Keyframe.ofFloat(.3f, 3f * shakeFactor), Keyframe.ofFloat(.4f, -3f * shakeFactor), Keyframe.ofFloat(.5f, 3f * shakeFactor), Keyframe.ofFloat(.6f, -3f * shakeFactor), Keyframe.ofFloat(.7f, 3f * shakeFactor), Keyframe.ofFloat(.8f, -3f * shakeFactor), Keyframe.ofFloat(.9f, 3f * shakeFactor), Keyframe.ofFloat(1f, 0)); return ObjectAnimator.ofPropertyValuesHolder(view, pvhScaleX, pvhScaleY, pvhRotate).setDuration(1000); }
From source file:Main.java
public static void animateScaleIn(View view, long duration, Animator.AnimatorListener listener) { view.setScaleX(0f);/*from ww w. jav a 2 s.com*/ view.setScaleY(0f); view.setVisibility(View.VISIBLE); AnimatorSet scaleSet = new AnimatorSet(); scaleSet.playTogether(ObjectAnimator.ofFloat(view, View.SCALE_X, 1f), ObjectAnimator.ofFloat(view, View.SCALE_Y, 1f)); scaleSet.setInterpolator(new AccelerateDecelerateInterpolator()); scaleSet.setDuration(duration); if (listener != null) { scaleSet.addListener(listener); } scaleSet.start(); //return scaleSet; }
From source file:Main.java
/** * Shake the view for whole direction//w w w .j a va2 s . co m * * @param view * @param shakeFactor * @return */ public static ObjectAnimator wholeShake(View view, float shakeFactor) { PropertyValuesHolder pvhScaleX = PropertyValuesHolder.ofKeyframe(View.SCALE_X, Keyframe.ofFloat(0f, 1f), Keyframe.ofFloat(.1f, .9f), Keyframe.ofFloat(.2f, .9f), Keyframe.ofFloat(.3f, 1.1f), Keyframe.ofFloat(.4f, 1.1f), Keyframe.ofFloat(.5f, 1.1f), Keyframe.ofFloat(.6f, 1.1f), Keyframe.ofFloat(.7f, 1.1f), Keyframe.ofFloat(.8f, 1.1f), Keyframe.ofFloat(.9f, 1.1f), Keyframe.ofFloat(1f, 1f)); PropertyValuesHolder pvhScaleY = PropertyValuesHolder.ofKeyframe(View.SCALE_Y, Keyframe.ofFloat(0f, 1f), Keyframe.ofFloat(.1f, .9f), Keyframe.ofFloat(.2f, .9f), Keyframe.ofFloat(.3f, 1.1f), Keyframe.ofFloat(.4f, 1.1f), Keyframe.ofFloat(.5f, 1.1f), Keyframe.ofFloat(.6f, 1.1f), Keyframe.ofFloat(.7f, 1.1f), Keyframe.ofFloat(.8f, 1.1f), Keyframe.ofFloat(.9f, 1.1f), Keyframe.ofFloat(1f, 1f)); PropertyValuesHolder pvhRotate = PropertyValuesHolder.ofKeyframe(View.ROTATION, Keyframe.ofFloat(0f, 0f), Keyframe.ofFloat(.1f, -3f * shakeFactor), Keyframe.ofFloat(.2f, -3f * shakeFactor), Keyframe.ofFloat(.3f, 3f * shakeFactor), Keyframe.ofFloat(.4f, -3f * shakeFactor), Keyframe.ofFloat(.5f, 3f * shakeFactor), Keyframe.ofFloat(.6f, -3f * shakeFactor), Keyframe.ofFloat(.7f, 3f * shakeFactor), Keyframe.ofFloat(.8f, -3f * shakeFactor), Keyframe.ofFloat(.9f, 3f * shakeFactor), Keyframe.ofFloat(1f, 0)); return ObjectAnimator.ofPropertyValuesHolder(view, pvhScaleX, pvhScaleY, pvhRotate).setDuration(1000); }
From source file:Main.java
@NonNull private static AnimatorSet createRevealAnimation(View headline, View btnPanel, View recyclerView, View locationTxt) {// w w w .j a va 2 s . c o m AnimatorSet animAll = new AnimatorSet(); Animator anim1_1 = ObjectAnimator.ofFloat(headline, View.ALPHA, 0, 1, 1); Animator anim1_2 = ObjectAnimator.ofFloat(headline, View.TRANSLATION_Y, -headline.getBottom(), 60, 0); Animator anim1_3 = ObjectAnimator.ofFloat(headline, View.SCALE_X, 0.1f, 0.475f, 1); Animator anim1_4 = ObjectAnimator.ofFloat(headline, View.SCALE_Y, 0.1f, 0.475f, 1); setBatchTiming(1000, 0, anim1_1, anim1_2, anim1_3, anim1_4); animAll.play(anim1_1).with(anim1_2).with(anim1_3).with(anim1_4); Animator anim2_1 = ObjectAnimator.ofFloat(btnPanel, View.ALPHA, 0, 1); Animator anim2_2 = ObjectAnimator.ofFloat(btnPanel, View.TRANSLATION_Y, btnPanel.getHeight() / 4, 0); setBatchTiming(800, 0, anim2_1, anim2_2); animAll.play(anim2_1).with(anim2_2).after(anim1_1); Animator anim3_1 = ObjectAnimator.ofFloat(recyclerView, View.ALPHA, 0, 1); Animator anim3_2 = ObjectAnimator.ofFloat(locationTxt, View.ALPHA, 0, 1); setBatchTiming(1800, 0, anim3_1, anim3_2); animAll.play(anim3_1).with(anim3_2).after(anim1_1); return animAll; }
From source file:Main.java
public static ValueAnimator getScaleAnimator(View view, float... values) { return ObjectAnimator.ofPropertyValuesHolder(view, PropertyValuesHolder.ofFloat(View.SCALE_X, values), PropertyValuesHolder.ofFloat(View.SCALE_Y, values)); }
From source file:Main.java
public static synchronized void animateScaleUp(View v, float targetScale) { float currentScaleX = v.getScaleX(); float currentScaleY = v.getScaleY(); PropertyValuesHolder scaleXHolder = PropertyValuesHolder.ofFloat(View.SCALE_X, currentScaleX, targetScale); PropertyValuesHolder scaleYHolder = PropertyValuesHolder.ofFloat(View.SCALE_Y, currentScaleY, targetScale); ValueAnimator scaleAnimator = ObjectAnimator.ofPropertyValuesHolder(v, scaleXHolder, scaleYHolder); scaleAnimator.start();/*from w ww.j av a 2 s . c om*/ }
From source file:Main.java
public static synchronized void animateScaleDown(View v, float targetScale) { float currentScaleX = v.getScaleX(); float currentScaleY = v.getScaleY(); PropertyValuesHolder scaleXHolder = PropertyValuesHolder.ofFloat(View.SCALE_X, currentScaleX, targetScale); PropertyValuesHolder scaleYHolder = PropertyValuesHolder.ofFloat(View.SCALE_Y, currentScaleY, targetScale); ValueAnimator scaleAnimator = ObjectAnimator.ofPropertyValuesHolder(v, scaleXHolder, scaleYHolder); scaleAnimator.start();/*from ww w. ja v a 2 s . c o m*/ }
From source file:Main.java
@NonNull private static AnimatorSet createDisappearAnim(View btnPanel, View recyclerView, View locationTxt, View headline) {//ww w.j a v a 2 s .c o m AnimatorSet animAll = new AnimatorSet(); Animator anim1_1 = ObjectAnimator.ofFloat(headline, View.ALPHA, 1, 0); Animator anim1_2 = ObjectAnimator.ofFloat(btnPanel, View.ALPHA, 1, 0); Animator anim1_3 = ObjectAnimator.ofFloat(btnPanel, View.ALPHA, 1, 0); Animator anim1_4 = ObjectAnimator.ofFloat(recyclerView, View.ALPHA, 1, 0); setBatchTiming(400, 0, anim1_1, anim1_2, anim1_3, anim1_4, anim1_4); animAll.play(anim1_1).with(anim1_2).with(anim1_3).with(anim1_4); Interpolator interpolator2 = new DecelerateInterpolator(); Animator anim2_1 = ObjectAnimator.ofFloat(locationTxt, View.ALPHA, 1, 0); Animator anim2_2 = ObjectAnimator.ofFloat(locationTxt, View.SCALE_X, 1f, 2f); Animator anim2_3 = ObjectAnimator.ofFloat(locationTxt, View.SCALE_Y, 1f, 2f); anim2_1.setInterpolator(interpolator2); anim2_2.setInterpolator(interpolator2); anim2_3.setInterpolator(interpolator2); setBatchTiming(800, 0, anim2_1, anim2_2, anim2_3); animAll.play(anim2_1).with(anim2_2).with(anim2_3).after(anim1_1); return animAll; }
From source file:Main.java
/** * scale x//from w w w . j a v a2 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(); }