當前位置: 首頁>>代碼示例>>Java>>正文


Java AnimationSet.addAnimation方法代碼示例

本文整理匯總了Java中android.view.animation.AnimationSet.addAnimation方法的典型用法代碼示例。如果您正苦於以下問題:Java AnimationSet.addAnimation方法的具體用法?Java AnimationSet.addAnimation怎麽用?Java AnimationSet.addAnimation使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在android.view.animation.AnimationSet的用法示例。


在下文中一共展示了AnimationSet.addAnimation方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: scaleSmallAnim

import android.view.animation.AnimationSet; //導入方法依賴的package包/類
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;

    }
 
開發者ID:Ethan-9606,項目名稱:BottomMenu,代碼行數:17,代碼來源:BottomMenu.java

示例2: display

import android.view.animation.AnimationSet; //導入方法依賴的package包/類
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);
}
 
開發者ID:CableIM,項目名稱:Cable-Android,代碼行數:27,代碼來源:MicrophoneRecorderView.java

示例3: close

import android.view.animation.AnimationSet; //導入方法依賴的package包/類
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();

    }
 
開發者ID:ViewStub,項目名稱:ExpandButton,代碼行數:25,代碼來源:ExpandButtonLayout.java

示例4: initAnimations

import android.view.animation.AnimationSet; //導入方法依賴的package包/類
/**
 * 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);
}
 
開發者ID:mapbox,項目名稱:mapbox-navigation-android,代碼行數:22,代碼來源:InstructionView.java

示例5: createShrinkAnimation

import android.view.animation.AnimationSet; //導入方法依賴的package包/類
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;
}
 
開發者ID:cheenid,項目名稱:FLFloatingButton,代碼行數:26,代碼來源:RayLayout.java

示例6: createShrinkAnimation

import android.view.animation.AnimationSet; //導入方法依賴的package包/類
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;
}
 
開發者ID:leobert-lan,項目名稱:UiLib,代碼行數:26,代碼來源:ArcLayout.java

示例7: createShrinkAnimation

import android.view.animation.AnimationSet; //導入方法依賴的package包/類
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;
}
 
開發者ID:cheenid,項目名稱:FLFloatingButton,代碼行數:26,代碼來源:ArcLayout.java

示例8: setSwipePosition

import android.view.animation.AnimationSet; //導入方法依賴的package包/類
/**
 * 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);
    }
}
 
開發者ID:sdrausty,項目名稱:buildAPKsSamples,代碼行數:24,代碼來源:ListViewItemAnimations.java

示例9: makeOpenCloseAnimation

import android.view.animation.AnimationSet; //導入方法依賴的package包/類
static Animation makeOpenCloseAnimation(Context context, float startScale, float endScale, float startAlpha, float endAlpha) {
    AnimationSet set = new AnimationSet(false);
    ScaleAnimation scale = new ScaleAnimation(startScale, endScale, startScale, endScale, 1, 0.5f, 1, 0.5f);
    scale.setInterpolator(DECELERATE_QUINT);
    scale.setDuration(220);
    set.addAnimation(scale);
    AlphaAnimation alpha = new AlphaAnimation(startAlpha, endAlpha);
    alpha.setInterpolator(DECELERATE_CUBIC);
    alpha.setDuration(220);
    set.addAnimation(alpha);
    return set;
}
 
開發者ID:JackChan1999,項目名稱:letv,代碼行數:13,代碼來源:FragmentManagerImpl.java

示例10: createItemDisapperAnimation

import android.view.animation.AnimationSet; //導入方法依賴的package包/類
private static Animation createItemDisapperAnimation(final long duration, final boolean isClicked) {
	AnimationSet animationSet = new AnimationSet(true);
	animationSet.addAnimation(new ScaleAnimation(1.0f, isClicked ? 2.0f : 0.0f, 1.0f, isClicked ? 2.0f : 0.0f,
			Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f));
	animationSet.addAnimation(new AlphaAnimation(1.0f, 0.0f));

	animationSet.setDuration(duration);
	animationSet.setInterpolator(new DecelerateInterpolator());
	animationSet.setFillAfter(true);

	return animationSet;
}
 
開發者ID:leobert-lan,項目名稱:UiLib,代碼行數:13,代碼來源:RayMenu.java

示例11: scaleBigAnimation

import android.view.animation.AnimationSet; //導入方法依賴的package包/類
/**
 * item變大的動畫
 *
 * @return
 */
