当前位置: 首页>>代码示例>>Java>>正文


Java Animation类代码示例

本文整理汇总了Java中android.view.animation.Animation的典型用法代码示例。如果您正苦于以下问题:Java Animation类的具体用法?Java Animation怎么用?Java Animation使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Animation类属于android.view.animation包,在下文中一共展示了Animation类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: open

import android.view.animation.Animation; //导入依赖的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.Animation; //导入依赖的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: generateLineRTLAnimation

import android.view.animation.Animation; //导入依赖的package包/类
private Animation generateLineRTLAnimation(final RectF rectF, long offset) {

		final float currentLeft = rectF.left;
		final float currentRight = rectF.right;

		Animation animation = new Animation() {
			@Override
			protected void applyTransformation(float interpolatedTime, Transformation t) {
				super.applyTransformation(interpolatedTime, t);
				if (getCurrentState() == HBButtonState.NORMAL) {
					rectF.set(currentLeft + (currentRight - currentLeft) / 2 * interpolatedTime, rectF.top, rectF.right, rectF.bottom);
				} else {
					rectF.set(currentLeft - (currentRight - currentLeft) * interpolatedTime, rectF.top, rectF.right, rectF.bottom);
				}
				invalidate();
			}
		};
		animation.setDuration(getAnimationDuration());
		animation.setStartOffset(offset);
		return animation;
	}
 
开发者ID:LongDinhF,项目名称:Hamburger-Button,代码行数:22,代码来源:HBButton.java

示例4: finishDialogAnim

import android.view.animation.Animation; //导入依赖的package包/类
/**
 * 销毁对话框的动画
 */
private void finishDialogAnim(final ViewPattern dialogPattern, final Animation animation, final Runnable end) {
      /*是否变暗*/
    if (dialogPattern.mIView.isDimBehind()) {
        AnimUtil.startArgb(dialogPattern.mIView.getDialogDimView(),
                dialogPattern.mIView.getDimColor(), Color.TRANSPARENT, DEFAULT_ANIM_TIME);
    }

    final View animView = dialogPattern.mIView.getAnimView();

    final Runnable endRunnable = new Runnable() {
        @Override
        public void run() {
            dialogPattern.mView.setAlpha(0);
            dialogPattern.mView.setVisibility(INVISIBLE);
            end.run();
        }
    };

    safeStartAnim(animView, animation, endRunnable, true);
}
 
开发者ID:angcyo,项目名称:RLibrary,代码行数:24,代码来源:UILayoutImpl.java

示例5: onPasscodeError

import android.view.animation.Animation; //导入依赖的package包/类
protected void onPasscodeError() {
	Encryptor.snackPeak(mActivity,getString(R.string.passcode_wrong));

	Thread thread = new Thread() {
		public void run() {
			Animation animation = AnimationUtils.loadAnimation(
					LockActivity.this, R.anim.shake);
			findViewById(R.id.ll_applock).startAnimation(animation);
			codeField1.setText("");
			codeField2.setText("");
			codeField3.setText("");
			codeField4.setText("");
			codeField1.requestFocus();
		}
	};
	runOnUiThread(thread);
}
 
开发者ID:balrampandey19,项目名称:AppLocker,代码行数:18,代码来源:LockActivity.java

示例6: expand

