internal void UpdateDetailLabelWithString(string newString, bool animated, Action completion)
        {
            var length            = animated ? AnimationLength : 0.0f;
            var labelWidth        = 15;      //padding
            var attribs           = new UIStringAttributes();
            var nsVersionOfString = new NSString(newString);

            if (!IsLessThanIOS6)
            {
                attribs.Font = DetailLabelFont;
                labelWidth  += (int)nsVersionOfString.GetSizeUsingAttributes(attribs).Width;
            }
            else
            {
                labelWidth += (int)nsVersionOfString.StringSize(DetailLabelFont).Width;
            }

            CATransition animation = new CATransition();

            animation.TimingFunction = CAMediaTimingFunction.FromName(CAMediaTimingFunction.EaseInEaseOut);
            animation.Type           = CATransition.TransitionFade;
            animation.Duration       = length;
            DetailLabel.Layer.AddAnimation(animation, "kCATransitionFade");
            DetailLabel.Text = newString;
            var pinSelectionTop = EnterPasscodeLabel.Frame.Y + EnterPasscodeLabel.Frame.Size.Height + 17.5;

            DetailLabel.Frame = new RectangleF((CorrectWidth / 2) - 100,
                                               (float)pinSelectionTop + 30f, 200, 23);
        }
Esempio n. 2
0
        void OnElementPropertyChanging(object sender, PropertyChangingEventArgs e)
        {
            if (e.PropertyName == Image.SourceProperty.PropertyName)
            {
                var transition = new CATransition
                {
                    TimingFunction = CAMediaTimingFunction.FromName(CAMediaTimingFunction.EaseInEaseOut),
                    Duration       = ((double)ImageSwitcher.TransitionDuration) / 1000
                };

                switch (ImageSwitcher.TransitionType)
                {
                case TransitionType.Fade:
                    transition.Type = CAAnimation.TransitionFade;
                    break;

                case TransitionType.MoveInFromLeft:
                    transition.Type    = CAAnimation.TransitionMoveIn;
                    transition.Subtype = CAAnimation.TransitionFromLeft;
                    break;
                }

                Layer.AddAnimation(transition, transition.Type);
            }
        }
Esempio n. 3
0
        public void NavigateToDetail(UIViewController vc, MXTouchAnimation direction)
        {
            CATransition transition = new CATransition();

            transition.Duration = 0.5;
            transition.Type     = CATransition.TransitionMoveIn;
            if (direction == MXTouchAnimation.Left)
            {
                transition.Subtype = CATransition.TransitionFromRight;
            }
            else
            {
                transition.Subtype = CATransition.TransitionFromLeft;
            }

            if (_splitViewController != null)
            {
                // ipad -- set pane, we just change out the panes depending on the master
                _detailNavigationController.PopViewControllerAnimated(false);

                _detailNavigationController.View.Layer.AddAnimation(transition, CALayer.Transition);
                _detailNavigationController.PushViewController(vc, false);

                _splitViewControllerDelegate.ReplaceDetailNavigationViewController();
                _splitViewControllerDelegate.HidePopover();
            }
            else
            {
                _masterNavigationController.PopViewControllerAnimated(false);

                _masterNavigationController.View.Layer.AddAnimation(transition, CALayer.Transition);
                _masterNavigationController.PushViewController(vc, false);
            }
        }
Esempio n. 4
0
        public static void ShowPanel(string title, UIView view, Action <Dictionary <string, object> > editingEndedBlock)
        {
            MKEntryPanel panel = GetPanel();

            panel.closeBlock                 = editingEndedBlock;
            panel.titleLabel.Text            = title;
            panel.titleLabel.BackgroundColor = UIColor.Clear;
            panel.entryField.Font            = UIFont.FromName("DINPro-Medium", 16);
            panel.entryField.LeftView        = new UIView(new RectangleF(0, 0, 5, 31));
            panel.entryField.LeftViewMode    = UITextFieldViewMode.Always;
            panel.entryField.Background      = CashflowTheme.SharedTheme.TextBackground.CreateResizableImage(new UIEdgeInsets(5, 10, 5, 10));
            panel.valueField.Font            = UIFont.FromName("DINPro-Medium", 16);
            panel.valueField.RightView       = new UIView(new RectangleF(0, 0, 5, 31));
            panel.valueField.RightViewMode   = UITextFieldViewMode.Always;
            panel.valueField.Background      = CashflowTheme.SharedTheme.TextBackground.CreateResizableImage(new UIEdgeInsets(5, 10, 5, 10));
            panel.valueField.TextAlignment   = UITextAlignment.Right;
            panel.entryField.BecomeFirstResponder();

            panel.dimView = new UIControl(UIScreen.MainScreen.Bounds);
            CATransition transition = CATransition.CreateAnimation();

            transition.Duration       = kAnimationDuration;
            transition.TimingFunction = CAMediaTimingFunction.FromName(CAMediaTimingFunction.EaseInEaseOut);
            transition.Type           = CATransition.TransitionFade.ToString();
            panel.dimView.Layer.AddAnimation(transition, null);
            panel.dimView.BackgroundColor = UIColor.Black;
            panel.dimView.Alpha           = 0.8f;
            panel.dimView.TouchDown      += (sender, e) => panel.CancelTapped();
            view.AddSubview(panel.dimView);
            view.AddSubview(panel);
        }
		void PerformTransition (object sender, EventArgs e)
		{
			if (transitioning)
				return;

			// First create a CATransition object to describe the transition
			var transition = new CATransition ();

			// Animate over 3/4 of a second
			transition.Duration = 0.75;

			// using the ease in/out timing function
			transition.TimingFunction = CAMediaTimingFunction.FromName (CAMediaTimingFunction.EaseInEaseOut);

			// Now to set the type of transition
			int rnd = random.Next (types.Length);
			transition.Type = types[rnd].ToString ();
			if (rnd < 3) // no fade transition -> randomly choose a subtype
				transition.Subtype = supTypes[random.Next (supTypes.Length)].ToString ();

			// Assign a delegate that sets transitioning to false, after the animation stopped.
			this.transitioning = true;
			transition.Delegate = new AnimationDelegate (this);

			// Now add the animation to the image view layer. This will perform the transiton.
			imageView.Layer.AddAnimation (transition, null);

			// Now hide view 1 & show view 2 that causes Core Animation to animate view1 away and show view2
			view1.Hidden = true;
			view2.Hidden = false;

			// Now cycle through the views
			Swap (ref view1, ref view2);
			Swap (ref view2, ref view3);
		}
