Exemplo n.º 1
0
        public ViewPropertyAnimator GetDroidAnimation(IPageAnimation animation, UIParams uiParams, Action onEndHandler, bool isPop)
        {
            var animatorListener = new GenericAnimatorListener();

            if (onEndHandler != null)
            {
                animatorListener.OnEnd = animatorListener.OnCancel = a => onEndHandler();
            }
            var anim = pageContainer.Animate().Alpha(uiParams.Alpha).SetDuration(GetDuration(animation.Duration)).
                       ScaleX(uiParams.ScaleX).ScaleY(uiParams.ScaleY).
                       Rotation(uiParams.RotationZ).RotationX(uiParams.RotationX).RotationY(uiParams.RotationY).
                       TranslationX(uiParams.TranslationX).TranslationY(uiParams.TranslationY).
                       SetListener(animatorListener);

            if (animation.BounceEffect)
            {
                anim.SetInterpolator(isPop ? _accelerateInterpolator : _bounceInterpolator);
            }
            return(anim);
        }