Java 类android.view.animation.AnimationSet 实例源码

项目:Pocket-Plays-for-Twitch    文件:WelcomeActivity.java   
private AnimationSet startHideContinueIconAnimations() {
    Animation mScaleAnimation = new ScaleAnimation(1, 0, 1, 0, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
    Animation mRotateAnimation = new RotateAnimation(
                0, 360,
                Animation.RELATIVE_TO_SELF, 0.5f,
                Animation.RELATIVE_TO_SELF, 0.5f
    );
    mRotateAnimation.setRepeatCount(0);

    AnimationSet mAnimations = new AnimationSet(true);
    mAnimations.setDuration(REVEAL_ANIMATION_DURATION);
    mAnimations.setFillAfter(true);
    mAnimations.setInterpolator(new OvershootInterpolator(1.5f));
    mAnimations.addAnimation(mScaleAnimation);
    mAnimations.addAnimation(mRotateAnimation);

    mContinueIcon.startAnimation(mAnimations);
    return mAnimations;
}
项目:Pocket-Plays-for-Twitch    文件:AnimationService.java   
public static void setAdapterInsertAnimation(final View aCard, int row, int height) {
    final int ANIMATION_DURATION = 650;
    final int BASE_DELAY = 50;

    TranslateAnimation translationAnimation = new TranslateAnimation(0,0, height,0);

    AlphaAnimation alphaAnimation = new AlphaAnimation(0f, 1f);

    final AnimationSet animationSet = new AnimationSet(true);
    animationSet.addAnimation(translationAnimation);
    animationSet.addAnimation(alphaAnimation);
    animationSet.setInterpolator(new AccelerateDecelerateInterpolator());
    animationSet.setFillAfter(true);
    animationSet.setFillBefore(true);
    animationSet.setDuration(ANIMATION_DURATION + row * BASE_DELAY);

    aCard.setAnimation(animationSet);
}
项目:ExpandButton    文件:ExpandButtonLayout.java   
public void open() {

        AnimationSet animationSet = new AnimationSet(true);
        animationSet.setDuration(duration);
        animationSet.setAnimationListener(this);
        animationSet.setFillAfter(true);

        RotateAnimation rotateAnimation = new RotateAnimation(270, 360,
                Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
        animationSet.addAnimation(rotateAnimation);
        Animation scaleAnimation = new ScaleAnimation(1.25f, 1f, 1.25f, 1f,
                ScaleAnimation.RELATIVE_TO_SELF, 0.5f, ScaleAnimation.RELATIVE_TO_SELF, 0.5f);
        animationSet.addAnimation(scaleAnimation);
        imageView.startAnimation(animationSet);


        AnimatorSet animatorSet = new AnimatorSet();
        ObjectAnimator animator1 = ObjectAnimator.ofInt(mLinearLayout, "width", 0, mLinearLayoutWidth);
        ObjectAnimator animator2 = ObjectAnimator.ofInt(mLinearLayout, "paddingLeft", 0, savePaddingLeft);
        ObjectAnimator animator3 = ObjectAnimator.ofInt(mLinearLayout, "paddingRight", 0, savePaddingRight);
        ObjectAnimator animator4 = ObjectAnimator.ofInt(mLinearLayout, "marginLeft", 0, saveMarginLeft);
        ObjectAnimator animator5 = ObjectAnimator.ofInt(mLinearLayout, "marginRight", 0, saveMarginRight);
        animatorSet.playTogether(animator1, animator2, animator3, animator4, animator5);
        animatorSet.setDuration(duration).start();

    }
项目:mapbox-navigation-android    文件:InstructionView.java   
/**
 * Initializes all animations needed to show / hide views.
 */
private void initAnimations() {
  Context context = getContext();
  rerouteSlideDownTop = AnimationUtils.loadAnimation(context, R.anim.slide_down_top);
  rerouteSlideUpTop = AnimationUtils.loadAnimation(context, R.anim.slide_up_top);

  Animation fadeIn = new AlphaAnimation(0, 1);
  fadeIn.setInterpolator(new DecelerateInterpolator());
  fadeIn.setDuration(300);

  Animation fadeOut = new AlphaAnimation(1, 0);
  fadeOut.setInterpolator(new AccelerateInterpolator());
  fadeOut.setStartOffset(1000);
  fadeOut.setDuration(1000);

  fadeInSlowOut = new AnimationSet(false);
  fadeInSlowOut.addAnimation(fadeIn);
  fadeInSlowOut.addAnimation(fadeOut);
}
项目:SunmiUI    文件:StringListAdapter.java   
@Override
public View getView(int position, View convertView, ViewGroup parent) {
    ViewHolder  holderView = null;
    if (convertView == null) {
        holderView = new ViewHolder ();
        convertView = View.inflate(mContext, R.layout.item_string_list, null);
        holderView.t = (TextView) convertView.findViewById(R.id.t);
        convertView.setTag(holderView);
    }else{
        holderView =(ViewHolder) convertView.getTag();
    }
    AnimationSet animationSet = new AnimationSet(true);
    TranslateAnimation mHiddenAction = 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);
    mHiddenAction.setDuration(1000);
    animationSet.addAnimation(mHiddenAction);
    holderView.t.startAnimation(animationSet);


    holderView.t.setText(datas.get(position));
    return convertView;
}
项目:BottomMenu    文件:BottomMenu.java   
private Animation scaleSmallAnim(int duration, final View child) {

        AnimationSet animationSet = new AnimationSet(true);

        ScaleAnimation scaleAnim = new ScaleAnimation(1.0f, 0.0f, 1.0f, 0.0f,
                Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF,
                0.5f);
        AlphaAnimation alphaAnim = new AlphaAnimation(1f, 0.0f);
        alphaAnim.setFillAfter(true);
        animationSet.addAnimation(scaleAnim);
        animationSet.addAnimation(alphaAnim);
        animationSet.setDuration(duration);

        return animationSet;

    }
项目:AnimatedPullToRefresh-master    文件:AnimationHelper.java   
/**
 * Start Loop animation on given list of characters
 */
public long applyLoopAnimation(List<TextView> targetList) {
    long duration = (long) (CHARACTER_ANIM_DURATION * 5f);
    for (final TextView target : targetList) {
        AnimationSet set = new AnimationSet(true);
        if (headerLoopAnim == HeaderLoopAnim.ZOOM) {
            addLoopScaleAnimations(duration, set);
        } else if (headerLoopAnim == HeaderLoopAnim.FADE) {
            addLoopFadeAnimations(duration, set);
        }
        target.startAnimation(set);
    }

    // loop anim iteration
    currentLoopIteration = (currentLoopIteration + 1) % headerLoopAnimIteration;
    return (long) ((duration * 2.1f) + 300);
}
项目:qmui    文件:QMUIBottomSheet.java   
/**
 * BottomSheet升起动画
 */
private void animateUp() {
    if (mContentView == null) {
        return;
    }
    TranslateAnimation translate = new TranslateAnimation(
            Animation.RELATIVE_TO_SELF, 0f, Animation.RELATIVE_TO_SELF, 0f,
            Animation.RELATIVE_TO_SELF, 1f, Animation.RELATIVE_TO_SELF, 0f
    );
    AlphaAnimation alpha = new AlphaAnimation(0, 1);
    AnimationSet set = new AnimationSet(true);
    set.addAnimation(translate);
    set.addAnimation(alpha);
    set.setInterpolator(new DecelerateInterpolator());
    set.setDuration(mAnimationDuration);
    set.setFillAfter(true);
    mContentView.startAnimation(set);
}
项目:AndroidBasicLibs    文件:DrawerToast.java   
/**
 * 获得入场动画
 *
 * @return
 */
protected Animation getStartAnimation() {
    AlphaAnimation animAlpha = new AlphaAnimation(0, 1);
    animAlpha.setDuration(TIME_START_ANIM);
    animAlpha.setFillAfter(true);

    TranslateAnimation animTrans = new TranslateAnimation(Animation.RELATIVE_TO_PARENT, 1.5f,
            Animation.RELATIVE_TO_PARENT, 0f,
            Animation.RELATIVE_TO_PARENT, 0f,
            Animation.RELATIVE_TO_PARENT, 0f);
    animTrans.setDuration(TIME_START_ANIM);
    animTrans.setFillAfter(true);
    animTrans.setInterpolator(new DecelerateInterpolator());

    AnimationSet sets = new AnimationSet(true);
    sets.addAnimation(animAlpha);
    sets.addAnimation(animTrans);

    return sets;
}
项目:AndroidBasicLibs    文件:DrawerToast.java   
/**
 * 获得离场动画
 *
 * @return
 */
protected Animation getEndAnimation() {
    AlphaAnimation animAlpha = new AlphaAnimation(1, 0);
    animAlpha.setDuration(TIME_END_ANIM);
    animAlpha.setFillAfter(true);

    TranslateAnimation animTrans = new TranslateAnimation(Animation.RELATIVE_TO_PARENT, 0f,
            Animation.RELATIVE_TO_PARENT, -1.5f,
            Animation.RELATIVE_TO_PARENT, 0f,
            Animation.RELATIVE_TO_PARENT, 0f);
    animTrans.setDuration(TIME_END_ANIM);
    animTrans.setFillAfter(true);
    animTrans.setInterpolator(new AccelerateInterpolator());

    AnimationSet sets = new AnimationSet(true);
    sets.addAnimation(animAlpha);
    sets.addAnimation(animTrans);

    return sets;
}
项目:HiBangClient    文件:WhatsnewDoor.java   
@Override
  public void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.whats_door);

      mLeft = (ImageView)findViewById(R.id.imageLeft);
      mRight = (ImageView)findViewById(R.id.imageRight);
      mText = (TextView)findViewById(R.id.anim_text);

      AnimationSet anim = new AnimationSet(true);
