android.view.animation.TranslateAnimation#setInterpolator()源码实例Demo

下面列出了android.view.animation.TranslateAnimation#setInterpolator() 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: bither-android   文件: PinCodeEnterView.java
public void animateToNext() {
    et.setEnabled(false);
    int totalWidth = getWidth();
    int dvWidth = dv.getWidth();
    int animDistance = (totalWidth - dvWidth) / 2 + dvWidth;
    TranslateAnimation animOut = new TranslateAnimation(0, -animDistance, 0, 0);
    animOut.setInterpolator(new AccelerateDecelerateInterpolator());
    animOut.setFillAfter(true);
    animOut.setDuration(AnimDuration);
    TranslateAnimation animIn = new TranslateAnimation(animDistance, 0, 0, 0);
    animIn.setInterpolator(new AccelerateDecelerateInterpolator());
    animIn.setFillBefore(true);
    animIn.setDuration(AnimDuration);
    animIn.setAnimationListener(animateToNextListener);
    dvNew.setVisibility(View.VISIBLE);
    dv.startAnimation(animOut);
    dvNew.startAnimation(animIn);
}
 
源代码2 项目: appcan-android   文件: EBrowserWidget.java
public boolean exitMySpace(View view) {
    if (view.getParent() == this) {
        mBroWindow.setVisibility(VISIBLE);
        TranslateAnimation anim = new TranslateAnimation(
                Animation.RELATIVE_TO_PARENT, 0.0f,
                Animation.RELATIVE_TO_PARENT, 0.0f,
                Animation.RELATIVE_TO_PARENT, 0.0f,
                Animation.RELATIVE_TO_PARENT, 1.0f);
        anim.setDuration(300);
        DecelerateInterpolator di = new DecelerateInterpolator();
        anim.setInterpolator(di);
        view.startAnimation(anim);
        removeView(view);
        return true;
    }
    return false;
}
 
源代码3 项目: Paginize   文件: SlidePageAnimator.java
private void initAnimations() {
  DecelerateInterpolator interpolator = new DecelerateInterpolator(3.0f);
  mPushInFromRightAnimation = new TranslateAnimation(Animation.RELATIVE_TO_SELF, 1, Animation.RELATIVE_TO_SELF, 0
      , Animation.RELATIVE_TO_SELF, 0, Animation.RELATIVE_TO_SELF, 0);
  mPushInFromRightAnimation.setInterpolator(interpolator);
  mPushInFromRightAnimation.setDuration(ANIMATION_DURATION);
  mPullOutFromLeftAnimation = new TranslateAnimation(Animation.RELATIVE_TO_SELF, 0, Animation.RELATIVE_TO_SELF, 1
      , Animation.RELATIVE_TO_SELF, 0, Animation.RELATIVE_TO_SELF, 0);
  mPullOutFromLeftAnimation.setInterpolator(interpolator);
  mPullOutFromLeftAnimation.setDuration(ANIMATION_DURATION);
  mPushInFromLeftAnimation = new TranslateAnimation(Animation.RELATIVE_TO_SELF, -1, Animation.RELATIVE_TO_SELF, 0
      , Animation.RELATIVE_TO_SELF, 0, Animation.RELATIVE_TO_SELF, 0);
  mPushInFromLeftAnimation.setInterpolator(interpolator);
  mPushInFromLeftAnimation.setDuration(ANIMATION_DURATION);
  mPullOutFromRightAnimation = new TranslateAnimation(Animation.RELATIVE_TO_SELF, 0, Animation.RELATIVE_TO_SELF, -1
      , Animation.RELATIVE_TO_SELF, 0, Animation.RELATIVE_TO_SELF, 0);
  mPullOutFromRightAnimation.setInterpolator(interpolator);
  mPullOutFromRightAnimation.setDuration(ANIMATION_DURATION);
}
 
源代码4 项目: FamilyChat   文件: AnimationController.java
public void slideFadeOutToTop(View view, long durationMillis, long delayMillis)
{
	TranslateAnimation animation1 = new TranslateAnimation(rela1, 0, rela1, 0, rela1, 0, rela1, -1);
	AlphaAnimation animation2 = new AlphaAnimation(1, 0);
	AnimationSet animation = new AnimationSet(false);
	animation.addAnimation(animation1);
	animation.addAnimation(animation2);
	animation1.setInterpolator(new LinearInterpolator());
	baseOut(view, animation, durationMillis, delayMillis);
}
 
源代码5 项目: SchoolQuest   文件: GameActivity.java
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);
}
 
