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; }
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(); }
private void bindHelpButton() { titleHelpButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { ScaleAnimation bounce = new ScaleAnimation(1.2f, 1f, 1.2f, 1, helpButtonSizePx / 2, helpButtonSizePx / 2); bounce.setDuration(600); bounce.setInterpolator(new BounceInterpolator()); if (helpLayout.getVisibility() == View.GONE) { showHelpOverlay(); titleHelpButton.setBackgroundResource(R.drawable.sr_close_icon); titleHelpButton.startAnimation(bounce); } else { hideHelpOverlay(); titleHelpButton.setBackgroundResource(R.drawable.sr_info_icon); titleHelpButton.startAnimation(bounce); } } }); }
/** * 生成ScaleAnimation * * time=300 */ public static Animation getScaleAnimation(float fromX, float toX, float fromY, float toY, int pivotXType, float pivotXValue, int pivotYType, float pivotYValue) { Animation scaleAnimation = new ScaleAnimation(fromX, toX, fromY, toY, pivotXType, pivotXValue, pivotYType, pivotYValue ); scaleAnimation.setDuration(300); scaleAnimation.setFillEnabled(true); scaleAnimation.setFillAfter(true); return scaleAnimation; }
/** * Hides the FAB. */ @Override public void hide() { // Only use scale animation if FAB is visible if (getVisibility() == View.VISIBLE) { // Pivots indicate where the animation begins from float pivotX = getPivotX() + getTranslationX(); float pivotY = getPivotY() + getTranslationY(); // Animate FAB shrinking ScaleAnimation anim = new ScaleAnimation(1, 0, 1, 0, pivotX, pivotY); anim.setDuration(FAB_ANIM_DURATION); anim.setInterpolator(getInterpolator()); startAnimation(anim); } setVisibility(View.INVISIBLE); }
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); }
public void doEnterAnim(final View contentView, long animDuration) { if (builder.gravity == Gravity.BOTTOM) { ValueAnimator enterAnimator = ValueAnimator.ofFloat(contentView.getHeight(), 0); enterAnimator.setDuration(animDuration); enterAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { @Override public void onAnimationUpdate(ValueAnimator animation) { float value = (float) animation.getAnimatedValue(); contentView.setTranslationY(value); } }); enterAnimator.start(); } else { ScaleAnimation scaleAnimation = new ScaleAnimation(0F, 1.0F, 0F, 1.0F, Animation.RELATIVE_TO_PARENT, 0.5F, Animation.RELATIVE_TO_PARENT, 0.5F); scaleAnimation.setDuration(animDuration); scaleAnimation.setFillAfter(true); contentView.startAnimation(scaleAnimation); } }
public void doExitAnim(final View contentView, long animDuration) { if (builder.gravity == Gravity.BOTTOM) { ValueAnimator exitAnimator = ValueAnimator.ofFloat(0, contentView.getHeight()); exitAnimator.setDuration(animDuration); exitAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { @Override public void onAnimationUpdate(ValueAnimator animation) { float value = (float) animation.getAnimatedValue(); contentView.setTranslationY(value); } }); exitAnimator.start(); } else { ScaleAnimation scaleAnimation = new ScaleAnimation(1.0F, 0.0F, 1.0F, 0.0F, Animation.RELATIVE_TO_PARENT, 0.5F, Animation.RELATIVE_TO_PARENT, 0.5F); scaleAnimation.setDuration(animDuration); scaleAnimation.setFillAfter(true); contentView.startAnimation(scaleAnimation); } }
public ScaleLoadingLayout(Context context, Mode mode, Orientation scrollDirection, TypedArray attrs) { super(context, mode, scrollDirection, attrs); /**创建缩放动画动画*/ mRotateDrawableWhilePulling = attrs.getBoolean(R.styleable.PullToRefresh_ptrRotateDrawableWhilePulling, true); // mContentLayout.setSca(ScaleType.MATRIX); // mHeaderImageMatrix = new Matrix(); // mHeaderImage.setImageMatrix(mHeaderImageMatrix); mScalAnimation = new ScaleAnimation(BASE_SCALE, 1, Animation.RELATIVE_TO_SELF, BASE_SCALE, Animation.RELATIVE_TO_SELF, 1); mScalAnimation.setInterpolator(ANIMATION_INTERPOLATOR); mScalAnimation.setDuration(ROTATION_ANIMATION_DURATION); mScalAnimation.setRepeatCount(Animation.INFINITE); mScalAnimation.setRepeatMode(Animation.RESTART); }
@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(); }
protected void onSuccess() { mCardView.removeAllViews(); MediaPlayer.create(mContext, R.raw.shake).start(); initShakeView(); mCardView.addView(mShakeView); mCardView.setVisibility(View.VISIBLE); ScaleAnimation animation = new ScaleAnimation(0.0f, 1.0f, 0.0f, 1.0f, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f); animation.setDuration(320); animation.setFillAfter(true); mCardView.startAnimation(animation); mLoadingView.stop(); mLoadingView.setVisibility(View.GONE); mTvState.setVisibility(View.GONE); }
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; }
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(); }
@Override @SuppressLint("SetJavaScriptEnabled") protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_web); WebView webView = (WebView) findViewById(R.id.web_view); String url = getIntent().getStringExtra(URL); if (url == null && getIntent().getData() != null) { url = getIntent().getData().getQueryParameter(URL); } if (url == null) { finish(); } webView.setWebViewClient(new InnerWebViewClient()); webView.getSettings().setJavaScriptEnabled(true); webView.loadUrl(url); loading = (TextView) findViewById(R.id.loading); Animation animation = new ScaleAnimation(1.0f, 1.2f, 1.0f, 1.2f, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f); animation.setRepeatMode(Animation.REVERSE); animation.setRepeatCount(Animation.INFINITE); animation.setDuration(500); loading.startAnimation(animation); setTitle(url); }
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; }
public void setShowTip(String tip) { boolean oldShow = mShowTip; mShowTip = true; ((TextView) mTipView).setText(tip); if (oldShow) { mTipView.removeCallbacks(hideTipRunnable); } else { mTipView.clearAnimation(); ScaleAnimation scaleAnimation = new ScaleAnimation(0.6f, 1, 1, 1, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f); scaleAnimation.setDuration(ANIM_TIME); mTipView.startAnimation(scaleAnimation); } mTipView.postDelayed(hideTipRunnable, 1000); }
@Override public void reloadQuestionnaire(List<Question> questionList) { refreshQuestionnaire(questionList); ScaleAnimation animation = new ScaleAnimation( 1.15f, 1, 1.15f, 1, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f); mCardsContainerView.setAnimation(animation); animation.setDuration(100); animation.start(); }
@Override protected void onSizeChanged(int w, int h, int oldw, int oldh) { super.onSizeChanged(w, h, oldw, oldh); WIDTH = w; HEIGHT = h; scaleAnimation = new ScaleAnimation(1.0f, zoomScale, 1.0f, zoomScale, w / 2, h / 2); scaleAnimation.setDuration(zoomDuration); scaleAnimation.setRepeatMode(Animation.REVERSE); scaleAnimation.setRepeatCount(1); }
/** * 生成自定义ScaleAnimation */ public static Animation getDefaultScaleAnimation() { Animation scaleAnimation = new ScaleAnimation(0f, 1f, 0f, 1f, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f ); scaleAnimation.setDuration(300); scaleAnimation.setInterpolator(new AccelerateInterpolator()); scaleAnimation.setFillEnabled(true); scaleAnimation.setFillAfter(true); return scaleAnimation; }
private ScaleAnimation startScale() { ScaleAnimation scale = new ScaleAnimation(0, 1, 0, 1, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f); scale.setInterpolator(this, android.R.anim.accelerate_interpolator); scale.setStartOffset(0); scale.setDuration(1500); return scale; }
private ScaleAnimation randomScale() { float scaleTo = (float) (0.3f + Math.random() * 0.5f); ScaleAnimation scale = new ScaleAnimation(1, scaleTo, 1, scaleTo, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f); scale.setRepeatCount(Animation.INFINITE); scale.setRepeatMode(Animation.REVERSE); scale.setStartOffset(1000); scale.setDuration((int) (Math.random() * 3000) + 1000); return scale; }
private ScaleAnimation endScale(int startTime) { ScaleAnimation scale = new ScaleAnimation(1, 0, 1, 0, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f); scale.setInterpolator(this, android.R.anim.decelerate_interpolator); scale.setStartOffset(startTime - 300); scale.setDuration(300); return scale; }
/** * Get a shrink animation * * @param durationMillis duration * @param animationListener Animation monitor * @return A shrink animation */ public static ScaleAnimation getLessenScaleAnimation(long durationMillis, Animation.AnimationListener animationListener) { ScaleAnimation scaleAnimation = new ScaleAnimation(1.0f, 0.0f, 1.0f, 0.0f, ScaleAnimation.RELATIVE_TO_SELF, ScaleAnimation.RELATIVE_TO_SELF); scaleAnimation.setDuration(durationMillis); scaleAnimation.setAnimationListener(animationListener); return scaleAnimation; }
/** * Get an enlarged animation * * @param durationMillis duration * @param animationListener Animation monitor * @return An enlarged animation */ public static ScaleAnimation getAmplificationAnimation(long durationMillis, Animation.AnimationListener animationListener) { ScaleAnimation scaleAnimation = new ScaleAnimation(0.0f, 1.0f, 0.0f, 1.0f, ScaleAnimation.RELATIVE_TO_SELF, ScaleAnimation.RELATIVE_TO_SELF); scaleAnimation.setDuration(durationMillis); scaleAnimation.setAnimationListener(animationListener); return scaleAnimation; }
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); }
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); }
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); }
private void addTextZoomAnimations(AnimationSet set) { ScaleAnimation mScaleAnim = new ScaleAnimation(1, SCALE_AMOUNT, 1f, SCALE_AMOUNT, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f); mScaleAnim.setDuration(CHARACTER_ANIM_DURATION); set.addAnimation(mScaleAnim); ScaleAnimation mScaleDownAnim = new ScaleAnimation(1, SCALE_AMOUNT, 1f, SCALE_AMOUNT, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f); mScaleDownAnim.setDuration(CHARACTER_ANIM_DURATION); mScaleDownAnim.setStartOffset(CHARACTER_ANIM_DURATION + 20); mScaleDownAnim.setFillAfter(true); set.addAnimation(mScaleDownAnim); set.setInterpolator(interpolator); }
private void addLoopScaleAnimations(long duration, AnimationSet set) { ScaleAnimation mScaleAnim = new ScaleAnimation(1, SCALE_AMOUNT, 1f, SCALE_AMOUNT, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f); mScaleAnim.setDuration(duration); set.addAnimation(mScaleAnim); ScaleAnimation mScaleDownAnim = new ScaleAnimation(SCALE_AMOUNT, 1, SCALE_AMOUNT, 1, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f); mScaleDownAnim.setDuration(duration); mScaleDownAnim.setStartOffset(duration + 50); set.addAnimation(mScaleDownAnim); set.setInterpolator(interpolator); }
@Override public void onClick(View view) { //Extract values from children LinearLayout rowsView = (LinearLayout) rootView.findViewById(R.id.repeatable_items); ArrayList<String> row = new ArrayList<>(); for (int i = 0; i < rowsView.getChildCount(); ++i) { EditText et = (EditText) rowsView.getChildAt(i).findViewById(R.id.input_row); row.add(et.getText().toString()); } fq.addRow(row); TextView tvCount = (TextView) rootView.findViewById(R.id.question_items_count); tvCount.setText(fq.getRows().size() + " items"); Toast.makeText(FormSolverActivity.this, "SAVED", Toast.LENGTH_SHORT).show(); Animation animation = new ScaleAnimation(1,1.1f,1,1.1f); animation.setDuration(300); animation.setRepeatMode(Animation.REVERSE); animation.setRepeatCount(1); tvCount.startAnimation(animation); //Remove any child from view ((LinearLayout) rootView.findViewById(R.id.repeatable_items)).removeAllViews(); ((Button) rootView.findViewById(R.id.question_add_response_instance)).setText(getString(R.string.action_new_row)); rootView.findViewById(R.id.question_add_response_instance).setOnClickListener(new onRowAddedListener(rootView, fq)); fab.show(); }
/** * 生成ScaleAnimation */ protected Animation getScaleAnimation(float fromX, float toX, float fromY, float toY, int pivotXType, float pivotXValue, int pivotYType, float pivotYValue) { Animation scaleAnimation = new ScaleAnimation(fromX, toX, fromY, toY, pivotXType, pivotXValue, pivotYType, pivotYValue); scaleAnimation.setDuration(300); scaleAnimation.setFillEnabled(true); scaleAnimation.setFillAfter(true); return scaleAnimation; }
/** * 生成自定义ScaleAnimation */ protected Animation getDefaultScaleAnimation() { Animation scaleAnimation = new ScaleAnimation(0f, 1f, 0f, 1f, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f); scaleAnimation.setDuration(300); scaleAnimation.setInterpolator(new AccelerateInterpolator()); scaleAnimation.setFillEnabled(true); scaleAnimation.setFillAfter(true); return scaleAnimation; }
/** * 缩放+旋转动画进入 * @param view 动画作用的视图 * @param durationMillis 动画持续的时间 * @param delayMillis 经过多少毫秒播放动画 */ public static void scaleRotateIn(View view, long durationMillis, long delayMillis) { ScaleAnimation animation1 = new ScaleAnimation(0, 1, 0, 1, rela1, 0.5f, rela1, 0.5f); RotateAnimation animation2 = new RotateAnimation(0, 360, rela1, 0.5f, rela1, 0.5f); AnimationSet animation = new AnimationSet(false); animation.addAnimation(animation1); animation.addAnimation(animation2); baseIn(view, animation, durationMillis, delayMillis); }
/** * 缩放+旋转动画出来 * @param view 动画作用的视图 * @param durationMillis 动画持续的时间 * @param delayMillis 经过多少毫秒播放动画 */ public static void scaleRotateOut(View view, long durationMillis, long delayMillis) { ScaleAnimation animation1 = new ScaleAnimation(1, 0, 1, 0, rela1, 0.5f, rela1, 0.5f); RotateAnimation animation2 = new RotateAnimation(0, 360, rela1, 0.5f, rela1, 0.5f); AnimationSet animation = new AnimationSet(false); animation.addAnimation(animation1); animation.addAnimation(animation2); baseOut(view, animation, durationMillis, delayMillis); }