TranslateAnimation mytranslateanim = new TranslateAnimation(Animation.RELATIVE_TO_SELF,0f,Animation.RELATIVE_TO_SELF,-1f,Animation.RELATIVE_TO_SELF,0f,Animation.RELATIVE_TO_SELF,0f);
mytranslateanim.setDuration(2000);
anim.setStartOffset(800);
anim.addAnimation(mytranslateanim);
anim.setFillAfter(true);
mLeft.startAnimation(anim);

AnimationSet anim1 = new AnimationSet(true);
TranslateAnimation mytranslateanim1 = new TranslateAnimation(Animation.RELATIVE_TO_SELF,0f,Animation.RELATIVE_TO_SELF,+1f,Animation.RELATIVE_TO_SELF,0f,Animation.RELATIVE_TO_SELF,0f);
mytranslateanim1.setDuration(1500);
anim1.addAnimation(mytranslateanim1);
anim1.setStartOffset(800);
anim1.setFillAfter(true);
mRight.startAnimation(anim1);

AnimationSet anim2 = new AnimationSet(true);
ScaleAnimation myscaleanim = new ScaleAnimation(1f,3f,1f,3f,Animation.RELATIVE_TO_SELF,0.5f,Animation.RELATIVE_TO_SELF,0.5f);
myscaleanim.setDuration(1000);
AlphaAnimation myalphaanim = new AlphaAnimation(1,0.0001f);
myalphaanim.setDuration(1500);
anim2.addAnimation(myscaleanim);
anim2.addAnimation(myalphaanim);
anim2.setFillAfter(true);
mText.startAnimation(anim2);
new Thread(this).start();
  }