源代码6 项目: v9porn   文件: RightViewHideShowAnimation.java
public RightViewHideShowAnimation(View view, boolean toVisible, long duration) {
    super(false);
    this.toVisible = toVisible;
    this.animationView = view;

    //Creates the Alpha animation for the transition
    float startAlpha = toVisible ? 0 : 1;
    float endAlpha = toVisible ? 1 : 0;

    AlphaAnimation alphaAnimation = new AlphaAnimation(startAlpha, endAlpha);
    alphaAnimation.setDuration(duration);


    //Creates the Translate animation for the transition
    int startX = toVisible ? getHideShowDelta(view) : 0;
    int endX = toVisible ? 0 : getHideShowDelta(view);
    TranslateAnimation translateAnimation = new TranslateAnimation(startX, endX, 0, 0);
    translateAnimation.setInterpolator(toVisible ? new LinearOutSlowInInterpolator() : new FastOutLinearInInterpolator());
    translateAnimation.setDuration(duration);


    //Adds the animations to the set
    addAnimation(alphaAnimation);
    addAnimation(translateAnimation);

    setAnimationListener(new Listener());
}
 
源代码7 项目: PracticeCode   文件: LogInActivity.java
private void initAnimation() {
    Animation logInAnimation = new TranslateAnimation(0, 0, 0, 400);
    logInAnimation.setFillAfter(true);
    logInAnimation.setDuration(1300);
    logInAnimation.setInterpolator(this,
            android.R.anim.accelerate_decelerate_interpolator);

    FadeOutAnimation = new AlphaAnimation(1.0f, 0.0f);
    FadeOutAnimation.setDuration(600);
    FadeOutAnimation.setFillAfter(true);

    FadeInAnimation = new AlphaAnimation(0.0f, 1.0f);
    FadeInAnimation.setDuration(600);
    FadeInAnimation.setFillAfter(true);

    Animation flashFadeInnOut = new AlphaAnimation(0.0f, 1.0f);
    flashFadeInnOut.setDuration(1000);
    flashFadeInnOut.setFillAfter(true);
    flashFadeInnOut.setInterpolator(this,
            android.R.anim.accelerate_decelerate_interpolator);
    flashFadeInnOut.setRepeatMode(Animation.REVERSE);
    flashFadeInnOut.setRepeatCount(Animation.INFINITE);

    FlashFadeInnOutSet = new AnimationSet(true);
    FlashFadeInnOutSet.addAnimation(flashFadeInnOut);
    FlashFadeInnOutSet.addAnimation(logInAnimation);

    logInAnimationReverse = new TranslateAnimation(0, 0, icon.getY(), 0);
    logInAnimationReverse.setDuration(2000);
    logInAnimationReverse.setInterpolator(this, android.R.anim.decelerate_interpolator);
    logInAnimationReverse.setFillAfter(true);
}
 
源代码8 项目: Android-Application-ZJB   文件: ViewUtils.java
public static void showViewFromBottom(View view) {
    if (view.getVisibility() == View.VISIBLE) {
        return;
    }
    view.setVisibility(View.VISIBLE);
    int height = view.getHeight();
    TranslateAnimation translateAnimation = new TranslateAnimation(Animation.ABSOLUTE, 0, Animation.ABSOLUTE, 0, Animation.ABSOLUTE, height, Animation.ABSOLUTE, 0);
    translateAnimation.setDuration(ANIMATION_DURATION);
    translateAnimation.setInterpolator(sAnimationInterpolator);
    view.startAnimation(translateAnimation);
}
 
源代码9 项目: v9porn   文件: RightViewHideShowAnimation.java
public RightViewHideShowAnimation(View view, boolean toVisible, long duration) {
    super(false);
    this.toVisible = toVisible;
    this.animationView = view;

    //Creates the Alpha animation for the transition
    float startAlpha = toVisible ? 0 : 1;
    float endAlpha = toVisible ? 1 : 0;

    AlphaAnimation alphaAnimation = new AlphaAnimation(startAlpha, endAlpha);
    alphaAnimation.setDuration(duration);


    //Creates the Translate animation for the transition
    int startX = toVisible ? getHideShowDelta(view) : 0;
    int endX = toVisible ? 0 : getHideShowDelta(view);
    TranslateAnimation translateAnimation = new TranslateAnimation(startX, endX, 0, 0);
    translateAnimation.setInterpolator(toVisible ? new LinearOutSlowInInterpolator() : new FastOutLinearInInterpolator());
    translateAnimation.setDuration(duration);


    //Adds the animations to the set
    addAnimation(alphaAnimation);
    addAnimation(translateAnimation);

    setAnimationListener(new Listener());
}
 
