Exemple #1
0
        void SetupParallax()
        {
            var xCenterEffect = new UIInterpolatingMotionEffect("center.x",
                                                                UIInterpolatingMotionEffectType.TiltAlongHorizontalAxis)
            {
                MinimumRelativeValue = new NSNumber(-20),
                MaximumRelativeValue = new NSNumber(20)
            };

            var yCenterEffect = new UIInterpolatingMotionEffect("center.y",
                                                                UIInterpolatingMotionEffectType.TiltAlongVerticalAxis)
            {
                MinimumRelativeValue = new NSNumber(-20),
                MaximumRelativeValue = new NSNumber(20)
            };

            var effectGroup = new UIMotionEffectGroup
            {
                MotionEffects = new UIMotionEffect[] { xCenterEffect, yCenterEffect }
            };

            lblTodayYouveTaken.AddMotionEffect(effectGroup);
            lblStepCount.AddMotionEffect(effectGroup);
            lblSteps.AddMotionEffect(effectGroup);
            lblCalories.AddMotionEffect(effectGroup);
            lblDate.AddMotionEffect(effectGroup);
            lblPercentage.AddMotionEffect(effectGroup);
            btnDistance.AddMotionEffect(effectGroup);
        }
Exemple #2
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            var xCenterEffect = new UIInterpolatingMotionEffect("center.x", UIInterpolatingMotionEffectType.TiltAlongHorizontalAxis)
            {
                MinimumRelativeValue = new NSNumber(25),
                MaximumRelativeValue = new NSNumber(-25)
            };

            var yCenterEffect = new UIInterpolatingMotionEffect("center.y", UIInterpolatingMotionEffectType.TiltAlongVerticalAxis)
            {
                MinimumRelativeValue = new NSNumber(75),
                MaximumRelativeValue = new NSNumber(-75)
            };

            var skewEffect = new UIInterpolatingMotionEffect("layer.transform", UIInterpolatingMotionEffectType.TiltAlongVerticalAxis)
            {
                MinimumRelativeValue = NSObject.FromObject(Skew(-1.0f)),
                MaximumRelativeValue = NSObject.FromObject(Skew(1.0f)),
            };

            var effectGroup = new UIMotionEffectGroup {
                MotionEffects = new [] { xCenterEffect, yCenterEffect, skewEffect }
            };

            monkeyView.AddMotionEffect(effectGroup);
        }
        public override void ViewDidLoad()
        {
            base.ViewDidLoad ();

            var xCenterEffect = new UIInterpolatingMotionEffect ("center.x", UIInterpolatingMotionEffectType.TiltAlongHorizontalAxis) {
                MinimumRelativeValue = new NSNumber (25),
                MaximumRelativeValue = new NSNumber (-25)
            };

            var yCenterEffect = new UIInterpolatingMotionEffect ("center.y", UIInterpolatingMotionEffectType.TiltAlongVerticalAxis) {
                MinimumRelativeValue = new NSNumber (75),
                MaximumRelativeValue = new NSNumber (-75)
            };

            var skewEffect = new UIInterpolatingMotionEffect ("layer.transform", UIInterpolatingMotionEffectType.TiltAlongVerticalAxis) {
                MinimumRelativeValue = NSObject.FromObject (Skew (-1.0f)),
                MaximumRelativeValue = NSObject.FromObject (Skew (1.0f)),
            };

            var effectGroup = new UIMotionEffectGroup {
                MotionEffects = new []{ xCenterEffect, yCenterEffect, skewEffect }
            };

            monkeyView.AddMotionEffect (effectGroup);
        }
        public static void ApplyMotionEffects(this UIView view, float horizontalRange = 10.0f, float verticalRange = 10.0f)
        {
            if (UIDevice.CurrentDevice.CheckSystemVersion(7, 0))
            {
                UIInterpolatingMotionEffect horizontalEffect = new UIInterpolatingMotionEffect("center.x", UIInterpolatingMotionEffectType.TiltAlongHorizontalAxis);
                horizontalEffect.MinimumRelativeValue = NSNumber.FromFloat(-horizontalRange);
                horizontalEffect.MaximumRelativeValue = NSNumber.FromFloat(horizontalRange);

                UIInterpolatingMotionEffect verticalEffect = new UIInterpolatingMotionEffect("center.y", UIInterpolatingMotionEffectType.TiltAlongVerticalAxis);
                verticalEffect.MinimumRelativeValue = NSNumber.FromFloat(-verticalRange);
                verticalEffect.MaximumRelativeValue = NSNumber.FromFloat(verticalRange);

                UIMotionEffectGroup motionEffectGroup = new UIMotionEffectGroup();
                motionEffectGroup.MotionEffects = new UIMotionEffect[] { horizontalEffect, verticalEffect };

                view.AddMotionEffect(motionEffectGroup);
            }
        }
        public static void ApplyMotionEffects(this UIView view, float horizontalRange = 10.0f, float verticalRange = 10.0f)
        {
            if (UIDevice.CurrentDevice.CheckSystemVersion(7, 0))
            {
                UIInterpolatingMotionEffect horizontalEffect = new UIInterpolatingMotionEffect("center.x", UIInterpolatingMotionEffectType.TiltAlongHorizontalAxis);
                horizontalEffect.MinimumRelativeValue = NSNumber.FromFloat(-horizontalRange);
                horizontalEffect.MaximumRelativeValue = NSNumber.FromFloat(horizontalRange);

                UIInterpolatingMotionEffect verticalEffect = new UIInterpolatingMotionEffect("center.y", UIInterpolatingMotionEffectType.TiltAlongVerticalAxis);
                verticalEffect.MinimumRelativeValue = NSNumber.FromFloat(-verticalRange);
                verticalEffect.MaximumRelativeValue = NSNumber.FromFloat(verticalRange);

                UIMotionEffectGroup motionEffectGroup = new UIMotionEffectGroup();
                motionEffectGroup.MotionEffects = new UIMotionEffect[] { horizontalEffect, verticalEffect };

                view.AddMotionEffect(motionEffectGroup);
            }
        }
