Example #1
0
 private void animateBackgroundColor(UIColor color)
 {
     AnimationExtensions.Animate(
         Animation.Timings.EnterTiming,
         Animation.Curves.EaseIn,
         () => BackgroundColor = color
         );
 }
 internal void AnimatePlayButton()
 {
     AnimationExtensions.Animate(
         Animation.Timings.EnterTiming,
         Animation.Curves.EaseOut,
         () => StartTimeEntryButton.Transform = CGAffineTransform.MakeScale(1f, 1f)
         );
 }
Example #3
0
        /// <summary>
        /// Handles the <see cref="E:Loaded" /> event.
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">The <see cref="RoutedEventArgs" /> instance containing the event data.</param>
        /// <remarks>...</remarks>
        private void OnLoaded(object sender, RoutedEventArgs e)
        {
            this.UserBadgeControl.Reload();
            AnimationExtensions.Animate(this.Header, OpacityProperty, 250, 1);

            LoadToolbars();

            Api.Logger.LogInformation("STARTED screen.");
        }
Example #4
0
 public static Action <UIColor> AnimatedBackgroundColor(this IReactive <UIView> reactive) =>
 color =>
 {
     AnimationExtensions.Animate(
         Animation.Timings.EnterTiming,
         Animation.Curves.SharpCurve,
         () => reactive.Base.BackgroundColor = color
         );
 };
Example #5
0
 public static Action <nfloat> ConstantAnimated(this IReactive <NSLayoutConstraint> reactive)
 => constant =>
 {
     reactive.Base.Constant = constant;
     AnimationExtensions.Animate(
         Animation.Timings.EnterTiming,
         Animation.Curves.SharpCurve,
         () => ((UIView)reactive.Base.FirstItem).Superview.LayoutIfNeeded());
 };
Example #6
0
 internal void HideCalendar()
 {
     TopCalendarConstraint.Constant = calendarHeight;
     AnimationExtensions.Animate(
         Animation.Timings.EnterTiming,
         Animation.Curves.SharpCurve,
         () => View.LayoutSubviews(),
         () => CalendarIsVisible = false);
 }
Example #7
0
 protected override void SetValue(nfloat value)
 {
     Target.Constant = value;
     AnimationExtensions.Animate(
         Animation.Timings.EnterTiming,
         Animation.Curves.SharpCurve,
         () => ((UIView)Target.FirstItem).Superview.LayoutSubviews()
         );
 }
Example #8
0
 internal void ShowCalendar()
 {
     TopCalendarConstraint.Constant = 0;
     AnimationExtensions.Animate(
         Animation.Timings.EnterTiming,
         Animation.Curves.SharpCurve,
         () => View.LayoutSubviews(),
         () => CalendarIsVisible = true);
 }
Example #9
0
 public static Action <float> AnimatedAlpha(this IReactive <UIView> reactive)
 => alpha =>
 {
     AnimationExtensions.Animate(
         Animation.Timings.EnterTiming,
         Animation.Curves.SharpCurve,
         () => reactive.Base.Alpha = alpha
         );
 };
 private void CloseEditPanel()
 {
     overlay.DataContext = null;
     overlay.Visibility  = Visibility.Collapsed;
     if (AnimationExtensions.IsBlurSupported)
     {
         AnimationExtensions.Blur(mapView, 0).Start();
     }
 }
Example #11
0
 internal void AbortAnimations(TouchEff sender)
 {
     _animationTokenSource?.Cancel();
     var control = sender.Control;
     if (control == null)
     {
         return;
     }
     ViewExtensions.CancelAnimations(control);
     AnimationExtensions.AbortAnimation(control, ChangeBackgroundColorAnimationName);
 }
Example #12
0
        /// <summary>
        /// Removes the icon.
        /// </summary>
        /// <param name="iconUI">The icon UI.</param>
        /// <remarks>...</remarks>
        internal void RemoveProcessIconUI(FrameworkElement iconUI)
        {
            // Remove from list.
            if (iconUI != null)
            {
                AnimationExtensions.Animate(iconUI, OpacityProperty, 700, 0, 0.1, 0.9);

                ThreadingExtensions.LazyInvokeThreadSafe(() => {
                    ProcessesContainer.Children.Remove(iconUI);
                }, 600);
            }
        }
Example #13
0
        public void AnimateVertically_WhenYEqualsYRequest_DoesNothing()
        {
            //arrange
            SquareView      squareView      = new SquareView();
            double          startTopMargin  = squareView.Margin.Top;
            SquareViewModel squareViewModel = new SquareViewModel(0, 0, 2);

            //act
            AnimationExtensions.AnimateVertically(squareView, squareViewModel);
            //assert
            Assert.That(squareView.Margin.Top == startTopMargin);
        }