源代码10 项目: Paginize   文件: SlideInMenuPage.java
@Override
public boolean onPopPageAnimation(View oldPageView, View newPageView, AnimationDirection animationDirection) {
  TranslateAnimation anim = new TranslateAnimation(
      Animation.ABSOLUTE, 0,
      Animation.ABSOLUTE, 0,
      Animation.RELATIVE_TO_PARENT, 0,
      Animation.RELATIVE_TO_PARENT, 1);
  anim.setDuration(getAnimationDuration());
  anim.setInterpolator(new DecelerateInterpolator(1.5f));
  mMenuItemContainer.startAnimation(anim);

  mViewSemiTransparentBackground.animate().alpha(0).setDuration(getAnimationDuration()).start();
  return true;
}
 
源代码11 项目: ExoMedia   文件: BottomViewHideShowAnimation.java
public BottomViewHideShowAnimation(View view, boolean toVisible, long duration) {
    super(false);
    this.toVisible = toVisible;
    this.animationView = view;

    //Creates the Alpha animation for the transition
    float startAlpha = toVisible ? 0 : 1;
    float endAlpha = toVisible ? 1 : 0;

    AlphaAnimation alphaAnimation = new AlphaAnimation(startAlpha, endAlpha);
    alphaAnimation.setDuration(duration);


    //Creates the Translate animation for the transition
    int startY = toVisible ? getHideShowDelta(view) : 0;
    int endY = toVisible ? 0 : getHideShowDelta(view);
    TranslateAnimation translateAnimation = new TranslateAnimation(0, 0, startY, endY);
    translateAnimation.setInterpolator(toVisible ? new LinearOutSlowInInterpolator() : new FastOutLinearInInterpolator());
    translateAnimation.setDuration(duration);


    //Adds the animations to the set
    addAnimation(alphaAnimation);
    addAnimation(translateAnimation);

    setAnimationListener(new Listener());
}
 
源代码12 项目: UltimateAndroid   文件: SpanVariableGridView.java
protected final void translateChild(View v, Point prev, Point now) {

        TranslateAnimation translate = new TranslateAnimation(Animation.ABSOLUTE, -now.x + prev.x, Animation.ABSOLUTE, 0, Animation.ABSOLUTE, -now.y
                + prev.y, Animation.ABSOLUTE, 0);
        translate.setInterpolator(new AccelerateInterpolator(4f));
        translate.setDuration(350);
        translate.setFillEnabled(false);
        translate.setFillAfter(false);

        v.clearAnimation();
        v.startAnimation(translate);
    }
 
源代码13 项目: quickhybrid-android   文件: ActionBarSeg.java
private void trans(long dura, float frX, float toX) {
    TranslateAnimation animation = new TranslateAnimation(frX, toX, 0.0F, 0.0F);
    animation.setInterpolator(new LinearInterpolator());
    animation.setDuration(dura);
    animation.setFillAfter(true);
    vTrans.startAnimation(animation);
}
 
源代码14 项目: BarrageView   文件: BarrageView.java
private TranslateAnimation generateTranslateAnim(BarrageItem item, int leftMargin) {
    TranslateAnimation anim = new TranslateAnimation(leftMargin, -item.textMeasuredWidth, 0, 0);
    anim.setDuration(item.moveSpeed);
    anim.setInterpolator(new AccelerateDecelerateInterpolator());
    anim.setFillAfter(true);
    return anim;
}
 
源代码15 项目: UltimateAndroid   文件: SpanVariableGridView.java
protected final void translateChild(View v, Point prev, Point now) {

        TranslateAnimation translate = new TranslateAnimation(Animation.ABSOLUTE, -now.x + prev.x, Animation.ABSOLUTE, 0, Animation.ABSOLUTE, -now.y
                + prev.y, Animation.ABSOLUTE, 0);
        translate.setInterpolator(new AccelerateInterpolator(4f));
        translate.setDuration(350);
        translate.setFillEnabled(false);
        translate.setFillAfter(false);

        v.clearAnimation();
        v.startAnimation(translate);
    }
 
源代码16 项目: MiBandDecompiled   文件: DynamicDetailFragment.java
private void a(ViewGroup viewgroup, ViewGroup viewgroup1)
{
    viewgroup.setVisibility(4);
    viewgroup1.setVisibility(0);
    AnimationSet animationset = new AnimationSet(true);
    AlphaAnimation alphaanimation = new AlphaAnimation(0.0F, 1.0F);
    alphaanimation.setDuration(80L);
    animationset.addAnimation(alphaanimation);
    TranslateAnimation translateanimation = new TranslateAnimation(1, 0.0F, 1, 0.0F, 1, -1F, 1, 0.0F);
    translateanimation.setDuration(100L);
    translateanimation.setInterpolator(new DecelerateInterpolator());
    animationset.addAnimation(translateanimation);
    viewgroup1.setLayoutAnimation(new LayoutAnimationController(animationset, 0.7F));
    viewgroup1.requestLayout();
}
 