项目:YMenuView    文件:Circle8YMenu.java   
@Override
public Animation createOptionShowAnimation(OptionButton optionButton, int index) {
    AnimationSet animationSet = new AnimationSet(true);
    TranslateAnimation translateAnimation= new TranslateAnimation(
            getYMenuButton().getX() - optionButton.getX()
            ,0
            ,getYMenuButton().getY() - optionButton.getY()
            ,0);
    translateAnimation.setDuration(getOptionSD_AnimationDuration());
    AlphaAnimation alphaAnimation = new AlphaAnimation(0,1);
    alphaAnimation.setDuration(getOptionSD_AnimationDuration());
    animationSet.addAnimation(alphaAnimation);
    animationSet.addAnimation(translateAnimation);
    //为不同的Option设置延时
    if (index % 2 == 1) {
        animationSet.setStartOffset(getOptionSD_AnimationDuration()/2);
    }
    return animationSet;
}
项目:YMenuView    文件:Circle8YMenu.java   
@Override
public Animation createOptionDisappearAnimation(OptionButton optionButton, int index) {
    AnimationSet animationSet = new AnimationSet(true);
    TranslateAnimation translateAnimation= new TranslateAnimation(
            0
            ,getYMenuButton().getX() - optionButton.getX()
            ,0
            ,getYMenuButton().getY() - optionButton.getY()
    );
    translateAnimation.setDuration(getOptionSD_AnimationDuration());
    AlphaAnimation alphaAnimation = new AlphaAnimation(1,0);
    alphaAnimation.setDuration(getOptionSD_AnimationDuration());
    animationSet.addAnimation(translateAnimation);
    animationSet.addAnimation(alphaAnimation);
    //为不同的Option设置延时
    if (index % 2 == 0) {
        animationSet.setStartOffset(getOptionSD_AnimationDuration()/2);
    }
    return animationSet;
}
项目:YMenuView    文件:TreeYMenu.java   
@Override
public Animation createOptionDisappearAnimation(OptionButton optionButton, int index) {

    AnimationSet animationSet = new AnimationSet(true);
    TranslateAnimation translateAnimation= new TranslateAnimation(
            0
            ,getYMenuButton().getX() - optionButton.getX()
            ,0
            ,getYMenuButton().getY() - optionButton.getY()
    );
    translateAnimation.setDuration(getOptionSD_AnimationDuration());
    AlphaAnimation alphaAnimation = new AlphaAnimation(1,0);
    alphaAnimation.setDuration(getOptionSD_AnimationDuration());

    animationSet.addAnimation(translateAnimation);
    animationSet.addAnimation(alphaAnimation);
    //设置动画延时
    animationSet.setStartOffset(60*(getOptionPositionCount() - index));
    return animationSet;
}
项目:buildAPKsSamples    文件:ListViewItemAnimations.java   
/**
 * Sets the horizontal position and translucency of the view being swiped.
 */
