Animation rotation = AnimationUtils.loadAnimation(this, R.anim.rotation); rotation.setRepeatCount(Animation.INFINITE); myView.startAnimation(rotation);
Animation rotation = AnimationUtils.loadAnimation(this, R.anim.clockwise_rotation); rotation.setRepeatCount(Animation.INFINITE); myView.startAnimation(rotation);
public void refresh() { /* Attach a rotating ImageView to the refresh item as an ActionView */ LayoutInflater inflater = (LayoutInflater) getActivity().getSystemService(Context.LAYOUT_INFLATER_SERVICE); ImageView iv = (ImageView) inflater.inflate(R.layout.refresh_action_view, null); Animation rotation = AnimationUtils.loadAnimation(getActivity(), R.anim.clockwise_refresh); rotation.setRepeatCount(Animation.INFINITE); iv.startAnimation(rotation); refreshItem.setActionView(iv); //TODO trigger loading }
Animation a = new RotateAnimation(0.0f, 360.0f, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f); a.setRepeatCount(-1); a.setDuration(1000);
private void setupAnimations() { mAnimation = new Animation() { @Override public void applyTransformation(float interpolatedTime, Transformation t) { setRotate(interpolatedTime); } }; mAnimation.setRepeatCount(Animation.INFINITE); mAnimation.setRepeatMode(Animation.RESTART); mAnimation.setInterpolator(LINEAR_INTERPOLATOR); mAnimation.setDuration(ANIMATION_DURATION); }
public void onCreate(Bundle savedInstanceState) { final Animation animation = new AlphaAnimation(1, 0); // Change alpha from fully visible to invisible animation.setDuration(500); // duration - half a second animation.setInterpolator(new LinearInterpolator()); // do not alter animation rate animation.setRepeatCount(Animation.INFINITE); // Repeat animation infinitely animation.setRepeatMode(Animation.REVERSE); // Reverse animation at the end so the button will fade back in final Button btn = (Button) findViewById(R.id.your_btn); btn.startAnimation(animation); btn.setOnClickListener(new OnClickListener() { @Override public void onClick(final View view) { view.clearAnimation(); } }); }
TextView myText = (TextView) findViewById(R.id.myText ); Animation anim = new AlphaAnimation(0.0f, 1.0f); anim.setDuration(50); //You can manage the blinking time with this parameter anim.setStartOffset(20); anim.setRepeatMode(Animation.REVERSE); anim.setRepeatCount(Animation.INFINITE); myText.startAnimation(anim);
TextView myText = (TextView) findViewById(R.id.myText ); Animation anim = new AlphaAnimation(0.0f, 1.0f); anim.setDuration(50); //You can manage the time of the blink with this parameter anim.setStartOffset(20); anim.setRepeatMode(Animation.REVERSE); anim.setRepeatCount(Animation.INFINITE); myText.startAnimation(anim);
// Locate view ImageView diskView = (ImageView) findViewById(R.id.imageView3); // Create an animation instance Animation an = new RotateAnimation(0.0f, 360.0f, pivotX, pivotY); // Set the animation's parameters an.setDuration(10000); // duration in ms an.setRepeatCount(0); // -1 = infinite repeated an.setRepeatMode(Animation.REVERSE); // reverses each repeat an.setFillAfter(true); // keep rotation after animation // Aply animation to image view diskView.setAnimation(an);
animation.setRepeatCount(Animation.INFINITE); animation.setRepeatMode(Animation.RESTART); animation.setInterpolator(LINEAR_INTERPOLATOR);
/** * Starts a Flashing Animation on the AwesomeTextView * * @param forever whether the animation should be infinite or play once * @param speed how fast the item should flash */ public void startFlashing(boolean forever, AnimationSpeed speed) { Animation fadeIn = new AlphaAnimation(0, 1); //set up extra variables fadeIn.setDuration(50); fadeIn.setRepeatMode(Animation.REVERSE); //default repeat count is 0, however if user wants, set it up to be infinite fadeIn.setRepeatCount(0); if (forever) { fadeIn.setRepeatCount(Animation.INFINITE); } fadeIn.setStartOffset(speed.getFlashDuration()); startAnimation(fadeIn); }
animation.setRepeatCount(Animation.INFINITE); animation.setRepeatMode(Animation.RESTART); animation.setInterpolator(LINEAR_INTERPOLATOR);
animation.setRepeatCount(Animation.INFINITE); animation.setRepeatMode(Animation.RESTART); animation.setInterpolator(LINEAR_INTERPOLATOR);
/** * Starts a rotating animation on the AwesomeTextView * * @param clockwise true for clockwise, false for anti clockwise spinning * @param speed how fast the item should rotate */ public void startRotate(boolean clockwise, AnimationSpeed speed) { Animation rotate; //set up the rotation animation if (clockwise) { rotate = new RotateAnimation(0, 360, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f); } else { rotate = new RotateAnimation(360, 0, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f); } //set up some extra variables rotate.setRepeatCount(Animation.INFINITE); rotate.setInterpolator(new LinearInterpolator()); rotate.setStartOffset(0); rotate.setRepeatMode(Animation.RESTART); rotate.setDuration(speed.getRotateDuration()); startAnimation(rotate); }
mAnimation.setRepeatCount(Animation.INFINITE); mAnimation.setRepeatMode(Animation.REVERSE); mAnimation.setInterpolator(ACCELERATE_DECELERATE_INTERPOLATOR);
mAnimation.setRepeatCount(Animation.INFINITE); mAnimation.setRepeatMode(Animation.RESTART); mAnimation.setInterpolator(LINEAR_INTERPOLATOR);
animation.setFillAfter(true); animation.setDuration(2000); animation.setRepeatCount(ValueAnimator.INFINITE); animation.setRepeatMode(ValueAnimator.INFINITE); animation1.setFillAfter(true); animation1.setDuration(2000); animation1.setRepeatCount(ValueAnimator.INFINITE); animation1.setRepeatMode(ValueAnimator.INFINITE); ivBatMan.setAnimation(animation);
//How you start Animation rotation = AnimationUtils.loadAnimation(this, R.anim.rotate); rotation.setRepeatCount(Animation.INFINITE); iv.startAnimation(rotation); //You do your stuff while it spins ... //You tell it not to repeat again rotation.setRepeatCount(0);
/* Get ImageView Object */ ImageView iv = (ImageView) view.findViewById(R.id.refresh_action_view); /* Create Animation */ Animation rotation = AnimationUtils.loadAnimation(context, R.anim.refresh_button_anim); rotation.setRepeatCount(Animation.INFINITE); /* start Animation */ iv.startAnimation(rotation);
Animation mAnimation = new TranslateAnimation(START_POS_X, END_POS_X, START_POS_Y, END_POS_Y); mAnimation.setDuration(TICKER_DURATION); mAnimation.setRepeatMode(Animation.RESTART); mAnimation.setRepeatCount(Animation.INFINITE);