Translateanimation panning Animations

Source: Internet
Author: User

1.

//the following effect is to shift the title bar titlebar up the distance of its height, that is, hide//Each two is a set of parameters, relative to the X start, x end, y start, and Y end of the control itselfTranslateanimation translate =Newtranslateanimation (animation.relative_to_self,0, Animation.relative_to_self,0, Animation.relative_to_self,0, Animation.relative_to_self,-1.0f); //set How many times the animation executes, and if it is 1, repeat it all the time.Translate.setrepeatcount (Animation.infinite);                    ; //Set repeat mode, restart to start again, reverse to return as the original trajectoryTranslate.setrepeatmode (Animation.restart); Translate.setduration (1000);//millisecond Unit, 5s//when set to True, the interface stays on the screen when the animation finishes playing. Translate.setfillafter (true); Titlebar.startanimation (translate);

2, about acceleration deceleration execution animation

 //set the access mode of the target based on the user's choice of spinner        Switch(position) { Case0:                  //Accelerated AccessA.setinterpolator (Animationutils.loadinterpolator ( This, Android.                  R.anim.accelerate_interpolator));  Break;  Case1:                  //deceleration intoA.setinterpolator (Animationutils.loadinterpolator ( This, Android.                  R.anim.decelerate_interpolator));  Break;  Case2:                  //accelerated entry. The difference from the first is that when Repeatmode is reverse, the return origin is still acceleratedA.setinterpolator (Animationutils.loadinterpolator ( This, Android.                  R.anim.accelerate_decelerate_interpolator));  Break;  Case3:                  //Go back a little bit and speed it up .A.setinterpolator (Animationutils.loadinterpolator ( This, Android.                  R.anim.anticipate_interpolator));  Break;  Case4:                  //slow down, go back before you finish.A.setinterpolator (Animationutils.loadinterpolator ( This, Android.                  R.anim.overshoot_interpolator));  Break;  Case5:                  //Case 3,4 's binding bodyA.setinterpolator (Animationutils.loadinterpolator ( This, Android.                  R.anim.anticipate_overshoot_interpolator));  Break;  Case6:                  //stop coming back to the vibration a fewA.setinterpolator (Animationutils.loadinterpolator ( This, Android.                  R.anim.bounce_interpolator));  Break; }  

done!

Translateanimation panning Animations

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.