@SuppressLint("NewApi")
private void setSwipePosition(View view, float deltaX) {
    float fraction = Math.abs(deltaX) / view.getWidth();
    if (isRuntimePostGingerbread()) {
        view.setTranslationX(deltaX);
        view.setAlpha(1 - fraction);
    } else {
        // Hello, Gingerbread!
        TranslateAnimation swipeAnim = new TranslateAnimation(deltaX, deltaX, 0, 0);
        mCurrentX = deltaX;
        mCurrentAlpha = (1 - fraction);
        AlphaAnimation alphaAnim = new AlphaAnimation(mCurrentAlpha, mCurrentAlpha);
        AnimationSet set = new AnimationSet(true);
        set.addAnimation(swipeAnim);
        set.addAnimation(alphaAnim);
        set.setFillAfter(true);
        set.setFillEnabled(true);
        view.startAnimation(set);
    }
}
项目:FLFloatingButton    文件:ArcLayout.java   
private static Animation createShrinkAnimation(float fromXDelta, float toXDelta, float fromYDelta, float toYDelta,
        long startOffset, long duration, Interpolator interpolator) {
    AnimationSet animationSet = new AnimationSet(false);
    animationSet.setFillAfter(true);

    final long preDuration = duration / 2;
    Animation rotateAnimation = new RotateAnimation(0, 360, Animation.RELATIVE_TO_SELF, 0.5f,
            Animation.RELATIVE_TO_SELF, 0.5f);
    rotateAnimation.setStartOffset(startOffset);
    rotateAnimation.setDuration(preDuration);
    rotateAnimation.setInterpolator(new LinearInterpolator());
    rotateAnimation.setFillAfter(true);

    animationSet.addAnimation(rotateAnimation);

    Animation translateAnimation = new RotateAndTranslateAnimation(0, toXDelta, 0, toYDelta, 360, 720);
    translateAnimation.setStartOffset(startOffset + preDuration);
    translateAnimation.setDuration(duration - preDuration);
    translateAnimation.setInterpolator(interpolator);
    translateAnimation.setFillAfter(true);

    animationSet.addAnimation(translateAnimation);

    return animationSet;
}
项目:RLibrary    文件:UIIDialogImpl.java   
/**
 * 对话框结束时的动画
 */
