public static void AnimateFAB(Java.Lang.Object animationTarget) { Android.Animation.ObjectAnimator animacion = Android.Animation.ObjectAnimator.OfFloat(animationTarget, "scaleX", 0f, 1f); animacion.SetDuration(510); animacion.Start(); Android.Animation.ObjectAnimator animacion2 = Android.Animation.ObjectAnimator.OfFloat(animationTarget, "scaleY", 0f, 1f); animacion2.SetDuration(510); animacion2.Start(); }
public void animar7(Java.Lang.Object imagen) { Android.Animation.ObjectAnimator animacion = Android.Animation.ObjectAnimator.OfFloat(imagen, "translationY", 0, 1000); animacion.SetDuration(500); animacion.Start(); animacion.AnimationEnd += delegate { layoutmenues.Visibility = ViewStates.Invisible; }; }
public void animar3(View imagen) { imagen.SetLayerType(LayerType.Hardware, null); Android.Animation.ObjectAnimator animacion = Android.Animation.ObjectAnimator.OfFloat(imagen, "alpha", 0f, 1f); animacion.SetDuration(220); animacion.Start(); animacion.AnimationEnd += delegate { imagen.SetLayerType(LayerType.None, null); }; //Your adapter views to re-use //public TextView Title { get; set; } }
/** * Animate enter toolbarlayout * * @param yOffset */ private void AnimateEnterToolbarLayout() { if (!FollowScrollToolbarIsVisible && _headerAnimator != null) { ObjectAnimator objectAnimator = _headerAnimator as ObjectAnimator; if (objectAnimator != null) { objectAnimator.Cancel(); } else { Android.Animation.ObjectAnimator androidObjectAnimator = _headerAnimator as Android.Animation.ObjectAnimator; if (androidObjectAnimator != null) { androidObjectAnimator.Cancel(); } } _headerAnimator = null; } if (_headerAnimator == null) { if (Build.VERSION.SdkInt > BuildVersionCodes.GingerbreadMr1) { _headerAnimator = Android.Animation.ObjectAnimator.OfFloat(_mHeader.ToolbarLayout, "translationY", 0).SetDuration(_enterToolbarAnimationDuration); Android.Animation.ObjectAnimator animator = (Android.Animation.ObjectAnimator)_headerAnimator; animator.AnimationEnd += (sender, args) => { FollowScrollToolbarIsVisible = true; FirstScrollValue = float.MinValue; JustToolbarAnimated = true; }; animator.Start(); } else { _headerAnimator = ObjectAnimator.OfFloat(_mHeader.ToolbarLayout, "translationY", 0).SetDuration(_enterToolbarAnimationDuration); ObjectAnimator animator = (ObjectAnimator)_headerAnimator; animator.AddListener(new AnimatorListener(this)); animator.Start(); } } }
public static void ScaleXAnimation(Java.Lang.Object imagen) { Android.Animation.ObjectAnimator animacion = Android.Animation.ObjectAnimator.OfFloat(imagen, "scaleX", 0.5f, 1f); animacion.SetDuration(700); animacion.Start(); }
/** * Called when a scroller(RecyclerView/ListView,ScrollView,WebView) scrolled by the user * * @param source the scroller * @param yOffset the scroller current yOffset */ public bool OnMaterialScrolled(Object source, float yOffset) { if (_initialDistance == -1 || _initialDistance == 0) { _initialDistance = _mHeader.MPagerSlidingTabStrip.Top - _mHeader.Toolbar.Bottom; } //only if yOffset changed if (yOffset == LastYOffset) { return(false); } float scrollTop = -yOffset; { //parallax scroll of the Background ImageView (the KenBurnsView) if (_mHeader.HeaderBackground != null) { if (Settings.ParallaxHeaderFactor != 0) { ViewHelper.SetTranslationY(_mHeader.HeaderBackground, scrollTop / Settings.ParallaxHeaderFactor); } if (ViewHelper.GetY(_mHeader.HeaderBackground) >= 0) { ViewHelper.SetY(_mHeader.HeaderBackground, 0); } } } if (EnableLog) { Log.Debug("yOffset", "" + yOffset); } //dispatch the new offset to all registered scrollables DispatchScrollOffset(source, Utils.MinMax(0, yOffset, ScrollMaxDp)); //distance between pager & toolbar float newDistance = ViewHelper.GetY(_mHeader.MPagerSlidingTabStrip) - _mHeader.Toolbar.Bottom; float percent = 1 - newDistance / _initialDistance; if (float.IsNaN(percent)) //fix for orientation change { return(false); } percent = Utils.MinMax(0, percent, 1); { if (!Settings.ToolbarTransparent) { // change color of toolbar & viewpager indicator & statusBaground SetColorPercent(percent); } else { if (JustToolbarAnimated) { if (ToolbarJoinsTabs()) { SetColorPercent(1); } else if (LastPercent != percent) { AnimateColorPercent(0, 200); } } } LastPercent = percent; //save the percent if (_mHeader.MPagerSlidingTabStrip != null) { //move the viewpager indicator //float newY = ViewHelper.getY(mHeader.mPagerSlidingTabStrip) + scrollTop; if (EnableLog) { Log.Debug(_tag, "" + scrollTop); } //mHeader.mPagerSlidingTabStrip.setTranslationY(mHeader.getToolbar().getBottom()-mHeader.mPagerSlidingTabStrip.getY()); if (scrollTop <= 0) { ViewHelper.SetTranslationY(_mHeader.MPagerSlidingTabStrip, scrollTop); ViewHelper.SetTranslationY(_mHeader.ToolbarLayoutBackground, scrollTop); //when if (ViewHelper.GetY(_mHeader.MPagerSlidingTabStrip) < _mHeader.GetToolbar().Bottom) { float ty = _mHeader.GetToolbar().Bottom - _mHeader.MPagerSlidingTabStrip.Top; ViewHelper.SetTranslationY(_mHeader.MPagerSlidingTabStrip, ty); ViewHelper.SetTranslationY(_mHeader.ToolbarLayoutBackground, ty); } } } if (_mHeader.MLogo != null) { //move the header logo to toolbar if (Settings.HideLogoWithFade) { ViewHelper.SetAlpha(_mHeader.MLogo, 1 - percent); ViewHelper.SetTranslationY(_mHeader.MLogo, (_mHeader.FinalTitleY - _mHeader.OriginalTitleY) * percent); } else { ViewHelper.SetTranslationY(_mHeader.MLogo, (_mHeader.FinalTitleY - _mHeader.OriginalTitleY) * percent); ViewHelper.SetTranslationX(_mHeader.MLogo, (_mHeader.FinalTitleX - _mHeader.OriginalTitleX) * percent); float scale = (1 - percent) * (1 - _mHeader.FinalScale) + _mHeader.FinalScale; Utils.SetScale(scale, _mHeader.MLogo); } } if (Settings.HideToolbarAndTitle && _mHeader.ToolbarLayout != null) { bool scrollUp = LastYOffset < yOffset; if (scrollUp) { ScrollUp(yOffset); } else { ScrollDown(yOffset); } } } if (_headerAnimator != null && percent < 1) { ObjectAnimator objectAnimator = _headerAnimator as ObjectAnimator; if (objectAnimator != null) { objectAnimator.Cancel(); } else { Android.Animation.ObjectAnimator androidAnimator = _headerAnimator as Android.Animation.ObjectAnimator; if (androidAnimator != null) { androidAnimator.Cancel(); } } _headerAnimator = null; } LastYOffset = yOffset; return(true); }