Java Code Examples for android.view.animation.TranslateAnimation#RELATIVE_TO_PARENT
The following examples show how to use
android.view.animation.TranslateAnimation#RELATIVE_TO_PARENT .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MainActivity.java From Study_Android_Demo with Apache License 2.0 | 6 votes |
public void translateAnim_java(View view) { // 2.����TranslateAnimation TranslateAnimation animation = new TranslateAnimation( TranslateAnimation.RELATIVE_TO_PARENT, 0, TranslateAnimation.RELATIVE_TO_PARENT, 0, TranslateAnimation.RELATIVE_TO_PARENT, 0, TranslateAnimation.RELATIVE_TO_PARENT, -1f); animation.setDuration(5000); // ͣ����� animation.setFillAfter(true); // ���ò�ֵ�� animation.setInterpolator(new LinearInterpolator()); // 3.���Ŷ��� iv_rocket.startAnimation(animation); }
Example 2
Source File: HomeScreenActivity.java From Gazetti_Newspaper_Reader with MIT License | 6 votes |
private AnimationSet getEntryAnimation(int inAnimationDuration) { //In AnimationSet mInAnimationSet = new AnimationSet(false); TranslateAnimation mSlideInAnimation = new TranslateAnimation( TranslateAnimation.RELATIVE_TO_PARENT, 0.0f, TranslateAnimation.RELATIVE_TO_PARENT, 0.0f, TranslateAnimation.RELATIVE_TO_SELF, -1.0f, TranslateAnimation.RELATIVE_TO_SELF, 0.0f); mSlideInAnimation.setFillAfter(true); AlphaAnimation mFadeInAnimation = new AlphaAnimation(0.0f, 1.0f); mFadeInAnimation.setFillAfter(true); mInAnimationSet.addAnimation(mSlideInAnimation); mInAnimationSet.addAnimation(mFadeInAnimation); mInAnimationSet.setDuration(inAnimationDuration); return mInAnimationSet; }
Example 3
Source File: MiniGame.java From SchoolQuest with GNU General Public License v3.0 | 5 votes |
void setUpTextBoxArrowAnimation(ImageView textboxArrow) { TranslateAnimation textBoxArrowAnimation = new TranslateAnimation( TranslateAnimation.ABSOLUTE, 0f, TranslateAnimation.ABSOLUTE, 0f, TranslateAnimation.RELATIVE_TO_PARENT, 0f, TranslateAnimation.RELATIVE_TO_PARENT, 0.01f); textBoxArrowAnimation.setDuration(500); textBoxArrowAnimation.setRepeatCount(-1); textBoxArrowAnimation.setRepeatMode(Animation.RESTART); textBoxArrowAnimation.setInterpolator(new LinearInterpolator()); textBoxArrowAnimation.setFillAfter(true); textboxArrow.setAnimation(textBoxArrowAnimation); }
Example 4
Source File: GameActivity.java From SchoolQuest with GNU General Public License v3.0 | 5 votes |
private void setUpTextBoxArrowAnimation() { ImageView textBoxArrow = findViewById(R.id.textbox_box_arrow); TranslateAnimation textBoxArrowAnimation = new TranslateAnimation(TranslateAnimation.ABSOLUTE, 0f, TranslateAnimation.ABSOLUTE, 0f, TranslateAnimation.RELATIVE_TO_PARENT, 0f, TranslateAnimation.RELATIVE_TO_PARENT, 0.01f); textBoxArrowAnimation.setDuration(500); textBoxArrowAnimation.setRepeatCount(-1); textBoxArrowAnimation.setRepeatMode(Animation.RESTART); textBoxArrowAnimation.setInterpolator(new LinearInterpolator()); textBoxArrowAnimation.setFillAfter(true); textBoxArrow.setAnimation(textBoxArrowAnimation); }
Example 5
Source File: MainActivity.java From Study_Android_Demo with Apache License 2.0 | 5 votes |
public void setAnim_java(View view) { // 2.����һ��AnimationSet AnimationSet set = new AnimationSet(true); // 3.������������:ƽ�ơ���ת�����š��� // 2.����TranslateAnimation TranslateAnimation trans = new TranslateAnimation( TranslateAnimation.RELATIVE_TO_PARENT, 0, TranslateAnimation.RELATIVE_TO_PARENT, 0, TranslateAnimation.RELATIVE_TO_PARENT, 0, TranslateAnimation.RELATIVE_TO_PARENT, -1f); // 2.����ScaleAnimation ScaleAnimation scale = new ScaleAnimation(1f, 0.6f, 1f, 0.6f, ScaleAnimation.RELATIVE_TO_SELF, 0.5f, ScaleAnimation.RELATIVE_TO_SELF, 0.5f); // 4.ͨ��set.addAnimtion() set.addAnimation(trans); set.addAnimation(scale); // ��ֵ�� set.setInterpolator(new AccelerateInterpolator()); // ����ʱ�� set.setDuration(2000); // ����ֹͣ����� set.setFillAfter(true); // 5.���Ŷ��� iv_rocket.startAnimation(set); }