Exemple #6
0
        private void ApplyMotionEffect(UIView view, nfloat magnitude)
        {
            var xMotion = new UIInterpolatingMotionEffect("center.x",
                                                          UIInterpolatingMotionEffectType.TiltAlongHorizontalAxis);
            var yMotion = new UIInterpolatingMotionEffect("center.y",
                                                          UIInterpolatingMotionEffectType.TiltAlongVerticalAxis);

            xMotion.MinimumRelativeValue = FromObject(-magnitude);
            xMotion.MaximumRelativeValue = FromObject(magnitude);
            yMotion.MinimumRelativeValue = FromObject(-magnitude);
            yMotion.MaximumRelativeValue = FromObject(magnitude);

            var motionGroup = new UIMotionEffectGroup {
                MotionEffects = new UIMotionEffect[] { xMotion, yMotion }
            };

            view.AddMotionEffect(motionGroup);
        }
        public static void ApplyMotionEffects(this UIView view)
        {
            int SystemVersion = Convert.ToInt16 (UIDevice.CurrentDevice.SystemVersion.Split ('.') [0]);
            if (SystemVersion >= 7)
            {
                UIInterpolatingMotionEffect horizontalEffect = new UIInterpolatingMotionEffect("center.x", UIInterpolatingMotionEffectType.TiltAlongHorizontalAxis);
                horizontalEffect.MinimumRelativeValue = NSNumber.FromFloat(-10);
                horizontalEffect.MaximumRelativeValue = NSNumber.FromFloat(10);

                UIInterpolatingMotionEffect verticalEffect = new UIInterpolatingMotionEffect("center.6", UIInterpolatingMotionEffectType.TiltAlongVerticalAxis);
                verticalEffect.MinimumRelativeValue = NSNumber.FromFloat(-10);
                verticalEffect.MaximumRelativeValue = NSNumber.FromFloat(10);
                UIMotionEffectGroup motionEffectGroup = new UIMotionEffectGroup();
                motionEffectGroup.MotionEffects = new UIMotionEffect[] {horizontalEffect, verticalEffect};

                view.AddMotionEffect(motionEffectGroup);
            }
        }
