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); }
private void AddContentViewControllerMotionEffects() { if (IsParallaxEnabled && IsIOS7) { if (_contentViewController.View.MotionEffects != null) { foreach (var me in _contentViewController.View.MotionEffects) { _contentViewController.View.RemoveMotionEffect(me); } } UIView.Animate(0.2, () => { var interpolationHorizontal = new UIInterpolatingMotionEffect("center.x", UIInterpolatingMotionEffectType.TiltAlongHorizontalAxis); interpolationHorizontal.MinimumRelativeValue = new NSNumber(ParallaxContentMinimumRelativeValue); interpolationHorizontal.MaximumRelativeValue = new NSNumber(ParallaxContentMaximumRelativeValue); var interpolationVertical = new UIInterpolatingMotionEffect("center.y", UIInterpolatingMotionEffectType.TiltAlongVerticalAxis); interpolationVertical.MinimumRelativeValue = new NSNumber(ParallaxContentMinimumRelativeValue); interpolationVertical.MaximumRelativeValue = new NSNumber(ParallaxContentMaximumRelativeValue); _contentViewController.View.AddMotionEffect(interpolationHorizontal); _contentViewController.View.AddMotionEffect(interpolationVertical); }); } }
void AddContentViewControllerMotionEffects() { if (_parallaxEnabled) { if (_ios7) { if (_contentViewContainer.MotionEffects != null) { foreach (UIMotionEffect effect in _contentViewContainer.MotionEffects) { _contentViewContainer.RemoveMotionEffect(effect); } } UIView.Animate(0.2, () => { UIInterpolatingMotionEffect interpolationHorizontal = new UIInterpolatingMotionEffect("center.x", UIInterpolatingMotionEffectType.TiltAlongHorizontalAxis); interpolationHorizontal.MinimumRelativeValue = NSObject.FromObject(_parallaxContentMinimumRelativeValue); interpolationHorizontal.MaximumRelativeValue = NSObject.FromObject(_parallaxContentMaximumRelativeValue); UIInterpolatingMotionEffect interpolationVertical = new UIInterpolatingMotionEffect("center.y", UIInterpolatingMotionEffectType.TiltAlongVerticalAxis); interpolationVertical.MinimumRelativeValue = NSObject.FromObject(_parallaxContentMinimumRelativeValue); interpolationVertical.MaximumRelativeValue = NSObject.FromObject(_parallaxContentMaximumRelativeValue); _contentViewContainer.AddMotionEffect(interpolationHorizontal); _contentViewContainer.AddMotionEffect(interpolationVertical); }); } } }
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); }
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); }
public override void ViewWillAppear(bool animated) { base.ViewWillAppear(animated); var mx = new UIInterpolatingMotionEffect("center.x", UIInterpolatingMotionEffectType.TiltAlongHorizontalAxis) { MinimumRelativeValue = new NSNumber(-15), MaximumRelativeValue = new NSNumber(15) }; var my = new UIInterpolatingMotionEffect("center.y", UIInterpolatingMotionEffectType.TiltAlongVerticalAxis) { MinimumRelativeValue = new NSNumber(-15), MaximumRelativeValue = new NSNumber(15) }; ImgVwBackground.AddMotionEffect(mx); ImgVwBackground.AddMotionEffect(my); if (!isLoaded) { NavigationItem.HidesBackButton = true; LoadMainItemInfo(); if (_coverImage == null) { DetailsCover.SetImage(new NSUrl(_item.cover_image_url), UIImage.FromBundle("placeholder_image.png"), SDWebImageOptions.RetryFailed, null); } else { DetailsCover.Image = _coverImage; DetailsCover.Layer.BorderWidth = 1; DetailsCover.Layer.BorderColor = UIColor.White.CGColor; } GetItemJson(); } }
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); } }
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); } }
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); }
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); } }
private void AddMenuViewControllerMotionEffects() { if (ParallaxEnabled) { foreach (var me in _menuViewContainer.MotionEffects) { _menuViewContainer.RemoveMotionEffect(me); } var interpolationHorizontal = new UIInterpolatingMotionEffect("center.x", UIInterpolatingMotionEffectType.TiltAlongHorizontalAxis); interpolationHorizontal.MinimumRelativeValue = new NSNumber(ParallaxMenuMinimumRelativeValue); interpolationHorizontal.MaximumRelativeValue = new NSNumber(ParallaxMenuMaximumRelativeValue); var interpolationVertical = new UIInterpolatingMotionEffect("center.y", UIInterpolatingMotionEffectType.TiltAlongVerticalAxis); interpolationVertical.MinimumRelativeValue = new NSNumber(ParallaxMenuMinimumRelativeValue); interpolationVertical.MaximumRelativeValue = new NSNumber(ParallaxMenuMaximumRelativeValue); _menuViewContainer.AddMotionEffect(interpolationHorizontal); _menuViewContainer.AddMotionEffect(interpolationVertical); } }
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); }
// 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); }
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); }
void AddMenuViewControllerMotionEffects() { if (_parallaxEnabled) { if (_ios7) { if (_menuViewContainer.MotionEffects != null) foreach (UIMotionEffect effect in _menuViewContainer.MotionEffects) { _menuViewContainer.RemoveMotionEffect(effect); } UIInterpolatingMotionEffect interpolationHorizontal = new UIInterpolatingMotionEffect ("center.x", UIInterpolatingMotionEffectType.TiltAlongHorizontalAxis); interpolationHorizontal.MinimumRelativeValue = NSObject.FromObject(_parallaxMenuMinimumRelativeValue); interpolationHorizontal.MaximumRelativeValue = NSObject.FromObject(_parallaxMenuMaximumRelativeValue); UIInterpolatingMotionEffect interpolationVertical = new UIInterpolatingMotionEffect("center.y", UIInterpolatingMotionEffectType.TiltAlongVerticalAxis); interpolationVertical.MinimumRelativeValue = NSObject.FromObject(_parallaxMenuMinimumRelativeValue); interpolationVertical.MaximumRelativeValue = NSObject.FromObject(_parallaxMenuMaximumRelativeValue); _menuViewContainer.AddMotionEffect(interpolationHorizontal); _menuViewContainer.AddMotionEffect(interpolationVertical); }; } }