@Override
public Animation loadFinishAnimation() {
    TranslateAnimation translateAnimation = new TranslateAnimation(Animation.RELATIVE_TO_SELF, 0, Animation.RELATIVE_TO_SELF, 0f,
            Animation.RELATIVE_TO_SELF, 0f, Animation.RELATIVE_TO_SELF, 1f);
    AlphaAnimation alphaAnimation = new AlphaAnimation(1, 0);
    setDefaultConfig(translateAnimation, true);
    setDefaultConfig(alphaAnimation, true);

    translateAnimation.setDuration(DEFAULT_DIALOG_FINISH_ANIM_TIME);
    alphaAnimation.setDuration(DEFAULT_DIALOG_FINISH_ANIM_TIME);

    AnimationSet animationSet = new AnimationSet(false);
    animationSet.addAnimation(alphaAnimation);
    animationSet.addAnimation(translateAnimation);
    return animationSet;
}
项目:OSchina_resources_android    文件:KJAnimations.java   
public static Animation shakeAnimation(int X) {
    AnimationSet set = new AnimationSet(true);
    Animation anim1 = getTranslateAnimation(0, -200, 0, 0, 100);
    anim1.setStartOffset(100);
    set.addAnimation(anim1);
    Animation anim2 = getTranslateAnimation(-200, 400, 0, 0, 200);
    anim2.setStartOffset(300);
    set.addAnimation(anim2);
    Animation anim3 = getTranslateAnimation(400, -200, 0, 0, 200);
    anim3.setStartOffset(500);
    set.addAnimation(anim3);
    Animation anim4 = getTranslateAnimation(-200, 0, 0, 0, 100);
    anim4.setStartOffset(600);
    set.addAnimation(anim4);
    set.setFillAfter(true);
    set.setDuration(640);
    return set;
}
项目:Pocket-Plays-for-Twitch    文件:WelcomeActivity.java   
private AnimationSet startShowContinueIconAnimations() {
    Animation mScaleAnimation = new ScaleAnimation(0, 1, 0, 1, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
    Animation mRotateAnimation = new RotateAnimation(
                0, 360,
                Animation.RELATIVE_TO_SELF, 0.5f,
                Animation.RELATIVE_TO_SELF, 0.5f
    );
    mRotateAnimation.setRepeatCount(0);

    AnimationSet mAnimations = new AnimationSet(true);
    mAnimations.setDuration(REVEAL_ANIMATION_DURATION);
    mAnimations.setFillAfter(true);
    mAnimations.setInterpolator(new OvershootInterpolator(1.5f));
    mAnimations.addAnimation(mScaleAnimation);
    mAnimations.addAnimation(mRotateAnimation);

    mContinueIcon.startAnimation(mAnimations);
    return mAnimations;
}
项目:Pocket-Plays-for-Twitch    文件:LoginActivity.java   
private AnimationSet hideAllViews() {
    if(mContinueIcon.getVisibility() == View.VISIBLE) {
        hideContinueIconAnimations();
    }
    hideViewAnimation(mGearIcon, HIDE_VIEW_ANIMATION_DURATION);
    hideViewAnimation(mLoginTextLineOne, HIDE_VIEW_ANIMATION_DURATION);
    if(mSuccessMessage.getVisibility() != View.INVISIBLE) {
        hideViewAnimation(mSuccessMessage, HIDE_VIEW_ANIMATION_DURATION);
    }

    if(mSuccessIcon.getVisibility() != View.INVISIBLE) {
        hideViewAnimation(mSuccessIcon, HIDE_VIEW_ANIMATION_DURATION);
        hideViewAnimation(mSuccessCircle, HIDE_VIEW_ANIMATION_DURATION);
        hideViewAnimation(mSuccessCircleShadow, HIDE_VIEW_ANIMATION_DURATION);
    }

    return hideViewAnimation(mLoginTextLineTwo, HIDE_VIEW_ANIMATION_DURATION);
}
项目:Pocket-Plays-for-Twitch    文件:AnimationService.java   
/**
 * For the Activity Circle Icon and text
 */

public static AnimationSet startAlphaRevealAnimation(final View VIEW) {
    final int ANIMATION_DURATION = 1000;

    final Animation mShowViewAnimation = new AlphaAnimation(0f, 1f);
    mShowViewAnimation.setDuration(ANIMATION_DURATION);

    AnimationSet mAnimations = new AnimationSet(true);
    mAnimations.setInterpolator(new AccelerateDecelerateInterpolator());
    mAnimations.addAnimation(mShowViewAnimation);
    mAnimations.setFillAfter(true);

       if(VIEW != null)
        VIEW.startAnimation(mAnimations);

    return mAnimations;
}
项目:Pocket-Plays-for-Twitch    文件:AnimationService.java   
public static AnimationSet startAlphaHideAnimation(final View VIEW) {
    final int ANIMATION_DURATION = 350;

    final Animation mHideViewAnimation = new AlphaAnimation(1f, 0f);

    AnimationSet mAnimations = new AnimationSet(true);
    mAnimations.setDuration(ANIMATION_DURATION);
    mAnimations.setInterpolator(new AccelerateDecelerateInterpolator());
    mAnimations.addAnimation(mHideViewAnimation);
    mAnimations.setFillAfter(true);

       if(VIEW != null)
        VIEW.startAnimation(mAnimations);

    return mAnimations;
}
项目:QMUI_Android    文件:QMUIBottomSheet.java   
/**
 * BottomSheet升起动画
 */
private void animateUp() {
    if (mContentView == null) {
        return;
    }
    TranslateAnimation translate = new TranslateAnimation(
            Animation.RELATIVE_TO_SELF, 0f, Animation.RELATIVE_TO_SELF, 0f,
            Animation.RELATIVE_TO_SELF, 1f, Animation.RELATIVE_TO_SELF, 0f
    );
    AlphaAnimation alpha = new AlphaAnimation(0, 1);
    AnimationSet set = new AnimationSet(true);
    set.addAnimation(translate);
    set.addAnimation(alpha);
    set.setInterpolator(new DecelerateInterpolator());
    set.setDuration(mAnimationDuration);
    set.setFillAfter(true);
    mContentView.startAnimation(set);
}
项目:UiLib    文件:ArcLayout.java   
private static Animation createShrinkAnimation(float fromXDelta, float toXDelta, float fromYDelta, float toYDelta,
                                               long startOffset, long duration, Interpolator interpolator) {
    AnimationSet animationSet = new AnimationSet(false);
    animationSet.setFillAfter(true);

    final long preDuration = duration / 2;
    Animation rotateAnimation = new RotateAnimation(0, 360, Animation.RELATIVE_TO_SELF, 0.5f,
            Animation.RELATIVE_TO_SELF, 0.5f);
    rotateAnimation.setStartOffset(startOffset);
    rotateAnimation.setDuration(preDuration);
    rotateAnimation.setInterpolator(new LinearInterpolator());
    rotateAnimation.setFillAfter(true);

    animationSet.addAnimation(rotateAnimation);

    Animation translateAnimation = new RotateAndTranslateAnimation(0, toXDelta, 0, toYDelta, 360, 720);
    translateAnimation.setStartOffset(startOffset + preDuration);
    translateAnimation.setDuration(duration - preDuration);
    translateAnimation.setInterpolator(interpolator);
    translateAnimation.setFillAfter(true);

    animationSet.addAnimation(translateAnimation);

    return animationSet;
}
项目:UiLib    文件:RayLayout.java   
private static Animation createShrinkAnimation(float fromXDelta, float toXDelta, float fromYDelta, float toYDelta,
                                               long startOffset, long duration, Interpolator interpolator) {
    AnimationSet animationSet = new AnimationSet(false);
    animationSet.setFillAfter(true);

    final long preDuration = duration / 2;
    Animation rotateAnimation = new RotateAnimation(0, 360, Animation.RELATIVE_TO_SELF, 0.5f,
            Animation.RELATIVE_TO_SELF, 0.5f);
    rotateAnimation.setStartOffset(startOffset);
    rotateAnimation.setDuration(preDuration);
    rotateAnimation.setInterpolator(new LinearInterpolator());
    rotateAnimation.setFillAfter(true);

    animationSet.addAnimation(rotateAnimation);

    Animation translateAnimation = new RotateAndTranslateAnimation(0, toXDelta, 0, toYDelta, 360, 720);
    translateAnimation.setStartOffset(startOffset + preDuration);
    translateAnimation.setDuration(duration - preDuration);
    translateAnimation.setInterpolator(interpolator);
    translateAnimation.setFillAfter(true);

    animationSet.addAnimation(translateAnimation);

    return animationSet;
}
项目:ExpandButton    文件:ExpandButtonLayout.java   
public void close() {

        AnimationSet animationSet = new AnimationSet(true);
        animationSet.setDuration(duration);
        animationSet.setAnimationListener(this);
        animationSet.setFillAfter(true);

        RotateAnimation rotateAnimation = new RotateAnimation(360, 270,
                Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
        animationSet.addAnimation(rotateAnimation);
        Animation scaleAnimation = new ScaleAnimation(1f, 1.25f, 1f, 1.25f,
                ScaleAnimation.RELATIVE_TO_SELF, 0.5f, ScaleAnimation.RELATIVE_TO_SELF, 0.5f);
        animationSet.addAnimation(scaleAnimation);
        imageView.startAnimation(animationSet);
        AnimatorSet animatorSet = new AnimatorSet();
        ObjectAnimator animator1 = ObjectAnimator.ofInt(mLinearLayout, "width", mLinearLayoutWidth, 0);
        ObjectAnimator animator2 = ObjectAnimator.ofInt(mLinearLayout, "paddingLeft", savePaddingLeft, 0);
        ObjectAnimator animator3 = ObjectAnimator.ofInt(mLinearLayout, "paddingRight", savePaddingRight, 0);
        ObjectAnimator animator4 = ObjectAnimator.ofInt(mLinearLayout, "marginLeft", saveMarginLeft, 0);
        ObjectAnimator animator5 = ObjectAnimator.ofInt(mLinearLayout, "marginRight", saveMarginRight, 0);
        animatorSet.playTogether(animator1, animator2, animator3, animator4, animator5);
        animatorSet.setDuration(duration).start();

    }
项目:Cable-Android    文件:MicrophoneRecorderView.java   
public void display(float x) {
  this.startPositionX = x;
  this.lastPositionX  = x;

  recordButtonFab.setVisibility(View.VISIBLE);

  float translation = ViewCompat.getLayoutDirection(recordButtonFab) ==
      ViewCompat.LAYOUT_DIRECTION_LTR ? -.25f : .25f;

  AnimationSet animation = new AnimationSet(true);
  animation.addAnimation(new TranslateAnimation(Animation.RELATIVE_TO_SELF, translation,
                                                Animation.RELATIVE_TO_SELF, translation,
                                                Animation.RELATIVE_TO_SELF, -.25f,
                                                Animation.RELATIVE_TO_SELF, -.25f));

  animation.addAnimation(new ScaleAnimation(.5f, 1f, .5f, 1f,
                                            Animation.RELATIVE_TO_SELF, .5f,
                                            Animation.RELATIVE_TO_SELF, .5f));

  animation.setFillBefore(true);
  animation.setFillAfter(true);
  animation.setDuration(ANIMATION_DURATION);
  animation.setInterpolator(new OvershootInterpolator());

  recordButtonFab.startAnimation(animation);
}
项目:RLibrary    文件:AnimUtil.java   
/**
 * 启动时的动画  从底部平移到顶部
 */
public static Animation translateStartAnimation() {
    TranslateAnimation translateAnimation = new TranslateAnimation(Animation.RELATIVE_TO_SELF, 0f, Animation.RELATIVE_TO_SELF, 0,
            Animation.RELATIVE_TO_SELF, 1f, Animation.RELATIVE_TO_SELF, 0f);
    setDefaultConfig(translateAnimation, false);

    AnimationSet animationSet = new AnimationSet(false);
    animationSet.addAnimation(translateAnimation);
    return animationSet;
}
项目:TaipeiTechRefined    文件:BaseFragment.java   
@Override
public Animation onCreateAnimation(int transit, boolean enter, int nextAnim) {
    Animation animation;
    if (enter) {
        animation = AnimationUtils.loadAnimation(getActivity(), android.R.anim.fade_in);
        animation.setAnimationListener(mAnimationListener);
    } else {
        animation = AnimationUtils.loadAnimation(getActivity(), android.R.anim.fade_out);
    }
    AnimationSet animationSet = new AnimationSet(false);
    animationSet.addAnimation(animation);
    return animationSet;
}
项目:GitHub    文件:MenuPopup.java   
@Override
protected Animation initShowAnimation() {
    AnimationSet set = new AnimationSet(true);
    set.setInterpolator(new DecelerateInterpolator());
    set.addAnimation(getScaleAnimation(0, 1, 0, 1, Animation.RELATIVE_TO_SELF, 1, Animation.RELATIVE_TO_SELF, 0));
    set.addAnimation(getDefaultAlphaAnimation());
    return set;
    //return null;
}
项目:QMark    文件:WelcomeSnowActy.java   
private Animation createAnimation(int top, AnimationListener l) {
    AnimationSet set = new AnimationSet(false);
    set.addAnimation(startAlpha());
    set.addAnimation(startScale());
    int duration = (int) (Math.random() * 10000 + 3000);
    set.addAnimation(randomRotate(duration));
    set.addAnimation(randomScale());
    set.addAnimation(endScale(duration));
    //添加的顺序很重要,TranslateAnimation必须在ScaleAnimation的后面,否则会出现奇怪的现象
    set.addAnimation(randomTranslate(top, duration, l));
    set.addAnimation(randomTranslateX());
    set.addAnimation(endAlpha(duration));
    return set;
}
项目:aftercare-app-android    文件:DCWelcomeFragment.java   
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstance) {
    View view = inflater.inflate(R.layout.fragment_welcome, container, false);
    sdvWelcomeAvatar = (SimpleDraweeView) view.findViewById(R.id.sdv_welcome_avatar);
    tvWelcome = (DCTextView) view.findViewById(R.id.tv_welcome);
    tvWelcomeName = (DCTextView) view.findViewById(R.id.tv_welcome_name);

    Resources r = getResources();
    float translationPx = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 100, r.getDisplayMetrics());

    AlphaAnimation avatarAnimation = new AlphaAnimation(0, 1);
    avatarAnimation.setDuration(2500);
    sdvWelcomeAvatar.startAnimation(avatarAnimation);

    TranslateAnimation welcomeAnimationTranslate = new TranslateAnimation(0, 0, translationPx, 0);
    welcomeAnimationTranslate.setDuration(1500);
    AlphaAnimation welcomeAnimationAlpha = new AlphaAnimation(0, 1);
    welcomeAnimationAlpha.setDuration(1500);

    AnimationSet welcomeAnimation = new AnimationSet(true);
    welcomeAnimation.addAnimation(welcomeAnimationAlpha);
    welcomeAnimation.addAnimation(welcomeAnimationTranslate);
    tvWelcome.startAnimation(welcomeAnimation);

    AlphaAnimation welcomeAnimationName = new AlphaAnimation(0, 1);
    welcomeAnimationName.setDuration(3000);
    tvWelcomeName.startAnimation(welcomeAnimationName);

    loadUser();

    DCSharedPreferences.saveBoolean(DCSharedPreferences.DCSharedKey.WELCOME_SCREEN, true);
    return view;
}
项目:aftercare-app-android    文件:DCLoginFragment.java   
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstance) {
    View view = inflater.inflate(R.layout.fragment_login, container, false);

    ivLoginLogo = (ImageView) view.findViewById(R.id.iv_login_logo);

    Resources r = getResources();
    float translationPx = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 100, r.getDisplayMetrics());

    AlphaAnimation logoAlphaAnimation = new AlphaAnimation(0, 1);
    logoAlphaAnimation.setDuration(500);

    TranslateAnimation logoTranslateAnimation = new TranslateAnimation(0, 0, translationPx, 0);
    logoTranslateAnimation.setDuration(500);

    AnimationSet logoAnimationSet = new AnimationSet(true);
    logoAnimationSet.addAnimation(logoAlphaAnimation);
    logoAnimationSet.addAnimation(logoTranslateAnimation);

    ivLoginLogo.startAnimation(logoAnimationSet);

    btnLoginFacebook = (DCButton) view.findViewById(R.id.btn_login_facebook);
    btnLoginFacebook.setOnClickListener(this);

    btnLoginGoogle = (DCButton) view.findViewById(R.id.btn_login_google);
    btnLoginGoogle.setOnClickListener(this);

    btnLoginTwitter = (DCButton) view.findViewById(R.id.btn_login_twitter);
    btnLoginTwitter.setOnClickListener(this);

    btnLogin = (DCButton) view.findViewById(R.id.btn_login_login);
    btnLogin.setOnClickListener(this);

    tilLoginEmail = (DCTextInputLayout) view.findViewById(R.id.til_login_email);
    tietLoginEmail = (DCTextInputEditText) view.findViewById(R.id.tiet_login_email);
    tietLoginEmail.setOnFocusChangeListener(this);

    tilLoginPassword = (DCTextInputLayout) view.findViewById(R.id.til_login_password);
    tietLoginPassword = (DCTextInputEditText) view.findViewById(R.id.tiet_login_password);

    tvLoginForgotPassword = (DCTextView) view.findViewById(R.id.tv_login_forgot_password);
    tvLoginForgotPassword.setOnClickListener(this);

    return view;
}
项目:Cable-Android    文件:HidingLinearLayout.java   
public void show() {
  if (!isEnabled() || getVisibility() == VISIBLE) return;

  setVisibility(VISIBLE);

  AnimationSet animation = new AnimationSet(true);
  animation.addAnimation(new ScaleAnimation(0, 1, 1, 1, Animation.RELATIVE_TO_SELF, 1f, Animation.RELATIVE_TO_SELF, 0.5f));
  animation.addAnimation(new AlphaAnimation(0, 1));
  animation.setDuration(100);

  animateWith(animation);
}
项目:stynico    文件:x5_MainActivity.java   
/**
    * 获取消失的动画
    *
    * @param context
    * @return
    */
   private AnimationSet getDismissAnim(Context context)
{
       AnimationSet dismiss = new AnimationSet(context, null);
       AlphaAnimation alpha = new AlphaAnimation(1.0f, 0.0f);
       alpha.setDuration(1000);
       dismiss.addAnimation(alpha);
       return dismiss;
   }
