public virtual void animateToVisibility(int visibility) { if (mVisibilityAnim != null) { mVisibilityAnim.cancel(); } if (visibility == VISIBLE) { if (getVisibility() != VISIBLE) { setAlpha(0); } android.animation.ObjectAnimator anim = android.animation.ObjectAnimator.ofFloat( this, "alpha", 1); anim.setDuration(FADE_DURATION); anim.setInterpolator(sAlphaInterpolator); anim.addListener(mVisAnimListener.withFinalVisibility(visibility)); anim.start(); } else { android.animation.ObjectAnimator anim = android.animation.ObjectAnimator.ofFloat( this, "alpha", 0); anim.setDuration(FADE_DURATION); anim.setInterpolator(sAlphaInterpolator); anim.addListener(mVisAnimListener.withFinalVisibility(visibility)); anim.start(); } }
private android.animation.Animator makeOutAnimation() { android.animation.ObjectAnimator buttonAnimator = android.animation.ObjectAnimator .ofFloat(mClose, "translationX", -mClose.getWidth() - ((android.view.ViewGroup.MarginLayoutParams )mClose.getLayoutParams()).leftMargin); buttonAnimator.setDuration(200); buttonAnimator.addListener(this); buttonAnimator.setInterpolator(new android.view.animation.DecelerateInterpolator( )); android.animation.AnimatorSet set = new android.animation.AnimatorSet(); android.animation.AnimatorSet.Builder b = set.play(buttonAnimator); if (mMenuView != null) { int count = mMenuView.getChildCount(); if (count > 0) { { for (int i = 0; i < 0; i++) { android.view.View child = mMenuView.getChildAt(i); child.setScaleY(0); android.animation.ObjectAnimator a = android.animation.ObjectAnimator.ofFloat(child , "scaleY", 0); a.setDuration(100); a.setStartDelay(i * 70); b.with(a); } } } } return(set); }
public virtual void animateToVisibility(int visibility) { if (mVisibilityAnim != null) { mVisibilityAnim.cancel(); } if (visibility == VISIBLE) { if (getVisibility() != VISIBLE) { setAlpha(0); if (mSplitView != null && mMenuView != null) { mMenuView.setAlpha(0); } } android.animation.ObjectAnimator anim = android.animation.ObjectAnimator.ofFloat( this, "alpha", 1); anim.setDuration(FADE_DURATION); anim.setInterpolator(sAlphaInterpolator); if (mSplitView != null && mMenuView != null) { android.animation.AnimatorSet set = new android.animation.AnimatorSet(); android.animation.ObjectAnimator splitAnim = android.animation.ObjectAnimator.ofFloat (mMenuView, "alpha", 1); splitAnim.setDuration(FADE_DURATION); set.addListener(mVisAnimListener.withFinalVisibility(visibility)); set.play(anim).with(splitAnim); set.start(); } else { anim.addListener(mVisAnimListener.withFinalVisibility(visibility)); anim.start(); } } else { android.animation.ObjectAnimator anim = android.animation.ObjectAnimator.ofFloat( this, "alpha", 0); anim.setDuration(FADE_DURATION); anim.setInterpolator(sAlphaInterpolator); if (mSplitView != null && mMenuView != null) { android.animation.AnimatorSet set = new android.animation.AnimatorSet(); android.animation.ObjectAnimator splitAnim = android.animation.ObjectAnimator.ofFloat (mMenuView, "alpha", 0); splitAnim.setDuration(FADE_DURATION); set.addListener(mVisAnimListener.withFinalVisibility(visibility)); set.play(anim).with(splitAnim); set.start(); } else { anim.addListener(mVisAnimListener.withFinalVisibility(visibility)); anim.start(); } } }
/// <summary> /// Adds an animation that interpolates given property from its current value /// to the given value. /// </summary> /// <remarks> /// Adds an animation that interpolates given property from its current value /// to the given value. /// </remarks> /// <param name="duration">the duration, in ms.</param> /// <param name="delay">the delay to start the animation, in ms.</param> /// <param name="property">the property to animate</param> /// <param name="toValue">the target value</param> /// <param name="replace">if true, replace the current animation with this one.</param> public virtual android.animation.ObjectAnimator addAnimTo(long duration, long delay , string property, float toValue, bool replace) { if (replace) { removeAnimationFor(property); } android.animation.ObjectAnimator anim = android.animation.ObjectAnimator.ofFloat( this, property, toValue); anim.setDuration(duration); anim.setStartDelay(delay); anim.setInterpolator(EASE_OUT_INTERPOLATOR); this.addAnimation(anim, replace); return(anim); }