Esempio n. 1
0
        public void Show(float translationX, float translationY)
        {
            // Set FAB's translation
            SetTranslation(translationX, translationY);

            // Only use scale animation if FAB is hidden
            if (Visibility != ViewStates.Visible) {
                // Pivots indicate where the animation begins from
                float pivotX = PivotX + translationX;
                float pivotY = PivotY + translationY;

                ScaleAnimation anim;
                // If pivots are 0, that means the FAB hasn't been drawn yet so just use the
                // center of the FAB
                if (pivotX == 0 || pivotY == 0) {
                    anim = new ScaleAnimation(0, 1, 0, 1, Dimension.RelativeToSelf, 0.5f,
                        Dimension.RelativeToSelf, 0.5f);
                } else {
                    anim = new ScaleAnimation(0, 1, 0, 1, pivotX, pivotY);
                }

                // Animate FAB expanding
                anim.Duration = FAB_ANIM_DURATION;
                anim.Interpolator = GetInterpolator();
                StartAnimation(anim);
            }
            Visibility = ViewStates.Visible;
        }
		public void OnLayoutClicked(View view)
		{
			if (rectBackground != null) {
				ScaleAnimation scaleAnimation = new ScaleAnimation (1, 0.7f, 1, 0.7f, Dimension.RelativeToSelf, 0.5f, Dimension.RelativeToSelf, 0.5f);
				scaleAnimation.Duration = 300;
				scaleAnimation.RepeatCount = 1;
				scaleAnimation.RepeatMode = RepeatMode.Reverse;
				rectBackground.StartAnimation (scaleAnimation);
			}
			if (roundBackground != null) {
				roundBackground.Animate ().RotationBy (360).SetDuration (300).Start ();
			}
		}
Esempio n. 3
0
        public override void Hide()
        {
            // Only use scale animation if FAB is visible
            if (Visibility == ViewStates.Visible) {
                // Pivots indicate where the animation begins from
                float pivotX = PivotX + TranslationX;
                float pivotY = PivotY + TranslationY;

                // Animate FAB shrinking
                ScaleAnimation anim = new ScaleAnimation(1, 0, 1, 0, pivotX, pivotY);
                anim.Duration = FAB_ANIM_DURATION;
                anim.Interpolator = GetInterpolator();
                StartAnimation(anim);
            }
            Visibility = ViewStates.Invisible;
        }
        private void MaximizeView(View view)
        {
            var animationSet = new AnimationSet(true)
            {
                Interpolator = new AccelerateDecelerateInterpolator(),
                Duration = 500,
                FillAfter = true
            };
            var scaleAnimation = new ScaleAnimation(1f, 1.25f, 1f, 1.25f, Dimension.RelativeToSelf, 0f,
                Dimension.RelativeToSelf, 0f);
            _selectedViewTop = view.Top;
            _selectedViewLeft = view.Left;
            var translateAnimation = new TranslateAnimation(Dimension.RelativeToSelf, 0, Dimension.Absolute, -view.Left,
                Dimension.RelativeToSelf, 0, Dimension.Absolute, -view.Top + _addButton.Height);
            animationSet.AddAnimation(scaleAnimation);
            animationSet.AddAnimation(translateAnimation);

            view.StartAnimation(animationSet);
        }