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


Java AnimationSet類代碼示例

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


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

示例1: open

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

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

示例2: startShowContinueIconAnimations

import android.view.animation.AnimationSet; //導入依賴的package包/類
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;
}
 
開發者ID:SebastianRask,項目名稱:Pocket-Plays-for-Twitch,代碼行數:20,代碼來源:WelcomeActivity.java

示例3: startHideContinueIconAnimations

import android.view.animation.AnimationSet; //導入依賴的package包/類
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;
}
 
開發者ID:SebastianRask,項目名稱:Pocket-Plays-for-Twitch,代碼行數:20,代碼來源:WelcomeActivity.java

示例4: setAdapterInsertAnimation

import android.view.animation.AnimationSet; //導入依賴的package包/類
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);
}
 
開發者ID:SebastianRask,項目名稱:Pocket-Plays-for-Twitch,代碼行數:19,代碼來源:AnimationService.java

示例5: 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

示例6: getView

import android.view.animation.AnimationSet; //導入依賴的package包/類
@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;
}
 
開發者ID:teisun,項目名稱:SunmiUI,代碼行數:22,代碼來源:StringListAdapter.java

示例7: 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

示例8: applyLoopAnimation

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

示例9: animateUp

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

示例10: getStartAnimation

import android.view.animation.AnimationSet; //導入依賴的package包/類
/**
 * 獲得入場動畫
 *
 * @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;
}
 
開發者ID:jeasinlee,項目名稱:AndroidBasicLibs,代碼行數:25,代碼來源:DrawerToast.java

示例11: getEndAnimation

import android.view.animation.AnimationSet; //導入依賴的package包/類
/**
 * 獲得離場動畫
 *
 * @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;
}
 
開發者ID:jeasinlee,項目名稱:AndroidBasicLibs,代碼行數:25,代碼來源:DrawerToast.java

示例12: onCreate

import android.view.animation.AnimationSet; //導入依賴的package包/類
@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();
  }
 
開發者ID:qizhenghao,項目名稱:HiBangClient,代碼行數:37,代碼來源:WhatsnewDoor.java

示例13: createOptionShowAnimation

import android.view.animation.AnimationSet; //導入依賴的package包/類
@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;
}
 
開發者ID:totond,項目名稱:YMenuView,代碼行數:20,代碼來源:Circle8YMenu.java

示例14: createOptionDisappearAnimation

import android.view.animation.AnimationSet; //導入依賴的package包/類
@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;
}
 
開發者ID:totond,項目名稱:YMenuView,代碼行數:21,代碼來源:Circle8YMenu.java

示例15: createOptionDisappearAnimation

import android.view.animation.AnimationSet; //導入依賴的package包/類
@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;
}
 
開發者ID:totond,項目名稱:YMenuView,代碼行數:21,代碼來源:TreeYMenu.java


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