Esempio n. 6
0
        void HidePanel()
        {
            entryField.ResignFirstResponder();
            CATransition transition = CATransition.CreateAnimation();

            transition.Duration       = kAnimationDuration;
            transition.TimingFunction = CAMediaTimingFunction.FromName(CAMediaTimingFunction.EaseInEaseOut);
            transition.Type           = CATransition.TransitionPush.ToString();
            transition.Subtype        = CATransition.TransitionFromTop.ToString();
            Layer.AddAnimation(transition, null);
            Frame = new RectangleF(0, (float)-Frame.Height, 320, (float)Frame.Height);

            transition                = CATransition.CreateAnimation();
            transition.Duration       = kAnimationDuration;
            transition.TimingFunction = CAMediaTimingFunction.FromName(CAMediaTimingFunction.EaseInEaseOut);
            transition.Type           = CATransition.TransitionFade.ToString();
            dimView.Alpha             = 0;
            dimView.Layer.AddAnimation(transition, null);

            NSTimer.CreateScheduledTimer(0.40,
                                                                                                #if __UNIFIED__
                                         timer
                                                                                                #else
                                             ()
                                                                                                #endif
                                         =>
            {
                dimView.RemoveFromSuperview();
            }
Esempio n. 7
0
        private static void RunCAAnimation(UIView view, IPageAnimation animation, bool isPop)
        {
            var transition = CATransition.CreateAnimation();

            transition.Duration       = GetDuration(animation.Duration);
            transition.TimingFunction = CAMediaTimingFunction.FromName(CAMediaTimingFunction.EaseOut);
            SetCAAnimationType(transition, animation, isPop);
            view.Layer.AddAnimation(transition, null);
        }
Esempio n. 8
0
        public override void Show(MvxViewModelRequest request)
        {
            if (request.PresentationValues != null)
            {
                var viewCreator = GetViewCreator();

                // More info at:
                // - http://gregshackles.com/presenters-in-mvvmcross-using-presentation-values/
                // - https://gist.github.com/gshackles/5735595
                if (request.PresentationValues.ContainsKey(PresentationBundleFlagKeys.CLEAR_STACK))
                {
                    var nextViewController = (UIViewController)viewCreator.CreateView(request);

                    if (MasterNavigationController.TopViewController.GetType() != nextViewController.GetType())
                    {
                        MasterNavigationController.PopToRootViewController(false);
                        MasterNavigationController.PushViewController(nextViewController, false);
                    }

                    return;
                }
                else if (request.PresentationValues.ContainsKey(PresentationBundleFlagKeys.MAKE_IT_THE_FIRST_ONE))
                {
                    MasterNavigationController.SetViewControllers(new UIViewController[] { }, false);
                }
                else if (request.PresentationValues.ContainsKey(PresentationBundleFlagKeys.BACK_OR_IN_PLACE))
                {
                    var nextViewController     = (UIViewController)viewCreator.CreateView(request);
                    var existingViewController =
                        MasterNavigationController.ViewControllers.FirstOrDefault(
                            vc => vc.GetType() == nextViewController.GetType() && vc != CurrentTopViewController);

                    if (existingViewController != null)
                    {
                        MasterNavigationController.PopToViewController(existingViewController, true);
                    }
                    else
                    {
                        var transition = new CATransition
                        {
                            Duration = 0.3,
                            Type     = CAAnimation.TransitionPush,
                            Subtype  = CAAnimation.TransitionFade
                        };

                        MasterNavigationController.PopViewController(false);
                        MasterNavigationController.View.Layer.AddAnimation(transition, null);
                        MasterNavigationController.PushViewController(nextViewController, false);
                    }

                    return;
                }
            }

            base.Show(request);
        }
        public override UIViewController PopViewController(bool animated)
        {
            var transition = CATransition.CreateAnimation();

            transition.Duration = 0.1f;
            transition.Type     = CAAnimation.TransitionPush;
            transition.Subtype  = CAAnimation.TransitionFromLeft;
            View.Layer.AddAnimation(transition, null);
            return(base.PopViewController(false));
        }
        public override void PushViewController(UIViewController viewController, bool animated)
        {
            var transition = CATransition.CreateAnimation();

            transition.Duration = 0.1f;
            transition.Type     = CAAnimation.TransitionPush;
            transition.Subtype  = CAAnimation.TransitionFromRight;
            View.Layer.AddAnimation(transition, null);
            base.PushViewController(viewController, false);
        }
        private void CreateAnimation(NSString type, NSString direction)
        {
            CATransition transition = CATransition.CreateAnimation();

            transition.Duration       = 0.5;
            transition.TimingFunction = CAMediaTimingFunction.FromName(CAMediaTimingFunction.EaseInEaseOut);
            transition.Type           = type;
            transition.Subtype        = direction;
            View.Layer.AddAnimation(transition, null);
        }
Esempio n. 12
0
        public static void Fade(CALayer layer)
        {
            var transition = new CATransition {
                Duration = 0.250,
                Type     = "kCATransitionFade",
                Subtype  = "kCATransitionFromTop"
            };

            layer.AddAnimation(transition, "kCATransition");
        }
Esempio n. 13
0
        private void AddAnimation()
        {
            var transition = new CATransition
            {
                Duration = 0.3,
                Type     = CAAnimation.TransitionMoveIn,
                Subtype  = CAAnimation.TransitionFromRight
            };

            _window.RootViewController.View.Layer.AddAnimation(transition, null);
        }
Esempio n. 14
0
        public override void PushViewController(UIViewController viewController, bool animated)
        {
            if (_transitionType == TransitionType.None)
            {
                base.PushViewController(viewController, false);
                return;
            }
            else if (_transitionType == TransitionType.Default)
            {
                base.PushViewController(viewController, animated);
                return;
            }
            else if (_transitionType == TransitionType.Fade)
            {
                FadeAnimation(View);
            }
            else if (_transitionType == TransitionType.Flip)
            {
                FlipAnimation(View);
            }
            else if (_transitionType == TransitionType.Scale)
            {
                ScaleAnimation(View);
            }
            else
            {
                var transition = CATransition.CreateAnimation();
                transition.Duration = 0.5f;
                transition.Type     = CAAnimation.TransitionPush;

                switch (_transitionType)
                {
                case TransitionType.SlideFromBottom:
                    transition.Subtype = CAAnimation.TransitionFromBottom;
                    break;

                case TransitionType.SlideFromLeft:
                    transition.Subtype = CAAnimation.TransitionFromLeft;
                    break;

                case TransitionType.SlideFromRight:
                    transition.Subtype = CAAnimation.TransitionFromRight;
                    break;

                case TransitionType.SlideFromTop:
                    transition.Subtype = CAAnimation.TransitionFromTop;
                    break;
                }

                View.Layer.AddAnimation(transition, null);
            }

            base.PushViewController(viewController, false);
        }
Esempio n. 15
0
        public static CATransition FadeTransitionWithDuration(float duration)
        {
            unsafe
            {
                float  m      = duration;
                IntPtr intPtr = _FadeTransitionWithDuration(*(IntPtr *)&m);

                CATransition t = (CATransition)Runtime.GetNSObject(intPtr);
                return(t);
            }
        }
 public override void PushViewController(UIViewController viewController, bool animated)
 {
     if (animated)
     {
         var transition = CATransition.CreateAnimation();
         transition.Duration = 0.3;
         transition.Type     = CATransition.TransitionFade;
         transition.Subtype  = CATransition.TransitionFromTop;
         View.Layer.AddAnimation(transition, CALayer.Transition);
     }
     base.PushViewController(viewController, false);
 }
        public override UIViewController PopViewController(bool animated)
        {
            if (animated)
            {
                if (_transitionType == TransitionType.Fade)
                {
                    FadeAnimation(View);
                }
                else if (_transitionType == TransitionType.Flip)
                {
                    FlipAnimation(View);
                }
                else if (_transitionType == TransitionType.Scale)
                {
                    ScaleAnimation(View);
                }
                else
                {
                    var transition = CATransition.CreateAnimation();
                    transition.Duration = 0.5f;
                    transition.Type     = CAAnimation.TransitionPush;

                    switch (_transitionType)
                    {
                    case TransitionType.SlideFromBottom:
                        transition.Subtype = CAAnimation.TransitionFromTop;
                        break;

                    case TransitionType.SlideFromLeft:
                        transition.Subtype = CAAnimation.TransitionFromRight;
                        break;

                    case TransitionType.SlideFromRight:
                        transition.Subtype = CAAnimation.TransitionFromLeft;
                        break;

                    case TransitionType.SlideFromTop:
                        transition.Subtype = CAAnimation.TransitionFromBottom;
                        break;
                    }

                    View.Layer.AddAnimation(transition, null);
                }

                return(base.PopViewController(false));
            }
            else
            {
                return(base.PopViewController(false));
            }
        }
Esempio n. 18
0
        // minimum method to override for a custom segue.
        public override void Perform()
        {
            Console.WriteLine("MySegue:Perform()");

            // code courtesy of [email protected]
            var transition = CATransition.CreateAnimation();

            transition.Duration = 0.25f;
            transition.Type     = CATransition.TransitionPush;
            transition.Subtype  = CATransition.TransitionFromRight;

            SourceViewController.View.Window.Layer.AddAnimation(transition, null);
            SourceViewController.PresentViewController(DestinationViewController, false, null);
        }
Esempio n. 19
0
        static MKEntryPanel GetPanel()
        {
            MKEntryPanel panel = new MKEntryPanel();

            CATransition transition = CATransition.CreateAnimation();

            transition.Duration       = kAnimationDuration;
            transition.TimingFunction = CAMediaTimingFunction.FromName(CAMediaTimingFunction.EaseInEaseOut);
            transition.Type           = CATransition.TransitionPush.ToString();
            transition.Subtype        = CATransition.TransitionFromBottom.ToString();
            panel.Layer.AddAnimation(transition, null);

            return(panel);
        }
        public static CATransition Transition(MaterialAnimationTransition type, MaterialAnimationTransitionSubType?direction = null, double?duration = null)
        {
            var animation = new CATransition();

            animation.Type = Convert.MaterialAnimationTransitionToValue(type);
            if (direction != null)
            {
                animation.Subtype = Convert.MaterialAnimationTransitionSubTypeToValue(direction.Value);
            }
            if (duration != null)
            {
                animation.Duration = duration.Value;
            }
            return(animation);
        }
        private void UpdateHeading()
        {
            var animation = new CATransition();

            animation.TimingFunction = CAMediaTimingFunction.FromName(CAMediaTimingFunction.EaseOut);
            animation.Type           = "kCATransitionPush";
            animation.Subtype        = "kCATransitionFromBottom";
            animation.Duration       = 0.35f;

            TitleLabel.Layer.AddAnimation(animation, "kCATransitionFade");
            var filterMode = CameraController.CameraViewType == IPDFCameraViewType.BlackAndWhite ?
                             "Text Filter" : "Color Filter";

            TitleLabel.Text = string.Concat(filterMode, " ", CameraController.EnableBorderDetection == true ? "Auto Crop On" : "Auto Crop Off");
        }
		void FnPerformTableTransition()
		{
			tableViewLeftMenu.Hidden = !tableViewLeftMenu.Hidden;
			var transition = new CATransition ();
			transition.Duration = 0.25f;
			transition.Type = CAAnimation.TransitionPush;
			if ( tableViewLeftMenu.Hidden )
			{
				transition.TimingFunction = CAMediaTimingFunction.FromName ( new Foundation.NSString ("easeOut") );
				transition.Subtype = CAAnimation.TransitionFromRight;
			}
			else
			{
				transition.TimingFunction = CAMediaTimingFunction.FromName ( new Foundation.NSString ("easeIn") );
				transition.Subtype = CAAnimation.TransitionFromLeft;
			}
			tableViewLeftMenu.Layer.AddAnimation ( transition , null );
		}
        private void UpdateSwitchStyle()
        {
            if (Element == null)
            {
                return;
            }

            // Setting UISwitch.ThumbTintColor seems to stop the sliding animation of the thumb control, so I am adding some transitioning animation to smooth it a little.
            var transition = new CATransition();

            transition.Type     = (Element.IsToggled) ? CATransition.TransitionFromLeft : CATransition.TransitionFromRight;
            transition.Duration = 0.5;
            Control.Layer.AddAnimation(transition, null);

            Control.TintColor      = (Element.IsEnabled) ? CustomColors.BlueButtonColor.ToUIColor() : Color.LightGray.ToUIColor();
            Control.OnTintColor    = (Element.IsEnabled) ? CustomColors.BlueButtonColor.ToUIColor() : Color.LightGray.ToUIColor();
            Control.ThumbTintColor = (Element.IsToggled) ? UIColor.White : (Element.IsEnabled) ? CustomColors.BlueButtonColor.ToUIColor() : Color.LightGray.ToUIColor();
        }
Esempio n. 24
0
        partial void handleTap(UITapGestureRecognizer tapGestureRecognizer)
        {
            if (!(tapGestureRecognizer.View is UIImageView))
            {
                return;
            }

            var keyImageView = (UIImageView)tapGestureRecognizer.View;
            int keyIndex     = keyImageViews.IndexOf(keyImageView);

            if (keyIndex < 0)
            {
                return;
            }

            currentBank [keyIndex]++;
            if (currentBank [keyIndex] == maxNumberOfBanks)
            {
                currentBank [keyIndex] = 0;
            }

            if (currentBank [keyIndex] == 0)
            {
                keyImageView.Image = machineReadableCodeFromMessage(mainBank [keyIndex]);
            }
            else if (currentBank [keyIndex] == 1)
            {
                keyImageView.Image = machineReadableCodeFromMessage(altBank [keyIndex]);
            }
            else if (currentBank [keyIndex] == 2)
            {
                keyImageView.Image = null;
            }

            CATransaction.Begin();
            var transition = CATransition.CreateAnimation();

            transition.Duration       = 0.3f;
            transition.TimingFunction = CAMediaTimingFunction.FromName(CAMediaTimingFunction.Linear);
            transition.Type           = CATransition.TransitionReveal;
            transition.Subtype        = CATransition.TransitionFromBottom;
            keyImageView.Layer.AddAnimation(transition, null);
            CATransaction.Commit();
        }
        void FnPerformTableTransition()
        {
            leftmenu.Hidden = !leftmenu.Hidden;
            var transition = new CATransition();

            transition.Duration = 0.25f;
            transition.Type     = CAAnimation.TransitionPush;
            if (leftmenu.Hidden)
            {
                transition.TimingFunction = CAMediaTimingFunction.FromName(new Foundation.NSString("easeOut"));
                transition.Subtype        = CAAnimation.TransitionFromRight;
            }
            else
            {
                transition.TimingFunction = CAMediaTimingFunction.FromName(new Foundation.NSString("easeIn"));
                transition.Subtype        = CAAnimation.TransitionFromLeft;
            }
            leftmenu.Layer.AddAnimation(transition, null);
        }
Esempio n. 26
0
        double showItem(UIImageView img)
        {
            double       Alltime    = 0.0;
            CATransition transition = new CATransition();

            transition.Duration = 0.5f;

            transition.TimingFunction = CAMediaTimingFunction.FromName(
                CAMediaTimingFunction.EaseInEaseOut);
            transition.Type = CATransition.TransitionFade;

            img.Highlighted = false;
            img.Layer.AddAnimation(transition, null);
            img.Highlighted = true;
            img.Alpha       = 1.0f;


            nint        key   = img.Tag;
            List <Pair> items = myDictionary[key];

            if (items.Count > 0)
            {
                float localTime = 0.25f;

                //NSNumber * value2 = [[NSNumber alloc] initWithInt:0 ];
                //NSNumber * value3 = [[NSNumber alloc] initWithFloat:localTime ];

                NSTimer timer = NSTimer.CreateScheduledTimer(localTime, (t) => {
                    showTextItem(t, items, 0);
                });
                //NSTimer timer =  [NSTimer scheduledTimerWithTimeInterval:[value3 floatValue] target:self selector:@selector(showTextItem:) userInfo:[NSDictionary dictionaryWithObjectsAndKeys:items, @"value1", value2, @"value2",  value3, @"value3", nil]  repeats:NO];
                //[_timerTextColecction addObject:timer];
            }

            for (int i = 0; i < items.Count; i++)
            {
                Pair   pair = items[i];
                UIView item = pair.view;

                Alltime = (item.Frame.Size.Width * item.Frame.Size.Width) * TEXT_TIME + 0.70;
            }
            return(Alltime);
        }
Esempio n. 27
0
        private static void SetCAAnimationType(CATransition transition, IPageAnimation animation, bool isPop)
        {
            switch (animation.Type)
            {
            case AnimationType.Fade:
                transition.Type = CAAnimation.TransitionFade;
                break;

            case AnimationType.Push:
                transition.Type    = CAAnimation.TransitionPush;
                transition.Subtype = GetCATransitionSubtype(animation.Subtype, isPop);
                break;

            case AnimationType.Slide:
                transition.Type    = isPop ? CAAnimation.TransitionReveal : CAAnimation.TransitionMoveIn;
                transition.Subtype = GetCATransitionSubtype(animation.Subtype, isPop);
                break;
            }
        }
        public override void PushViewController(UIViewController viewController, bool animated)
        {
            var transistionType = TransitionNavigationPage.TransitionType;

            if (transistionType == TransitionType.None || transistionType == TransitionType.Default)
            {
                var needanimation = transistionType == TransitionType.None ? false : animated;
                base.PushViewController(viewController, needanimation);
                return;
            }
            else if (transistionType == TransitionType.Fade)
            {
                FadeAnimation(View);
            }
            else
            {
                var transition = CATransition.CreateAnimation();
                transition.Duration = 0.25f;
                transition.Type     = CAAnimation.TransitionPush;
                switch (transistionType)
                {
                case TransitionType.SlideFromBottom:
                    transition.Subtype = CAAnimation.TransitionFromBottom;
                    break;

                case TransitionType.SlideFromLeft:
                    transition.Subtype = CAAnimation.TransitionFromLeft;
                    break;

                case TransitionType.SlideFromRight:
                    transition.Subtype = CAAnimation.TransitionFromRight;
                    break;

                case TransitionType.SlideFromTop:
                    transition.Subtype = CAAnimation.TransitionFromTop;
                    break;
                }

                View.Layer.AddAnimation(transition, null);
            }

            base.PushViewController(viewController, false);
        }
Esempio n. 29
0
 public void dismissVC(bool animation = true)
 {
     if (!animation)
     {
         CATransition transition = new CATransition();
         transition.Duration       = 0.3;
         transition.TimingFunction = CAMediaTimingFunction.FromName(CAMediaTimingFunction.EaseInEaseOut);
         transition.Type           = CATransition.TransitionPush;
         transition.Subtype        = CATransition.TransitionFromRight;
         this.View.Window.Layer.AddAnimation(transition, null);
     }
     if (this.NavigationController != null)
     {
         this.NavigationController.PopViewController(animation);
     }
     else
     {
         this.DismissViewController(animation, null);
     }
 }
Esempio n. 30
0
        void PerformTableTransition()
        {
            menuTableView.Hidden = !menuTableView.Hidden;
            //transition effect
            var transition = new CATransition();

            transition.Duration = 0.25f;
            transition.Type     = CAAnimation.TransitionPush;
            if (menuTableView.Hidden)
            {
                transition.TimingFunction = CAMediaTimingFunction.FromName(new NSString("easeOut"));
                transition.Subtype        = CAAnimation.TransitionFromRight;
            }
            else
            {
                transition.TimingFunction = CAMediaTimingFunction.FromName(new NSString("easeIn"));
                transition.Subtype        = CAAnimation.TransitionFromLeft;
            }
            menuTableView.Layer.AddAnimation(transition, null);
        }
Esempio n. 31
0
        private void PerformTableTransition()
        {
            tableViewLeftMenu.Hidden = !tableViewLeftMenu.Hidden;
            var transition = new CATransition
            {
                Duration = 0.25f,
                Type     = CAAnimation.TransitionPush
            };

            if (tableViewLeftMenu.Hidden)
            {
                transition.TimingFunction = CAMediaTimingFunction.FromName(new Foundation.NSString("easeOut"));
                transition.Subtype        = CAAnimation.TransitionFromRight;
            }
            else
            {
                transition.TimingFunction = CAMediaTimingFunction.FromName(new Foundation.NSString("easeIn"));
                transition.Subtype        = CAAnimation.TransitionFromLeft;
            }
            tableViewLeftMenu.Layer.AddAnimation(transition, null);
        }
Esempio n. 32
0
        void FnPerformTableTransition()
        {
            Console.WriteLine("N0rf3n - ViewController - FnPerformTableTransition - Begin");
            tableViewMenu.Hidden = !tableViewMenu.Hidden;
            var transition = new CATransition();

            transition.Duration = 0.25f;
            transition.Type     = CAAnimation.TransitionPush;
            if (tableViewMenu.Hidden)
            {
                transition.TimingFunction = CAMediaTimingFunction.FromName(new Foundation.NSString("easeOut"));
                transition.Subtype        = CAAnimation.TransitionFromRight;
            }
            else
            {
                transition.TimingFunction = CAMediaTimingFunction.FromName(new Foundation.NSString("easeIn"));
                transition.Subtype        = CAAnimation.TransitionFromLeft;
            }
            tableViewMenu.Layer.AddAnimation(transition, null);
            Console.WriteLine("N0rf3n - ViewController - FnPerformTableTransition - End");
        }
        private void TodaysStepCountChanged(nint stepCount)
        {
            //Setup Animation
            var stepCountAnimation = new CATransition ();
            stepCountAnimation.Duration = 0.7f;
            stepCountAnimation.Type = "kCATransitionFade";
            stepCountAnimation.TimingFunction = CAMediaTimingFunction.FromName (CAMediaTimingFunction.EaseInEaseOut);

            lblStepCount.Layer.AddAnimation(stepCountAnimation, "changeTextTransition");
            lblStepCount.Text = stepCount.ToString();

            var percentageCountAnimation = new CATransition ();
            percentageCountAnimation.Duration = 0.7f;
            percentageCountAnimation.Type = "kCATransitionFade";
            percentageCountAnimation.TimingFunction = CAMediaTimingFunction.FromName (CAMediaTimingFunction.EaseInEaseOut);
            lblPercentage.Layer.AddAnimation(percentageCountAnimation, "changeTextTransition");

            if (stepCount == 0)
            {
                lblCalories.Text = "";
            }
            else
            {
                lblCalories.Text = Conversion.CaloriesBurnt(Conversion.StepsToMiles(stepCount)) + " Calories";
            }

            //Percentage Complete Label
            if (stepCount <= 10000)
            {
                lblPercentage.Text = Conversion.StepCountToPercentage(stepCount) + "% Complete";
            }
            else
            {
                lblPercentage.Text = "Completed";
            }

            //Date
            lblDate.Text = DateString;

            //Distance
            if (Settings.DistanceIsMetric == false)
            {
                btnDistance.SetTitle(Conversion.StepsToMiles(stepCount).ToString("N2") + " mi", UIControlState.Normal);
            }
            else
            {
                btnDistance.SetTitle(Conversion.StepsToKilometers(stepCount).ToString("N2") + " km",
                    UIControlState.Normal);
            }

            //Update progress filler view
            _progressView.SetStepCount(stepCount);
            if (stepCount <= 10000)
            {
                AnimateToPercentage(Conversion.StepCountToPercentage(stepCount));
            }
            else
            {
                 AnimateToPercentage(100); //I want to show something...
            }
        }
        void nextImage()
        {
            if (Images.Count == 0 || currentIndex >= Images.Count && !ShouldLoop)
            {
                if (Finished != null)
                    Finished(this, EventArgs.Empty);
                return;
            }
            if (currentIndex >= Images.Count)
                currentIndex = 0;

            UIImage image = Images[currentIndex];
            currentIndex++;
            if (image == null)
                if (image == null || image.Size == Size.Empty)
                    return;
            float resizeRatio = -1;
            float widthDiff = -1;
            float heightDiff = -1;
            float originX = -1;
            float originY = -1;
            float zoomInX = -1;
            float zoomInY = -1;
            float moveX = -1;
            float moveY = -1;
            float frameWidth = IsLandscape ? Bounds.Width : Bounds.Height;
            float frameHeight = IsLandscape ? Bounds.Height : Bounds.Width;

            // Wider than screen
            float imageWidth = image.Size.Width == 0 ? 100 : image.Size.Width;
            float imageHeight = image.Size.Height == 0 ? 100 : image.Size.Height;

            if (imageWidth > frameWidth)
            {
                widthDiff = imageWidth - frameWidth;

                // Higher than screen
                if (imageHeight > frameHeight)
                {
                    heightDiff = imageHeight - frameHeight;

                    if (widthDiff > heightDiff)
                        resizeRatio = frameHeight / imageHeight;
                    else
                        resizeRatio = frameWidth / imageWidth;

                    // No higher than screen [OK]
                }
                else
                {
                    heightDiff = frameHeight - imageHeight;

                    if (widthDiff > heightDiff)
                        resizeRatio = frameWidth / imageWidth;
                    else
                        resizeRatio = Bounds.Height / imageHeight;
                }

                // No wider than screen
            }
            else
            {
                widthDiff = frameWidth - imageWidth;

                // Higher than screen [OK]
                if (imageHeight > frameHeight)
                {
                    heightDiff = imageHeight - frameHeight;

                    if (widthDiff > heightDiff)
                        resizeRatio = imageHeight / frameHeight;
                    else
                        resizeRatio = frameWidth / imageWidth;

                    // No higher than screen [OK]
                }
                else
                {
                    heightDiff = frameHeight - imageHeight;

                    if (widthDiff > heightDiff)
                        resizeRatio = frameWidth / imageWidth;
                    else
                        resizeRatio = frameHeight / imageHeight;
                }
            }

            // Resize the image.
            var optimusWidth = (imageWidth * resizeRatio) * enlargeRatio;
            var optimusHeight = (imageHeight * resizeRatio) * enlargeRatio;
            var imageView = new UIView
                {
                    Frame = new RectangleF(0, 0, optimusWidth, optimusHeight),
                    BackgroundColor = UIColor.Clear,
                };

            float maxMoveX = Math.Min(optimusWidth - frameWidth, 50f);
            float maxMoveY = Math.Min(optimusHeight - frameHeight, 50f) * 2 / 3;

            float rotation = (random.Next(9)) / 100;

            switch (random.Next(3))
            {
                case 0:
                    originX = 0;
                    originY = 0;
                    zoomInX = 1.25f;
                    zoomInY = 1.25f;
                    moveX = -maxMoveX;
                    moveY = -maxMoveY;
                    break;

                case 1:
                    originX = 0;
                    originY = 0;// Math.Max(frameHeight - (optimusHeight),frameHeight * 1/3);
                    zoomInX = 1.1f;
                    zoomInY = 1.1f;
                    moveX = -maxMoveX;
                    moveY = maxMoveY;
                    break;

                case 2:
                    originX = frameWidth - optimusWidth;
                    originY = 0;
                    zoomInX = 1.3f;
                    zoomInY = 1.3f;
                    moveX = maxMoveX;
                    moveY = -maxMoveY;
                    break;

                default:
                    originX = frameWidth - optimusWidth;
                    originY = 0;//Math.Max(frameHeight - (optimusHeight),frameHeight * 1/3);
                    zoomInX = 1.2f;
                    zoomInY = 1.2f;
                    moveX = maxMoveX;
                    moveY = maxMoveY;
                    break;
            }

            var picLayer = new CALayer
                {
                    Contents = image.CGImage,
                    AnchorPoint = PointF.Empty,
                    Bounds = imageView.Bounds,
                    Position = new PointF(originX, originY)
                };
            imageView.Layer.AddSublayer(picLayer);

            var animation = new CATransition
                {
                    Duration = 1,
                    Type = CAAnimation.TransitionFade,
                };
            Layer.AddAnimation(animation, null);

            Views.Enqueue(imageView);
            while (Views.Count > imageBuffer)
            {
                Views.Dequeue().RemoveFromSuperview();
            }
            AddSubview(imageView);

            Animate(ImageDuration + 2, 0, UIViewAnimationOptions.CurveEaseIn, () =>
                {
                    CGAffineTransform t = CGAffineTransform.MakeRotation(rotation);
                    t.Translate(moveX, moveY);
                    t.Scale(zoomInX, zoomInY);
                    imageView.Transform = t;
                }, null);

            if (ImageIndexChanged != null)
                ImageIndexChanged(currentIndex);
        }
Esempio n. 35
0
        public void NavigateToDetail(UIViewController vc, MXTouchAnimation direction)
        {
            CATransition transition = new CATransition();

            transition.Duration = 0.5;
            transition.Type = CATransition.TransitionMoveIn;
            if (direction == MXTouchAnimation.Left)
                transition.Subtype = CATransition.TransitionFromRight;
            else
                transition.Subtype = CATransition.TransitionFromLeft;

            if (_splitViewController != null)
            {
                // ipad -- set pane, we just change out the panes depending on the master
                _detailNavigationController.PopViewControllerAnimated(false);

                _detailNavigationController.View.Layer.AddAnimation(transition, CALayer.Transition);
                _detailNavigationController.PushViewController(vc, false);

                _splitViewControllerDelegate.ReplaceDetailNavigationViewController();
                _splitViewControllerDelegate.HidePopover();
            }
            else
            {
                _masterNavigationController.PopViewControllerAnimated(false);

                _masterNavigationController.View.Layer.AddAnimation(transition, CALayer.Transition);
                _masterNavigationController.PushViewController(vc, false);
            }
        }
		private void AnimateToolbar()
		{
			var transition = new CATransition();
			transition.Duration = 0.50;
			transition.Type = CATransition.TransitionMoveIn;
			transition.Subtype = CATransition.TransitionFromTop;
			transition.TimingFunction = CAMediaTimingFunction.FromName(CAMediaTimingFunction.EaseInEaseOut.ToString());

			this.toolbarFakeMessage.Layer.AddAnimation(transition, null);
			this.toolbarFakeMessage.Hidden = false;
		}
Esempio n. 37
0
        private Task<bool?> AnimateSetupForSecondEntry()
        {
			var tcs = new TaskCompletionSource<bool?> ();

            ResetPinBoxes();

            var transition = new CATransition
                                 {
                                     Type = CAAnimation.TransitionPush,
                                     Subtype = CAAnimation.TransitionFromRight,
                                     Duration = 0.5,
                                     TimingFunction = CAMediaTimingFunction.FromName(CAMediaTimingFunction.EaseInEaseOut),
                                     RemovedOnCompletion = true
                                 };
			transition.AnimationStopped += (s,e) => {
				_passcode = null;
				_fakeField.Text = null;

				if(IsIPhone)
					_fakeField.BecomeFirstResponder();
				tcs.SetResult(null);
			};
            
			View.ExchangeSubview(0, 1);
            animationView.Layer.AddAnimation(transition, "swipe");

			return tcs.Task;
        }
Esempio n. 38
0
 public static void RemoveView (UIView turbineGameUI)
 {
     UIApplication.SharedApplication.InvokeOnMainThread(delegate {
         
         //                
         CATransition transition = new CATransition();//[CATransition animation];
         transition.Duration = 1.0;
         transition.Type = CATransition.TransitionFade; //choose your animation
         _gameViewController.View.Layer.AddAnimation(transition,null);//[newView.layer addAnimation:transition forKey:nil];
         turbineGameUI.RemoveFromSuperview();
         
     });
 }
Esempio n. 39
0
        public static void FlipWithDuration(this UIView view, double duration, UIViewAnimationFlipDirection direction, int repeatCount, bool shouldAutoReverse)
        {
            var subType = string.Empty;
            switch (direction)
            {
                case UIViewAnimationFlipDirection.Top:
                    subType = "fromTop";
                    break;
                case UIViewAnimationFlipDirection.Left:
                    subType = "fromLeft";
                    break;
                case UIViewAnimationFlipDirection.Bottom:
                    subType = "fromBottom";
                    break;
                case UIViewAnimationFlipDirection.Right:
                    subType = "fromRight";
                    break;
                default:
                    break;
            }

            CATransition transition = new CATransition();
            transition.StartProgress = 0;
            transition.EndProgress = 1;
            transition.Type = "flip";
            transition.Subtype = subType;
            transition.Duration = duration;
            transition.RepeatCount = repeatCount;
            transition.AutoReverses = shouldAutoReverse;

            view.Layer.AddAnimation(transition, "spin");
        }
Esempio n. 40
0
		public Task<string> AnimateForAnotherEntry()
		{
			var tcs = new TaskCompletionSource<string> ();

			ResetPinBoxes();

			var transition = new CATransition
			{
				Type = CAAnimation.TransitionPush,
				Subtype = CAAnimation.TransitionFromRight,
				Duration = 0.5,
				TimingFunction = CAMediaTimingFunction.FromName(CAMediaTimingFunction.EaseInEaseOut),
				RemovedOnCompletion = true
			};
			transition.AnimationStopped += (s, e) => {
				_passcode = null;
				_fakeField.Text = null;

				if(IsIPhone)
					_fakeField.BecomeFirstResponder();

				_passwordEntryFinished = tcs;
			};
			View.ExchangeSubview(0, 1);
			animationView.Layer.AddAnimation(transition, "swipe");

			return tcs.Task;
		}
Esempio n. 41
0
        public static void RemoveView (UIView turbineGameUI)
        {
            UIApplication.SharedApplication.InvokeOnMainThread(delegate {

                CATransition transition = new CATransition();
                transition.Duration = 0.5;
                transition.Type = CATransition.TransitionFade; //choose your animation
                _gameViewController.View.Layer.AddAnimation(transition,null);
                turbineGameUI.RemoveFromSuperview();

            });
        }
Esempio n. 42
0
        public static void AddSubview (UIView aView,CATransition animationTransition=null)
        {
            UIApplication.SharedApplication.InvokeOnMainThread(delegate {

                CATransition transition;
                if(animationTransition ==null)
                {
                    transition = new CATransition();//[CATransition animation];
                    transition.Duration = 1.0;
                    transition.Type = CATransition.TransitionFade; //choose your animation
                    transition.TimingFunction=CAMediaTimingFunction.FromName(CAMediaTimingFunction.EaseIn);
                }
                else
                {
                    transition=animationTransition;
                }

                _gameViewController.View.Layer.AddAnimation(transition,null);
                _gameViewController.View.Add(aView);

            });
        }