Exemple #8
0
        void presentMenuComplete()
        {
            //TODO: Review this
            menuObserver = NSNotificationCenter.DefaultCenter.AddObserver(UIApplication.DidEnterBackgroundNotification, (_) => TransitioningDelegate.ApplicationDidEnterBackgroundNotification());

            var mainViewController = this.viewControllerForPresentedMenu;

            if (mainViewController == null)
            {
                return;
            }

            switch (SideMenuManager.PresentMode)
            {
            case SideMenuManager.MenuPresentMode.MenuSlideIn:
            case SideMenuManager.MenuPresentMode.MenuDissolveIn:
            case SideMenuManager.MenuPresentMode.ViewSlideInOut:
                if (SideMenuManager.ParallaxStrength != 0)
                {
                    var horizontal = new UIInterpolatingMotionEffect(keyPath: "center.x", type: UIInterpolatingMotionEffectType.TiltAlongHorizontalAxis);
                    horizontal.MinimumRelativeValue = NSNumber.FromInt32(-SideMenuManager.ParallaxStrength);
                    horizontal.MinimumRelativeValue = NSNumber.FromInt32(SideMenuManager.ParallaxStrength);

                    var vertical = new UIInterpolatingMotionEffect(keyPath: "center.y", type: UIInterpolatingMotionEffectType.TiltAlongVerticalAxis);
                    vertical.MinimumRelativeValue = NSNumber.FromInt32(-SideMenuManager.ParallaxStrength);
                    vertical.MaximumRelativeValue = NSNumber.FromInt32(SideMenuManager.ParallaxStrength);

                    var group = new UIMotionEffectGroup();
                    group.MotionEffects = new UIMotionEffect[] { horizontal, vertical };
                    mainViewController.View.AddMotionEffect(group);
                }
                break;

            case SideMenuManager.MenuPresentMode.ViewSlideOut:
                break;
            }

            var topNavigationController = mainViewController as UINavigationController;

            if (topNavigationController != null)
            {
                topNavigationController.InteractivePopGestureRecognizer.Enabled = false;
            }
        }
        public static UIMotionEffect SetParallaxIntensity(this UIView view, float parallaxDepth, float?verticalDepth = null)
        {
            if (UIDevice.CurrentDevice.CheckSystemVersion(7, 0))
            {
                float vertical             = verticalDepth ?? parallaxDepth;
                var   verticalMotionEffect = new UIInterpolatingMotionEffect("center.y", UIInterpolatingMotionEffectType.TiltAlongVerticalAxis);
                verticalMotionEffect.MinimumRelativeValue = new NSNumber(-vertical);
                verticalMotionEffect.MaximumRelativeValue = new NSNumber(vertical);
                var horizontalMotionEffect = new UIInterpolatingMotionEffect("center.x", UIInterpolatingMotionEffectType.TiltAlongHorizontalAxis);
                horizontalMotionEffect.MinimumRelativeValue = new NSNumber(-parallaxDepth);
                horizontalMotionEffect.MaximumRelativeValue = new NSNumber(parallaxDepth);
                var group = new UIMotionEffectGroup();
                group.MotionEffects = new UIMotionEffect[] { horizontalMotionEffect, verticalMotionEffect };
                view.AddMotionEffect(group);
                return(group);
            }

            return(null);
        }
Exemple #10
0
        public static void ApplyMotionEffects(this UIView view)
        {
            int SystemVersion = Convert.ToInt16(UIDevice.CurrentDevice.SystemVersion.Split('.') [0]);

            if (SystemVersion >= 7)
            {
                UIInterpolatingMotionEffect horizontalEffect = new UIInterpolatingMotionEffect("center.x", UIInterpolatingMotionEffectType.TiltAlongHorizontalAxis);
                horizontalEffect.MinimumRelativeValue = NSNumber.FromFloat(-10);
                horizontalEffect.MaximumRelativeValue = NSNumber.FromFloat(10);

                UIInterpolatingMotionEffect verticalEffect = new UIInterpolatingMotionEffect("center.6", UIInterpolatingMotionEffectType.TiltAlongVerticalAxis);
                verticalEffect.MinimumRelativeValue = NSNumber.FromFloat(-10);
                verticalEffect.MaximumRelativeValue = NSNumber.FromFloat(10);
                UIMotionEffectGroup motionEffectGroup = new UIMotionEffectGroup();
                motionEffectGroup.MotionEffects = new UIMotionEffect[] { horizontalEffect, verticalEffect };

                view.AddMotionEffect(motionEffectGroup);
            }
        }