import android.view.animation.Animation; //导入依赖的package包/类
private void expand(final View v) {
    v.measure(-1, -2);
    final int targetHeight = v.getMeasuredHeight();
    v.getLayoutParams().height = 0;
    v.setVisibility(0);
    this.animation = new Animation() {
        protected void applyTransformation(float interpolatedTime, Transformation t) {
            if (interpolatedTime == 1.0f) {
                ExpandableLayout.this.isOpened = Boolean.valueOf(true);
            }
            v.getLayoutParams().height = interpolatedTime == 1.0f ? -2 : (int) (((float)
                    targetHeight) * interpolatedTime);
            v.requestLayout();
        }

        public boolean willChangeBounds() {
            return true;
        }
    };
    this.animation.setDuration((long) this.duration.intValue());
    v.startAnimation(this.animation);
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:23,代码来源:ExpandableLayout.java

示例7: animateSides

import android.view.animation.Animation; //导入依赖的package包/类
/**
 * Animating the sides of the row, For example animating the user profile image and the message date.
 * */
private void animateSides(View view, boolean fromLeft, Animation.AnimationListener animationListener){
    if (!isScrolling)
        return;

    if (fromLeft)
        view.setAnimation(AnimationUtils.loadAnimation(mActivity, R.anim.expand_slide_form_left));
    else view.setAnimation(AnimationUtils.loadAnimation(mActivity, R.anim.expand_slide_form_right));

    view.getAnimation().setAnimationListener(animationListener);
    view.animate();
}
 
开发者ID:MobileDev418,项目名称:AndroidBackendlessChat,代码行数:15,代码来源:ChatSDKMessagesListAdapter.java

示例8: show

import android.view.animation.Animation; //导入依赖的package包/类
void show(@Nullable final InternalVisibilityChangedListener listener, boolean fromUser) {
    if (this.mView.getVisibility() != 0 || this.mIsHiding) {
        this.mView.clearAnimation();
        this.mView.internalSetVisibility(0, fromUser);
        Animation anim = AnimationUtils.loadAnimation(this.mView.getContext(), R.anim.design_fab_in);
        anim.setDuration(200);
        anim.setInterpolator(AnimationUtils.LINEAR_OUT_SLOW_IN_INTERPOLATOR);
        anim.setAnimationListener(new AnimationListenerAdapter() {
            public void onAnimationEnd(Animation animation) {
                if (listener != null) {
                    listener.onShown();
                }
            }
        });
        this.mView.startAnimation(anim);
    } else if (listener != null) {
        listener.onShown();
    }
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:20,代码来源:FloatingActionButtonEclairMr1.java

示例9: startLoadingAnimation

import android.view.animation.Animation; //导入依赖的package包/类
private void startLoadingAnimation(ImageView imageView) {
  RotateAnimation loadingAnimation =
      new RotateAnimation(0f, 360f, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF,
          0.5f);
  loadingAnimation.setDuration(1000);
  loadingAnimation.setRepeatCount(-1);
  loadingAnimation.setInterpolator(new LinearInterpolator());
  imageView.setAnimation(loadingAnimation);
  loadingAnimation.start();
}
 
开发者ID:Lingzh0ng,项目名称:BrotherWeather,代码行数:11,代码来源:CustomRefreshLayout2.java

示例10: startScaleUpAnimation

import android.view.animation.Animation; //导入依赖的package包/类
private void startScaleUpAnimation(AnimationListener listener) {
    mCircleView.setVisibility(View.VISIBLE);
    if (android.os.Build.VERSION.SDK_INT >= 11) {
        // Pre API 11, alpha is used in place of scale up to show the
        // progress circle appearing.
        // Don't adjust the alpha during appearance otherwise.
        mProgress.setAlpha(MAX_ALPHA);
    }
    mScaleAnimation = new Animation() {
        @Override
        public void applyTransformation(float interpolatedTime, Transformation t) {
            setAnimationProgress(interpolatedTime);
        }
    };
    mScaleAnimation.setDuration(mMediumAnimationDuration);
    if (listener != null) {
        mCircleView.setAnimationListener(listener);
    }
    mCircleView.clearAnimation();
    mCircleView.startAnimation(mScaleAnimation);
}
 
开发者ID:HanyeeWang,项目名称:GeekZone,代码行数:22,代码来源:SwipeRefreshLayout.java

示例11: RotateLoadingLayout

import android.view.animation.Animation; //导入依赖的package包/类
public RotateLoadingLayout(Context context, Mode mode, Orientation scrollDirection, TypedArray attrs) {
	super(context, mode, scrollDirection, attrs);

	mRotateDrawableWhilePulling = attrs.getBoolean(R.styleable.PullToRefresh_ptrRotateDrawableWhilePulling, true);

	mHeaderImage.setScaleType(ScaleType.MATRIX);
	mHeaderImageMatrix = new Matrix();
	mHeaderImage.setImageMatrix(mHeaderImageMatrix);

	mRotateAnimation = new RotateAnimation(0, 720, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF,
			0.5f);
	mRotateAnimation.setInterpolator(ANIMATION_INTERPOLATOR);
	mRotateAnimation.setDuration(ROTATION_ANIMATION_DURATION);
	mRotateAnimation.setRepeatCount(Animation.INFINITE);
	mRotateAnimation.setRepeatMode(Animation.RESTART);
}
 
开发者ID:liupengandroid,项目名称:ywApplication,代码行数:17,代码来源:RotateLoadingLayout.java

示例12: expand

import android.view.animation.Animation; //导入依赖的package包/类
public void expand() {
    if (!isExpand) {
        isExpand = true;
        mText.setTextColor(Color.TRANSPARENT);
        mExpandText.setTextColor(mTextColor);
        Animation animation = new Animation() {
            @Override
            protected void applyTransformation(float interpolatedTime, Transformation t) {
                ViewGroup.LayoutParams params = ExpandTextView.this.getLayoutParams();
                params.height = mStart + (int) ((mEnd - mStart) * interpolatedTime);
                setLayoutParams(params);
            }
        };
        animation.setDuration(500);
        startAnimation(animation);
    }

}
 
开发者ID:Zweihui,项目名称:Aurora,代码行数:19,代码来源:ExpandTextView.java

示例13: initView

import android.view.animation.Animation; //导入依赖的package包/类
private void initView(Context context) {
    mContent = (ViewGroup) LayoutInflater.from(context).inflate(R.layout.rfv_header, this);
    imgDirectionArrow = (ImageView) findViewById(R.id.imgDirectionArrow);
    tvRefreshState = (TextView) findViewById(R.id.tvRefreshState);
    tvLastRefreshTime = (TextView) findViewById(R.id.tvLastRefreshTime);
    mProgressBar = (ProgressBar) findViewById(R.id.rfv_header_progressbar);

    mRotateUpAnim = new RotateAnimation(0.0f, -180.0f,
            Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
    mRotateUpAnim.setDuration(ROTATE_ANIM_DURATION);
    mRotateUpAnim.setFillAfter(true);
    mRotateDownAnim = new RotateAnimation(-180.0f, 0.0f,
            Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
    mRotateDownAnim.setDuration(ROTATE_ANIM_DURATION);
    mRotateDownAnim.setFillAfter(true);
}
 
开发者ID:Implementist,项目名称:iReading,代码行数:17,代码来源:RefreshViewHeader.java

示例14: wrap

import android.view.animation.Animation; //导入依赖的package包/类
public static View10 wrap(View view) {
    View10 proxy = PROXIES.get(view);
    Animation animation = view.getAnimation();
    if (proxy == null || proxy != animation && animation != null) {
        proxy = new View10(view);
        PROXIES.put(view, proxy);
    } else if (animation == null) {
        view.setAnimation(proxy);
    }
    return proxy;
}
 
开发者ID:pooyafaroka,项目名称:PlusGram,代码行数:12,代码来源:View10.java

示例15: animationIn

import android.view.animation.Animation; //导入依赖的package包/类
public static void animationIn(final View view, final int animation, int delayTime, final Context context) {
    Handler handler = new Handler();
    handler.postDelayed(new Runnable() {
        public void run() {
            Animation inAnimation = AnimationUtils.loadAnimation(
                    context.getApplicationContext(), animation);
            view.setAnimation(inAnimation);
            view.setVisibility(View.VISIBLE);
        }
    }, delayTime);
}
 
开发者ID:vipulyaara,项目名称:betterHotels,代码行数:12,代码来源:Utils.java


注:本文中的android.view.animation.Animation类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。