Example #14
0
        public void AnimateHorizontally_WhenXEqualsXRequest_DoesNothing()
        {
            //arrange
            SquareView      squareView      = new SquareView();
            double          startLeftMargin = squareView.Margin.Left;
            SquareViewModel squareViewModel = new SquareViewModel(0, 0, 2);

            //act
            AnimationExtensions.AnimateHorizontally(squareView, squareViewModel);
            //assert
            Assert.That(squareView.Margin.Left == startLeftMargin);
        }
Example #15
0
 public static Action <bool> IsVisibleWithFade(this IReactive <UIView> reactive)
 => isVisible =>
 {
     var alpha = isVisible ? 1 : 0;
     AnimationExtensions.Animate(
         Animation.Timings.EnterTiming,
         Animation.Curves.EaseIn,
         () =>
     {
         reactive.Base.Alpha = alpha;
     });
 };
Example #16
0
        protected override void SetValue(bool value)
        {
            Target.Transform = CGAffineTransform.MakeTranslation(0, 20);

            AnimationExtensions.Animate(
                Animation.Timings.EnterTiming,
                Animation.Curves.SharpCurve,
                () =>
            {
                Target.Hidden    = !value;
                Target.Transform = CGAffineTransform.MakeTranslation(0, 0);
            }
                );
        }
        private void ShowEditPanel(ArcGISFeature feature)
        {
            overlay.DataContext = feature;
            overlay.Visibility  = Visibility.Visible;

            if (AnimationExtensions.IsBlurSupported)
            {
                AnimationExtensions.Blur(mapView, 10).Start();
            }
            else
            {
                overlay.Background = new SolidColorBrush(Windows.UI.Color.FromArgb(192, 255, 255, 255));
            }
        }
        public void AnimateTransition(IUIViewControllerContextTransitioning transitionContext)
        {
            var toController      = transitionContext.GetViewControllerForKey(UITransitionContext.ToViewControllerKey);
            var fromController    = transitionContext.GetViewControllerForKey(UITransitionContext.FromViewControllerKey);
            var animationDuration = TransitionDuration(transitionContext);

            if (presenting)
            {
                transitionContext.ContainerView.AddSubview(toController.View);

                var finalFrame = transitionContext.GetFinalFrameForViewController(toController);

                var frame = new CGRect(finalFrame.Location, finalFrame.Size);
                frame.Offset(0.0f, transitionContext.ContainerView.Frame.Height - 20);
                toController.View.Frame = frame;
                toController.View.Alpha = 0.5f;

                AnimationExtensions.Animate(animationDuration, Curves.CardInCurve, () =>
                {
                    toController.View.Frame = finalFrame;
                    toController.View.Alpha = 1.0f;
                },
                                            () => transitionContext.CompleteTransition(!transitionContext.TransitionWasCancelled));
            }
            else
            {
                var initialFrame = transitionContext.GetInitialFrameForViewController(fromController);
                initialFrame.Offset(0.0f, transitionContext.ContainerView.Frame.Height);
                var finalFrame = initialFrame;

                if (transitionContext.IsInteractive)
                {
                    UIView.Animate(
                        animationDuration,
                        () => fromController.View.Frame = finalFrame,
                        () => transitionContext.CompleteTransition(!transitionContext.TransitionWasCancelled)
                        );
                }
                else
                {
                    AnimationExtensions.Animate(animationDuration, Curves.CardOutCurve, () =>
                    {
                        fromController.View.Frame = finalFrame;
                        fromController.View.Alpha = 0.5f;
                    },
                                                () => transitionContext.CompleteTransition(!transitionContext.TransitionWasCancelled));
                }
            }
        }
 protected override void SetValue(bool value)
 {
     AnimationExtensions.Animate(
         Animation.Timings.EnterTiming,
         Animation.Curves.SharpCurve,
         () =>
     {
         // This slight color change is needed for the fade animation to work.
         // Animating only the Enabled property has no effect.
         // Blame Apple.
         Target.TintColor = UIColor.White.ColorWithAlpha(value ? 1.0f : 0.99f);
         Target.Enabled   = value;
     }
         );
 }
Example #20
0
        public static Action <bool> AnimatedIsVisible(this IReactive <UIView> reactive)
        => isVisible =>
        {
            reactive.Base.Transform = CGAffineTransform.MakeTranslation(0, 20);

            AnimationExtensions.Animate(
                Animation.Timings.EnterTiming,
                Animation.Curves.SharpCurve,
                () =>
            {
                reactive.Base.Hidden    = !isVisible;
                reactive.Base.Transform = CGAffineTransform.MakeTranslation(0, 0);
            }
                );
        };