Exemple #11
0
        void applyMotionEffects()
        {
            if (NSFoundationVersionNumber <= NSFoundationVersionNumber_iOS_6_1)
            {
                return;
            }

            UIInterpolatingMotionEffect horizontalEffect = new UIInterpolatingMotionEffect("center.x", UIInterpolatingMotionEffectType.TiltAlongHorizontalAxis);

            horizontalEffect.MinimumRelativeValue = new NSNumber(-kCustomIOS7MotionEffectExtent);
            horizontalEffect.MaximumRelativeValue = new NSNumber(kCustomIOS7MotionEffectExtent);

            UIInterpolatingMotionEffect verticalEffect = new UIInterpolatingMotionEffect("center.y", UIInterpolatingMotionEffectType.TiltAlongVerticalAxis);

            verticalEffect.MinimumRelativeValue = new NSNumber(-kCustomIOS7MotionEffectExtent);
            verticalEffect.MaximumRelativeValue = new NSNumber(kCustomIOS7MotionEffectExtent);

            UIMotionEffectGroup motionEffectGroup = new UIMotionEffectGroup();

            motionEffectGroup.MotionEffects = new UIMotionEffect[] { horizontalEffect, verticalEffect };

            DialogView.AddMotionEffect(motionEffectGroup);
        }
		private void ApplyMotionEffects()
		{
			var horizontalEffect = new UIInterpolatingMotionEffect ("center.x", UIInterpolatingMotionEffectType.TiltAlongHorizontalAxis) 
			{
				MinimumRelativeValue = new NSNumber (-MotionEffectExtent),
				MaximumRelativeValue = new NSNumber (MotionEffectExtent),
			};

			var verticalEffect = new UIInterpolatingMotionEffect("center.y", UIInterpolatingMotionEffectType.TiltAlongVerticalAxis)
			{
				MinimumRelativeValue = new NSNumber(-MotionEffectExtent),
				MaximumRelativeValue = new NSNumber(MotionEffectExtent),
			};

			var motionEffectGroup = new UIMotionEffectGroup();
			{
				MotionEffects = new [] { horizontalEffect, verticalEffect };
			}

			AddMotionEffect(motionEffectGroup);
		}
        void SetupParallax()
        {
            var xCenterEffect = new UIInterpolatingMotionEffect("center.x",
                UIInterpolatingMotionEffectType.TiltAlongHorizontalAxis)
                {
                    MinimumRelativeValue = new NSNumber(-20),
                    MaximumRelativeValue = new NSNumber(20)
                };

            var yCenterEffect = new UIInterpolatingMotionEffect("center.y",
                UIInterpolatingMotionEffectType.TiltAlongVerticalAxis)
                {
                    MinimumRelativeValue = new NSNumber(-20),
                    MaximumRelativeValue = new NSNumber(20)
                };

            var effectGroup = new UIMotionEffectGroup
                {
                    MotionEffects = new UIMotionEffect[] {xCenterEffect, yCenterEffect}
                };

            lblTodayYouveTaken.AddMotionEffect(effectGroup);
            lblStepCount.AddMotionEffect(effectGroup);
            lblSteps.AddMotionEffect(effectGroup);
            lblCalories.AddMotionEffect(effectGroup);
            lblDate.AddMotionEffect(effectGroup);
            lblPercentage.AddMotionEffect(effectGroup);
            btnDistance.AddMotionEffect(effectGroup);
        }
        // Motion Effects Methods
        private void AddMotionEffectsToSnapshotView()
        {
            NSNumber positiveValue = new NSNumber(12);
            NSNumber negativeValue = new NSNumber (-12);

            UIInterpolatingMotionEffect verticalEffect;
            verticalEffect = new UIInterpolatingMotionEffect ("center.y", UIInterpolatingMotionEffectType.TiltAlongVerticalAxis);
            verticalEffect.MinimumRelativeValue = positiveValue;
            verticalEffect.MaximumRelativeValue = negativeValue;

            UIInterpolatingMotionEffect horizontalEffect;
            horizontalEffect = new UIInterpolatingMotionEffect ("center.x", UIInterpolatingMotionEffectType.TiltAlongHorizontalAxis);
            horizontalEffect.MinimumRelativeValue = positiveValue;
            horizontalEffect.MaximumRelativeValue = negativeValue;

            UIMotionEffectGroup effectGroup = new UIMotionEffectGroup ();
            effectGroup.MotionEffects = new UIMotionEffect[] { verticalEffect, horizontalEffect };
            SnapshotView.AddMotionEffect (effectGroup);
        }