private Animation scaleBigAnimation(int duration) {
    AnimationSet animationSet = new AnimationSet(true);
    ScaleAnimation scaleAnimation = new ScaleAnimation(1.0f, 2.5f, 1.0f, 2.5f, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5F);
    AlphaAnimation alphaAnimation = new AlphaAnimation(1.0f, 0.0f);
    animationSet.addAnimation(scaleAnimation);
    animationSet.addAnimation(alphaAnimation);
    animationSet.setDuration(duration);
    animationSet.setFillAfter(true);
    return animationSet;
}
 
開發者ID:DingMouRen,項目名稱:AnnularMenuView,代碼行數:16,代碼來源:AnnularMenu.java

示例12: createQuitAnimation

import android.view.animation.AnimationSet; //導入方法依賴的package包/類
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;
}
 
開發者ID:bonepeople,項目名稱:SDCardCleaner,代碼行數:13,代碼來源:MainActivity.java

示例13: wave

import android.view.animation.AnimationSet; //導入方法依賴的package包/類
public void wave() {
    AnimationSet as = new AnimationSet(true);
    ScaleAnimation sa = new ScaleAnimation(1f, 1.5f, 1f, 1.5f, ScaleAnimation.RELATIVE_TO_SELF,
            0.5f, ScaleAnimation.RELATIVE_TO_SELF, 0.5f);
    sa.setDuration(ANIMATIONEACHOFFSET * 3);
    sa.setRepeatCount(10);// 設置循環
    AlphaAnimation aniAlp = new AlphaAnimation(1, 0.1f);
    aniAlp.setRepeatCount(10);// 設置循環
    as.setDuration(ANIMATIONEACHOFFSET * 3);
    as.addAnimation(sa);
    as.addAnimation(aniAlp);
    labelIcon.startAnimation(as);
}
 
開發者ID:Sherchen,項目名稱:AnimationsDemo,代碼行數:14,代碼來源:LabelView.java

示例14: createItemDisapperAnimation

import android.view.animation.AnimationSet; //導入方法依賴的package包/類
private static Animation createItemDisapperAnimation(final long duration, final boolean isClicked) {
    AnimationSet animationSet = new AnimationSet(true);
    animationSet.addAnimation(new ScaleAnimation(1.0f, isClicked ? 2.0f : 0.0f, 1.0f, isClicked ? 2.0f : 0.0f,
            Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f));
    animationSet.addAnimation(new AlphaAnimation(1.0f, 0.0f));

    animationSet.setDuration(duration);
    animationSet.setInterpolator(new DecelerateInterpolator());
    animationSet.setFillAfter(true);

    return animationSet;
}
 
開發者ID:l465659833,項目名稱:Bigbang,代碼行數:13,代碼來源:ArcMenu.java

示例15: getAnimationSetScaleBig

import android.view.animation.AnimationSet; //導入方法依賴的package包/類
/**
 * 放大動畫
 *
 * @return
 */
public static AnimationSet getAnimationSetScaleBig() {
    AnimationSet animationSet = new AnimationSet(true);

    ScaleAnimation scaleAnimation = new ScaleAnimation(0.1f, 1.0f, 0.1f, 1.0f, RELATIVE_TO_SELF, 0.5f, RELATIVE_TO_SELF, 0.5f);
    scaleAnimation.setInterpolator(new DecelerateInterpolator());
    scaleAnimation.setDuration(400);


    animationSet.addAnimation(scaleAnimation);
    animationSet.setDuration(400);

    return animationSet;
}
 
開發者ID:nuptboyzhb,項目名稱:RecyclerViewAnimation,代碼行數:19,代碼來源:MyLayoutAnimationHelper.java


注:本文中的android.view.animation.AnimationSet.addAnimation方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。