Example #21
0
        private void showTimeEntryCard()
        {
            StopTimeEntryButton.Hidden  = false;
            CurrentTimeEntryCard.Hidden = false;

            AnimationExtensions.Animate(Timings.EnterTiming, showCardDelay, Curves.EaseOut,
                                        () => StartTimeEntryButton.Transform = CGAffineTransform.MakeScale(0.01f, 0.01f),
                                        () =>
            {
                AnimationExtensions.Animate(Timings.LeaveTimingFaster, Curves.EaseIn,
                                            () => StopTimeEntryButton.Transform = CGAffineTransform.MakeScale(1.0f, 1.0f));

                AnimationExtensions.Animate(Timings.LeaveTiming, Curves.CardOutCurve,
                                            () => CurrentTimeEntryCard.Transform = CGAffineTransform.MakeTranslation(0, 0));
            });
        }
Example #22
0
        protected override void SetValue(bool value)
        {
            var alpha = value ? 1 : 0;

            Task.Delay(1).ContinueWith(_ =>
            {
                UIApplication.SharedApplication.InvokeOnMainThread(() =>
                {
                    AnimationExtensions.Animate(
                        Animation.Timings.EnterTiming,
                        Animation.Curves.EaseIn,
                        () => Target.Alpha = alpha
                        );
                });
            });
        }
Example #23
0
        private void hideTimeEntryCard()
        {
            AnimationExtensions.Animate(Timings.LeaveTimingFaster, Curves.EaseIn,
                                        () => StopTimeEntryButton.Transform = CGAffineTransform.MakeScale(0.01f, 0.01f),
                                        () => StopTimeEntryButton.Hidden    = true);

            AnimationExtensions.Animate(Timings.LeaveTiming, Curves.CardOutCurve,
                                        () => CurrentTimeEntryCard.Transform = CGAffineTransform.MakeTranslation(0, CurrentTimeEntryCard.Frame.Height),
                                        () =>
            {
                CurrentTimeEntryCard.Hidden = true;

                AnimationExtensions.Animate(Timings.EnterTiming, Curves.EaseOut,
                                            () => StartTimeEntryButton.Transform = CGAffineTransform.MakeScale(1f, 1f)
                                            );
            });
        }
        private void OnKeyboardNotification(NSNotification notification)
        {
            var visible = notification.Name == UIKeyboard.WillShowNotification;

            keyboardHeight = visible
                ? UIKeyboard.FrameEndFromNotification(notification).Height
                : 0.0;

            if (finishedPresenting && ContainerView != null && PresentedViewController.PresentedViewController == null)
            {
                var animationDuration = UIKeyboard.AnimationDurationFromNotification(notification);
                AnimationExtensions.Animate(animationDuration, Animation.Curves.StandardEase, ContainerViewWillLayoutSubviews);
            }
            else if (PresentingViewController == null)
            {
                ContainerView?.SetNeedsLayout();
            }
        }
Example #25
0
        public IContinuation <bool> SizeTo(double width, double height, uint length = 250, Func <double, double> easing = null)
        {
            if (easing == null)
            {
                easing = Easing.Linear;
            }

            Continuation <bool> result = new Continuation <bool> ();

            var wInterp = AnimationExtensions.Interpolate(Width, width);
            var hInterp = AnimationExtensions.Interpolate(Height, height);

            new Animation()
            .Insert(0, 1, new Animation(f => SetSize(wInterp(f), hInterp(f)), 0, 1, easing))
            .Commit(this, "SizeTo", 16, length, finished: (f, a) => {
                result.Invoke(a);
            });

            return(result);
        }
Example #26
0
        private void IntroPage_Closed(object sender, EventArgs e)
        {
            mInfo.IsVisible = true;
            var animation = new Animation(v => mAddCareDayButton.Scale = v, 1, 1.2);

            animation.Commit(mAddCareDayButton, "SimpleAnimation", 16, 1000, Easing.Linear, (v, c) => mAddCareDayButton.Scale = 1, () => true);


            var aTimer = new System.Timers.Timer(10000);

            aTimer.Elapsed += (s, ev) =>
            {
                Device.BeginInvokeOnMainThread(() => {
                    var animation1 = new Animation(v => mInfo.Scale = v, 1, 0.0);
                    animation1.Commit(this, "SimpleAnimation1", 16, 1000, Easing.Linear, (v, c) => { mInfo.Scale = 0; mInfo.IsVisible = false; }, () => false);
                    AnimationExtensions.AbortAnimation(mAddCareDayButton, "SimpleAnimation");
                });
            };
            aTimer.Enabled = true;
        }
