コード例 #1
0
        private void LaunchKineticScroll(double bottomViewPanDelta)
        {
            // Don't kinetic scroll if it isn't desired
            if (!ShouldKineticScroll)
            {
                return;
            }

            // Don't kinetic scroll if the finger barely moved
            if (Math.Abs(bottomViewPanDelta) < PanThreshold)
            {
                return;
            }

            _bottomView.AbortAnimation(KineticScrollAnimationName);
            _bottomViewContainer.AnimateKinetic(KineticScrollAnimationName, (d, d1) =>
            {
                DebugWriteLine($"Kinetic: d={d}   d1={d1}");
                // _bottomViewContainer.ScrollToAsync(0, _bottomViewContainer.ScrollY + (Math.Sign(-d) * d1), false);
                var handled = HandlePan(PanSource.KineticScroll, Math.Sign(d) * d1).GetAwaiter().GetResult();

                // Returning true means "keep going"
                return(handled);
            }, bottomViewPanDelta, KineticScrollDragCoefficient, OnKineticScrollingCompleted);
        }
コード例 #2
0
    public static void CancelColorAnimations(View view)
    {
        if (view == null)
        {
            throw new ArgumentNullException(nameof(view));
        }

        view.AbortAnimation(ColorToHandle);
    }
コード例 #3
0
        private async void FadeControl(bool toBecomeVisible)
        {
            View.AbortAnimation("FadeTo");
            if (toBecomeVisible)
            {
                View.IsVisible = true;
                View.Opacity   = 0.0;
                var isCancelled = await View.FadeTo(1.0, AnimationHelper.ControlFadeInDurationInMs);

                System.Diagnostics.Debug.WriteLine($"Did fadein cancel: {isCancelled}");
            }
            else
            {
                var isCancelled = await View.FadeTo(0.0, AnimationHelper.ControlFadeOutDurationInMs);

                System.Diagnostics.Debug.WriteLine($"Did fadeout cancel: {isCancelled}");
                View.IsVisible = false;
            }
        }
コード例 #4
0
 public void Cancel() => View.AbortAnimation(animationName);