项目:SDCardCleaner    文件:MainActivity.java   
private AnimationSet createQuitAnimation(View _view, long _offSet) {
    AnimationSet _set = new AnimationSet(true);

    _set.addAnimation(new AlphaAnimation(1, 0));
    _set.addAnimation(new ScaleAnimation(1, 2, 1, 2));
    _set.addAnimation(new TranslateAnimation(0, -_view.getWidth() / 2, 0, -_view.getHeight() / 2));

    _set.setDuration(150);
    _set.setStartOffset(_offSet);
    _set.setFillAfter(true);
    return _set;
}
项目:PeSanKita-android    文件:MicrophoneRecorderView.java   
public void hide(float x) {
  this.lastPositionX = x;

  float offset          = getOffset(x);
  int   widthAdjustment = getWidthAdjustment();

  AnimationSet animation = new AnimationSet(false);
  Animation scaleAnimation = new ScaleAnimation(1, 0.5f, 1, 0.5f,
                                                Animation.RELATIVE_TO_SELF, 0.5f,
                                                Animation.RELATIVE_TO_SELF, 0.5f);

  Animation translateAnimation = new TranslateAnimation(Animation.ABSOLUTE, offset + widthAdjustment,
                                                        Animation.ABSOLUTE, widthAdjustment,
                                                        Animation.RELATIVE_TO_SELF, -.25f,
                                                        Animation.RELATIVE_TO_SELF, -.25f);

  scaleAnimation.setInterpolator(new AnticipateOvershootInterpolator(1.5f));
  translateAnimation.setInterpolator(new DecelerateInterpolator());
  animation.addAnimation(scaleAnimation);
  animation.addAnimation(translateAnimation);
  animation.setDuration(ANIMATION_DURATION);
  animation.setFillBefore(true);
  animation.setFillAfter(false);
  animation.setInterpolator(new AnticipateOvershootInterpolator(1.5f));

  recordButtonFab.setVisibility(View.GONE);
  recordButtonFab.clearAnimation();
  recordButtonFab.startAnimation(animation);
}
项目:PeSanKita-android    文件:AttachmentTypeSelector.java   
private void animateButtonIn(View button, int delay) {
  AnimationSet animation = new AnimationSet(true);
  Animation scale = new ScaleAnimation(0.0f, 1.0f, 0.0f, 1.0f,
                                       Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.0f);

  animation.addAnimation(scale);
  animation.setInterpolator(new OvershootInterpolator(1));
  animation.setDuration(ANIMATION_DURATION);
  animation.setStartOffset(delay);
  button.startAnimation(animation);
}
项目:PeSanKita-android    文件:HidingLinearLayout.java   
public void show() {
  if (!isEnabled() || getVisibility() == VISIBLE) return;

  setVisibility(VISIBLE);

  AnimationSet animation = new AnimationSet(true);
  animation.addAnimation(new ScaleAnimation(0, 1, 1, 1, Animation.RELATIVE_TO_SELF, 1f, Animation.RELATIVE_TO_SELF, 0.5f));
  animation.addAnimation(new AlphaAnimation(0, 1));
  animation.setDuration(100);

  animateWith(animation);
}
项目:AnimatedPullToRefresh-master    文件:AnimationHelper.java   
private void addTextRotateAnimations(AnimationSet set) {
    RotateAnimation mRotateUpAnim = new RotateAnimation(0.0f, ROTATION_ANGLE, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
    mRotateUpAnim.setDuration(CHARACTER_ANIM_DURATION);
    set.addAnimation(mRotateUpAnim);
    RotateAnimation mRotateDownAnim = new RotateAnimation(ROTATION_ANGLE, 0.0f, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
    mRotateDownAnim.setDuration(CHARACTER_ANIM_DURATION);
    mRotateDownAnim.setStartOffset(CHARACTER_ANIM_DURATION + 20);
    mRotateDownAnim.setFillAfter(true);
    set.addAnimation(mRotateDownAnim);
    set.setInterpolator(interpolator);
}