Example #27
0
        /// <summary>
        /// Animate toggle
        /// </summary>
        private void OnIsToggledChanged(bool toggled, bool isEllipseAnimationEnabled = true)
        {
            if (_ignoreIsToggledEventHandling)
            {
                return;
            }

            _ignoreIsToggledEventHandling = true;
            IsToggled = toggled;
            _ignoreIsToggledEventHandling = false;

            AnimationExtensions.AbortAnimation(this, _animationName);

            if (IsToggled)
            {
                HandleGroupIsToggledChanged(IsToggled);
            }

            double start = _toggledAnimationProcessWithoutEasing;
            double end   = 1;

            if (toggled == false)
            {
                start = _toggledAnimationProcessWithoutEasing;
                end   = 0;
            }

            Animation anim = new Animation(d =>
            {
                _toggledAnimationProcess = AnimationEasing.Ease(d);
                _toggledAnimationProcessWithoutEasing = d;

                if (isEllipseAnimationEnabled)
                {
                    _ellipseAnimationProcess = d;
                }
                _skiaCanvas.InvalidateSurface();
            }, start, end);

            anim.Commit(this, _animationName, 64, (uint)AnimationDuration, Easing.Linear);
        }
Example #28
0
        /// <summary>
        /// Handles the <see cref="E:Loaded" /> event.
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">The <see cref="RoutedEventArgs" /> instance containing the event data.</param>
        /// <remarks>...</remarks>
        private void OnLoaded(object sender, RoutedEventArgs e)
        {
            Focus();
            Activate();

            AnimationExtensions.Animate(this, OpacityProperty, 250, 1, 0.8, 0.2);
            AnimationExtensions.Animate(this, LeftProperty, 250, 2 * Left, Left, 0.9, 0.1);

            var index = 1;

            foreach (var hWnd in hWnds)
            {
                try {
                    var text  = WinAPI.GetText(hWnd);
                    var dwmtc = new DWMThumbnailControl(this)
                    {
                        ToolTip = text,
                        Width   = Width - 50,
                        Height  = Height - 50,
                        Source  = hWnd
                    };

                    ThumbnailsContainer.Children.Add(dwmtc);
                    TextTitle.Text = text;

                    if (hWnds.Count > 1 && index > 1)
                    {
                        Width = Width + dwmtc.Width;
                    }
                    else
                    {
                        Width++;
                        Width--;
                    }

                    index++;
                }
                catch /* Eat */ { }
            }
        }
Example #29
0
        private void hideTimeEntryCard()
        {
            cardAnimationCancellation?.Cancel();
            cardAnimationCancellation = new CancellationTokenSource();

            AnimationExtensions.Animate(Timings.LeaveTimingFaster, Curves.EaseIn,
                                        () => StopTimeEntryButton.Transform = CGAffineTransform.MakeScale(0.01f, 0.01f),
                                        () => StopTimeEntryButton.Hidden    = true,
                                        cancellationToken: cardAnimationCancellation.Token);

            AnimationExtensions.Animate(Timings.LeaveTiming, Curves.CardOutCurve,
                                        () => CurrentTimeEntryCard.Transform = CGAffineTransform.MakeTranslation(0, CurrentTimeEntryCard.Frame.Height),
                                        () =>
            {
                CurrentTimeEntryCard.Hidden = true;

                AnimationExtensions.Animate(Timings.EnterTiming, Curves.EaseOut,
                                            () => StartTimeEntryButton.Transform = CGAffineTransform.MakeScale(1f, 1f),
                                            cancellationToken: cardAnimationCancellation.Token);
            },
                                        cancellationToken: cardAnimationCancellation.Token);
        }
        private void AnimateItemPosition(TileViewItem item, Point targetPosition)
        {
            if (item.PositionAnimating)
            {
                return;
            }
            Point  currentItemPosition = GetCurrentItemPosition(item);
            double num  = targetPosition.X - currentItemPosition.X;
            double num2 = targetPosition.Y - currentItemPosition.Y;

            if (Equals(MaximizedItem, item))
            {
                int currentZIndex = TileViewItem.CurrentZIndex;
                TileViewItem.CurrentZIndex = currentZIndex + 1;
                Canvas.SetZIndex(item, currentZIndex);
            }
            double totalSeconds = ReorderingDuration.TimeSpan.TotalSeconds;
            var    args         = new double[4];

            args[1] = -num;
            args[2] = totalSeconds;
            var numArray2 = new double[4];

            numArray2[1] = -num2;
            numArray2[2] = totalSeconds;
            Storyboard sb =
                AnimationExtensions.Create().Animate(new FrameworkElement[] { item }).EnsureDefaultTransforms().MoveX(
                    args).MoveY(numArray2).Origin(0.0, 0.0).EaseAll((ReorderingEasing ?? Easings.SlideDown1)).
                AdjustSpeed().Instance;

            sb.Completed += (sender, e) =>
            {
                sb.Stop();
                item.PositionAnimating = false;
            };
            SetItemPosition(item, targetPosition);
            item.PositionAnimating = true;
            sb.Begin();
        }