源代码17 项目: TvWidget   文件: AnimateFactory.java
public static Animation shakeAnimate() {
    TranslateAnimation mAnimate = new TranslateAnimation(0, 5, 0, 0);
    mAnimate.setInterpolator(new CycleInterpolator(50));
    mAnimate.setDuration(600);
    return mAnimate;
}
 
源代码18 项目: sealtalk-android   文件: MainActivity.java
private void selectNavSelection(int index) {
    clearSelection();
    switch (index) {
        case 0:
            mMainConversationTv.setTextColor(getResources().getColor(R.color.de_title_bg));
            TranslateAnimation animation = new TranslateAnimation(0, 0,
                    0f, 0f);
            animation.setInterpolator(new LinearInterpolator());
            animation.setDuration(100);
            animation.setFillAfter(true);
            mMainSelectImg.startAnimation(animation);

            break;
        case 1:
            mMainGroupTv.setTextColor(getResources().getColor(R.color.de_title_bg));
            TranslateAnimation animation1 = new TranslateAnimation(
                    indicatorWidth, indicatorWidth,
                    0f, 0f);
            animation1.setInterpolator(new LinearInterpolator());
            animation1.setDuration(100);
            animation1.setFillAfter(true);
            mMainSelectImg.startAnimation(animation1);

            break;
        case 2:
            mMainChatroomTv.setTextColor(getResources().getColor(R.color.de_title_bg));
            TranslateAnimation animation2 = new TranslateAnimation(
                    2 * indicatorWidth, indicatorWidth * 2,
                    0f, 0f);
            animation2.setInterpolator(new LinearInterpolator());
            animation2.setDuration(100);
            animation2.setFillAfter(true);
            mMainSelectImg.startAnimation(animation2);

            break;
        case 3:
            mMainCustomerTv.setTextColor(getResources().getColor(R.color.de_title_bg));
            TranslateAnimation animation3 = new TranslateAnimation(
                    3 * indicatorWidth, indicatorWidth * 3,
                    0f, 0f);
            animation3.setInterpolator(new LinearInterpolator());
            animation3.setDuration(100);
            animation3.setFillAfter(true);
            mMainSelectImg.startAnimation(animation3);
            break;
    }
}
 
源代码19 项目: FamilyChat   文件: QrCodeScanActivity.java
protected void initUI()
{
    //全屏设置
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT)
    {
        View statusBar = findViewById(R.id.view_qrcode_actionbar_status);
        statusBar.setVisibility(View.VISIBLE);
        ViewGroup.LayoutParams layoutParams = statusBar.getLayoutParams();
        layoutParams.height = OtherUtils.getStatusBarHeight(this);
        statusBar.setLayoutParams(layoutParams);
    }

    //闪光灯
    mImgLight = (ImageView) findViewById(R.id.img_qrcode_light);

    mScanPreview = (SurfaceView) findViewById(R.id.capture_preview);
    mScanContainer = (RelativeLayout) findViewById(R.id.capture_container);
    mScanCropView = (RelativeLayout) findViewById(R.id.capture_crop_view);
    mScanLine = (ImageView) findViewById(R.id.capture_scan_line);
    //设置阴影
    View shadowTop = findViewById(R.id.capture_mask_top);
    View shadowBottom = findViewById(R.id.capture_mask_bottom);
    View shadowLeft = findViewById(R.id.capture_mask_left);
    View shadowRight = findViewById(R.id.capture_mask_right);
    shadowTop.setAlpha(0.5f);
    shadowBottom.setAlpha(0.5f);
    shadowLeft.setAlpha(0.5f);
    shadowRight.setAlpha(0.5f);

    mInactivityTimer = new InactivityTimer(this);
    mBeepManager = new BeepManager(this);

    TranslateAnimation animation = new TranslateAnimation(Animation.RELATIVE_TO_PARENT, 0.0f, Animation
            .RELATIVE_TO_PARENT, 0.0f, Animation.RELATIVE_TO_PARENT, 0.0f, Animation.RELATIVE_TO_PARENT,
            0.85f);
    animation.setDuration(2500);
    animation.setRepeatCount(-1);
    animation.setInterpolator(new AccelerateDecelerateInterpolator(QrCodeScanActivity.this, null));
    animation.setRepeatMode(Animation.RESTART);
    mScanLine.startAnimation(animation);

    findViewById(R.id.ll_qrcode_actionbar_left_back).setOnClickListener(this);
    mImgLight.setOnClickListener(this);
}
 
源代码20 项目: NewFastFrame   文件: AutoEditText.java
public static TranslateAnimation getShakeAnimation(int count) {
        TranslateAnimation translateAnimation = new TranslateAnimation(0, 10, 0, 0);
        translateAnimation.setInterpolator(new CycleInterpolator(count));
        translateAnimation.setDuration(1000);
        return translateAnimation;
}