コード例 #1
0
        private void Animator()
        {
            var paddingTop = Resources.GetDimensionPixelSize(Resource.Dimension.scroll_padding_top);

            var scrollAnimator = ViewPropertyObjectAnimator
                                 .Animate(scrollView)
                                 .ScrollY(paddingTop)
                                 .Get();

            var imageAnimator = ViewPropertyObjectAnimator
                                .Animate(imageView)
                                .VerticalMargin(140)
                                .RightMarginBy(10)
                                .Width(600)
                                .Height(700)
                                .RotationXBy(20)
                                .TopPadding(10)
                                .RotationY(360)
                                .LeftPaddingBy(100)
                                .RightPadding(300)
                                .Get();

            animatorSet?.Cancel();

            animatorSet = new AnimatorSet();
            animatorSet.PlayTogether(scrollAnimator, imageAnimator);
            animatorSet.SetDuration(2000);
            animatorSet.Start();
        }
コード例 #2
0
        private void ReverseAnimator()
        {
            var width   = Resources.GetDimensionPixelSize(Resource.Dimension.image_width);
            var height  = Resources.GetDimensionPixelSize(Resource.Dimension.image_height);
            var margin  = Resources.GetDimensionPixelSize(Resource.Dimension.image_margin);
            var padding = Resources.GetDimensionPixelSize(Resource.Dimension.image_padding);

            var scrollAnimator = ViewPropertyObjectAnimator
                                 .Animate(scrollView)
                                 .ScrollY(0)
                                 .Get();

            var imageAnimator = ViewPropertyObjectAnimator
                                .Animate(imageView)
                                .Width(width)
                                .Height(height)
                                .Margin(margin)
                                .Padding(padding)
                                .RotationX(0)
                                .RotationY(0)
                                .Get();

            animatorSet?.Cancel();

            animatorSet = new AnimatorSet();
            animatorSet.PlayTogether(scrollAnimator, imageAnimator);
            animatorSet.SetDuration(2000);
            animatorSet.Start();
        }
コード例 #3
0
ファイル: PDFViewerActivity.cs プロジェクト: TeckFreak/UniHub
        private void AnimateFAB()
        {
            if (isFabOpen)
            {
                fabMain.StartAnimation(rotateBackward);

                ViewPropertyObjectAnimator.Animate(fabAction).LeftMargin(Functions.ConvertToPixels(this, 6)).SetDuration(300).SetInterpolator(new DecelerateInterpolator()).Start();
                ViewPropertyObjectAnimator.Animate(fabShare).LeftMargin(Functions.ConvertToPixels(this, 6)).SetDuration(300).SetInterpolator(new DecelerateInterpolator()).Start();
                ViewPropertyObjectAnimator.Animate(title).LeftMargin(titleExpandSize).SetDuration(300).SetInterpolator(new DecelerateInterpolator()).Start();

                fabClose.StartOffset = 300;

                fabAction.StartAnimation(fabClose);
                fabShare.StartAnimation(fabClose);

                fabAction.Clickable = false;
                fabShare.Clickable  = false;

                isFabOpen = false;
            }
            else
            {
                fabAction.StartAnimation(fabOpen);
                fabShare.StartAnimation(fabOpen);

                ViewPropertyObjectAnimator.Animate(title).LeftMargin(titleShrinkSize).SetDuration(300).SetInterpolator(new DecelerateInterpolator()).Start();
                ViewPropertyObjectAnimator.Animate(fabAction).LeftMargin(Functions.ConvertToPixels(this, 66)).SetDuration(300).SetInterpolator(new DecelerateInterpolator()).Start();
                ViewPropertyObjectAnimator.Animate(fabShare).LeftMargin(Functions.ConvertToPixels(this, 126)).SetDuration(300).SetInterpolator(new DecelerateInterpolator()).Start();

                fabMain.StartAnimation(rotateForward);

                fabAction.Clickable = true;
                fabShare.Clickable  = true;

                isFabOpen = true;
            }
        }