List of usage examples for android.view.animation AnimationSet setDuration
@Override public void setDuration(long durationMillis)
Sets the duration of every child animation.
From source file:Main.java
public static void postAnimation(final View childLayout, int delay, final int duration) { int visibility = childLayout.getVisibility(); if (visibility != View.VISIBLE) { return;//from w ww . j a v a 2 s . c o m } childLayout.setVisibility(View.INVISIBLE); childLayout.postDelayed(new Runnable() { @Override public void run() { childLayout.setVisibility(View.VISIBLE); AnimationSet animationSet = new AnimationSet(true); animationSet.setDuration(duration); animationSet.setInterpolator(new OvershootInterpolator(0.8f)); int pivotXType = Animation.RELATIVE_TO_SELF; animationSet.addAnimation( new TranslateAnimation(pivotXType, -1, pivotXType, 0, pivotXType, 0, pivotXType, 0)); animationSet.addAnimation(new AlphaAnimation(0, 1)); childLayout.startAnimation(animationSet); } }, delay); }
From source file:Main.java
public static void postAnimationBottom(final View childLayout, int delay, final int duration) { int visibility = childLayout.getVisibility(); if (visibility != View.VISIBLE) { return;/*w ww . j a va 2 s .com*/ } childLayout.setVisibility(View.INVISIBLE); childLayout.postDelayed(new Runnable() { @Override public void run() { childLayout.setVisibility(View.VISIBLE); AnimationSet animationSet = new AnimationSet(true); animationSet.setDuration(duration); animationSet.setInterpolator(new AccelerateDecelerateInterpolator()); int pivotXType = Animation.RELATIVE_TO_SELF; animationSet.addAnimation( new TranslateAnimation(pivotXType, 0, pivotXType, 0, pivotXType, 1, pivotXType, 0)); animationSet.addAnimation(new AlphaAnimation(0, 1)); childLayout.startAnimation(animationSet); } }, delay); }
From source file:Main.java
public static Animation clickAnimation(float scaleXY, long durationMillis) { AnimationSet set = new AnimationSet(true); set.addAnimation(getScaleAnimation(scaleXY, durationMillis)); set.setDuration(durationMillis); return set;/* ww w .j a v a 2s. c om*/ }
From source file:Main.java
public static AnimationSet setExitAnimation(int AnimationType, float fromX, float toX, float fromY, float toY, float scaleX, float scaleToX, float scaleY, float scaleToY, float pinX, float pinY) { AnimationSet animationSet = new AnimationSet(true); TranslateAnimation translateAnimation = new TranslateAnimation(AnimationType, fromX, AnimationType, toX, AnimationType, fromY, AnimationType, toY); ScaleAnimation scaleAnimation = new ScaleAnimation(scaleX, scaleToX, scaleY, scaleToY, AnimationType, pinX, AnimationType, pinY);//w w w . j a v a 2 s.com animationSet.addAnimation(translateAnimation); animationSet.addAnimation(scaleAnimation); animationSet.setDuration(300); return animationSet; }
From source file:Main.java
public static AnimationSet startInfoAnimation(int AnimationType, float fromX, float toX, float fromY, float toY, float scaleX, float scaleToX, float scaleY, float scaleToY, float pinX, float pinY) { OvershootInterpolator overshootInterpolator = new OvershootInterpolator(2f); AnimationSet animationSet = new AnimationSet(true); TranslateAnimation translateAnimation = new TranslateAnimation(AnimationType, fromX, AnimationType, toX, AnimationType, fromY, AnimationType, toY); ScaleAnimation scaleAnimation = new ScaleAnimation(scaleX, scaleToX, scaleY, scaleToY, AnimationType, pinX, AnimationType, pinY);//w w w . j ava 2 s . c o m animationSet.addAnimation(translateAnimation); animationSet.addAnimation(scaleAnimation); animationSet.setDuration(300); animationSet.setFillAfter(true); animationSet.setInterpolator(overshootInterpolator); return animationSet; }
From source file:com.capricorn.ArcMenu.java
private static Animation createItemDisapperAnimation(final long duration, final boolean isClicked) { AnimationSet animationSet = new AnimationSet(true); animationSet.addAnimation(new ScaleAnimation(1.0f, isClicked ? 2.0f : 0.0f, 1.0f, isClicked ? 2.0f : 0.0f, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f)); animationSet.addAnimation(new AlphaAnimation(1.0f, 0.0f)); animationSet.setDuration(duration); animationSet.setInterpolator(new DecelerateInterpolator()); animationSet.setFillAfter(true);// w w w. j a v a 2s.c o m return animationSet; }
From source file:Main.java
public static Animation shakeAnimation(int X) { AnimationSet set = new AnimationSet(true); Animation anim1 = getTranslateAnimation(0, -200, 0, 0, 100); anim1.setStartOffset(100);//from w w w . j a v a 2 s. c o m set.addAnimation(anim1); Animation anim2 = getTranslateAnimation(-200, 400, 0, 0, 200); anim2.setStartOffset(300); set.addAnimation(anim2); Animation anim3 = getTranslateAnimation(400, -200, 0, 0, 200); anim3.setStartOffset(500); set.addAnimation(anim3); Animation anim4 = getTranslateAnimation(-200, 0, 0, 0, 100); anim4.setStartOffset(600); set.addAnimation(anim4); set.setFillAfter(true); set.setDuration(640); return set; }
From source file:com.example.testtab.fragment.GalleryPageFragment.java
public void onItemSelected(AdapterView<?> parent, View v, int position, long id) { this.mImageView.setImageResource(this.mThumbIds[position]); if (this.mThumbIds[position] != null) { AnimationSet set = new AnimationSet(true); AlphaAnimation alpha = new AlphaAnimation(0.0f, 1.0f); set.addAnimation(alpha);/*from ww w . j av a 2 s .c o m*/ set.setDuration(500); set.setFillAfter(true); this.mImageView.startAnimation(set); } }
From source file:it.imwatch.nfclottery.dialogs.InsertContactDialog.java
/** * Shows the name error textfield with the appropriate * error message./*from ww w . j av a2s . c om*/ */ private void showNameError() { mNameErrorState = 1; // Disable the positive button of the dialog setFormIsValidated(false); if (mNameErrorTextView.getVisibility() == View.VISIBLE) { return; // No need to animate in the textview, it's already visible } mNameErrorTextView.setVisibility(View.VISIBLE); AnimationSet fadeInSet = new AnimationSet(true); fadeInSet.addAnimation(new AlphaAnimation(0f, 1f)); fadeInSet.addAnimation(new TranslateAnimation(0f, 0f, -mErrorAnimTranslateY, 0f)); fadeInSet.setDuration(300); mNameErrorTextView.startAnimation(fadeInSet); }
From source file:it.imwatch.nfclottery.dialogs.InsertContactDialog.java
/** * Shows the email error textfield with the appropriate * error message./*from w w w .ja va 2 s. c o m*/ * * @param message The error message to show */ private void showEmailError(CharSequence message, int errState) { mEmailErrorTextView.setText(message); mEmailErrorState = errState; // Disable the positive button of the dialog setFormIsValidated(false); if (mEmailErrorTextView.getVisibility() == View.VISIBLE) { return; // No need to animate in the textview, it's already visible } mEmailErrorTextView.setVisibility(View.VISIBLE); AnimationSet fadeInSet = new AnimationSet(true); fadeInSet.addAnimation(new AlphaAnimation(0f, 1f)); fadeInSet.addAnimation(new TranslateAnimation(0f, 0f, -mErrorAnimTranslateY, 0f)); fadeInSet.setDuration(300); mEmailErrorTextView.startAnimation(fadeInSet); }