public TranslateAnimation (float fromXDelta, float toXDelta, float fromYDelta, float toYDelta) new TranslateAnimation(-90, 150, 0, 0);
Animation anim = new TranslateAnimation(0, 0, 0, 100); // or like this Animation anim = AnimationUtils.loadAnimation(this, R.anim.animation_name); anim.setFillAfter(true); anim.setDuration(1000);
public BottomBaseDialog(Context context, View animateView) { super(context); mAnimateView = animateView; mInnerShowAnim = new TranslateAnimation(Animation.RELATIVE_TO_SELF, 0, Animation.RELATIVE_TO_SELF, 0, Animation.RELATIVE_TO_SELF, 1f, Animation.RELATIVE_TO_SELF, 0); mInnerDismissAnim = new TranslateAnimation(Animation.RELATIVE_TO_SELF, 0, Animation.RELATIVE_TO_SELF, 0, Animation.RELATIVE_TO_SELF, 0, Animation.RELATIVE_TO_SELF, 1); }
public void onAnimationEnd(Animation animation) { animation = new TranslateAnimation(0.0f, 0.0f, 0.0f, 0.0f); animation.setDuration(1); mPlayer0Panel.startAnimation(animation); }
private Animation inFromRightAnimation() { Animation inFromRight = new TranslateAnimation( Animation.RELATIVE_TO_PARENT, +1.0f, Animation.RELATIVE_TO_PARENT, 0.0f, Animation.RELATIVE_TO_PARENT, 0.0f, Animation.RELATIVE_TO_PARENT, 0.0f); inFromRight.setDuration(500); inFromRight.setInterpolator(new LinearInterpolator()); return inFromRight; }
private Animation outToLeftAnimation() { Animation outToLeft = new TranslateAnimation( Animation.RELATIVE_TO_PARENT, 0.0f, Animation.RELATIVE_TO_PARENT, -1.0f, Animation.RELATIVE_TO_PARENT, 0.0f, Animation.RELATIVE_TO_PARENT, 0.0f); outToLeft.setDuration(500); outToLeft.setInterpolator(new LinearInterpolator()); return outToLeft; } }
@Override public void run() { Animation mHiddenAction = new TranslateAnimation(Animation.RELATIVE_TO_SELF, 0.0f, Animation.RELATIVE_TO_SELF, 0.0f, Animation.RELATIVE_TO_SELF, 0.0f, Animation.RELATIVE_TO_SELF, -1.0f); mHiddenAction.setDuration(500); tipView.startAnimation(mHiddenAction); tipView.setVisibility(View.GONE); } }, 2200);
public void showTipView(String tip) { tipView.setText(tip); Animation mShowAction = new TranslateAnimation(Animation.RELATIVE_TO_SELF, 0.0f, Animation.RELATIVE_TO_SELF, 0.0f, Animation.RELATIVE_TO_SELF, -1.0f, Animation.RELATIVE_TO_SELF, 0.0f); mShowAction.setDuration(500); tipView.startAnimation(mShowAction); tipView.setVisibility(View.VISIBLE); }
@Override public void run() { Animation mHiddenAction = new TranslateAnimation(Animation.RELATIVE_TO_SELF, 0.0f, Animation.RELATIVE_TO_SELF, 0.0f, Animation.RELATIVE_TO_SELF, 0.0f, Animation.RELATIVE_TO_SELF, -1.0f); mHiddenAction.setDuration(500); tipView.startAnimation(mHiddenAction); tipView.setVisibility(View.GONE); } }, delayMillis);
Animation animation = new TranslateAnimation(0, 500,0, 0); animation.setDuration(1000); animation.setFillAfter(true); myImage.startAnimation(animation); myImage.setVisibility(0);
private void hideTagGroup() { Animation mHiddenAction = new TranslateAnimation(Animation.RELATIVE_TO_SELF, 0.0f, Animation.RELATIVE_TO_SELF, 0.0f, Animation.RELATIVE_TO_SELF, 0.0f, Animation.RELATIVE_TO_SELF, -1.0f); mHiddenAction.setDuration(400); rsvTags.startAnimation(mHiddenAction); rsvTags.setVisibility(View.GONE); }
private void showMenu() { mRlMenu.setVisibility(View.VISIBLE); TranslateAnimation ta = new TranslateAnimation(Animation.RELATIVE_TO_SELF, 0, Animation.RELATIVE_TO_SELF, 0, Animation.RELATIVE_TO_SELF, 1, Animation.RELATIVE_TO_SELF, 0); ta.setDuration(200); mSvMenu.startAnimation(ta); }
TranslateAnimation animation = new TranslateAnimation(-90, 150, 0, 0); animation.setFillAfter(true); animation.setDuration(1800); someView.startAnimation(animation);
private void showTagGroup() { if (mTagList.isEmpty()) { ToastUtils.showToast(getString(R.string.network_error_tips)); return; } Animation mShowAction = new TranslateAnimation(Animation.RELATIVE_TO_SELF, 0.0f, Animation.RELATIVE_TO_SELF, 0.0f, Animation.RELATIVE_TO_SELF, -1.0f, Animation.RELATIVE_TO_SELF, 0.0f); mShowAction.setDuration(400); rsvTags.startAnimation(mShowAction); rsvTags.setVisibility(View.VISIBLE); }
as = new AnimationSet(true); as.setFillEnabled(true); as.setInterpolator(new BounceInterpolator()); TranslateAnimation ta = new TranslateAnimation(-300, 100, 0, 0); ta.setDuration(2000); as.addAnimation(ta); TranslateAnimation ta2 = new TranslateAnimation(100, 0, 0, 0); ta2.setDuration(2000); ta2.setStartOffset(2000); // allowing 2000 milliseconds for ta to finish as.addAnimation(ta2);
TranslateAnimation animation = new TranslateAnimation(0, 50, 0, 100); animation.setDuration(1000); animation.setFillAfter(false); animation.setAnimationListener(new MyAnimationListener()); imageView.startAnimation(animation);
@Implementation protected static LayoutAnimationController loadLayoutAnimation(Context context, int id) { Animation anim = new TranslateAnimation(0, 0, 30, 0); LayoutAnimationController layoutAnim = new LayoutAnimationController(anim); ShadowLayoutAnimationController shadowLayoutAnimationController = Shadow.extract(layoutAnim); shadowLayoutAnimationController.setLoadedFromResourceId(id); return layoutAnim; } }
private void init() { widthScale(0.95f); /** LayoutAnimation */ TranslateAnimation animation = new TranslateAnimation(Animation.RELATIVE_TO_SELF, 0f, Animation.RELATIVE_TO_SELF, 0f, Animation.RELATIVE_TO_SELF, 6f, Animation.RELATIVE_TO_SELF, 0); animation.setInterpolator(new DecelerateInterpolator()); animation.setDuration(350); animation.setStartOffset(150); mLac = new LayoutAnimationController(animation, 0.12f); mLac.setInterpolator(new DecelerateInterpolator()); }
private Animation createBgImageInAnimation(int fromX, int toX, int transitionDuration, int alphaDuration) { TranslateAnimation translate = new TranslateAnimation(fromX, toX, 0, 0); translate.setDuration(transitionDuration); AlphaAnimation alpha = new AlphaAnimation(0F, 1F); alpha.setDuration(alphaDuration); AnimationSet set = new AnimationSet(true); set.setInterpolator(new DecelerateInterpolator()); set.addAnimation(translate); set.addAnimation(alpha); return set; }
@Test @Ignore("Needs additional work") public void start_shouldRunAnimation() { final AnimationSet set = new AnimationSet(true); final Animation move = new TranslateAnimation(0, 100, 0, 100); move.setDuration(1000); move.setAnimationListener(moveListener); final Animation spin = new RotateAnimation(0, 360); spin.setDuration(1000); spin.setStartOffset(1000); spin.setAnimationListener(spinListener); set.start(); verify(moveListener).onAnimationStart(move); Robolectric.flushForegroundThreadScheduler(); verify(moveListener).onAnimationEnd(move); } }