Last active
November 2, 2017 18:59
-
-
Save sleimanzublidi/db162c8125d7d24f3f6fc5d28e417e05 to your computer and use it in GitHub Desktop.
Implementing the Twitter Scroll
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
http://www.thinkandbuild.it/implementing-the-twitter-ios-app-ui/ | |
var blur = UIBlurEffect.FromStyle(UIBlurEffectStyle.Light); | |
var blurView = new UIVisualEffectView(blur) | |
{ | |
Frame = this.Image.Bounds | |
}; | |
this.bluredImage.Image = this.Image.Image; | |
this.bluredImage.AddSubview(blurView); | |
if (cardOffset.Y < 0) | |
{ | |
var scaleFactor = (-cardOffset.Y / this.Image.Bounds.Height); | |
var sizeVariation = ((this.Image.Bounds.Height * (1f + scaleFactor)) - this.Image.Bounds.Height) / 2f; | |
var transform = CATransform3D.Identity; | |
transform = transform.Translate(0, sizeVariation, 0); | |
transform = transform.Scale(1f + scaleFactor, 1f + scaleFactor, 0); | |
this.bluredImage.Alpha = (float)Math.Min(1f, (-2 * cardOffset.Y / this.Image.Bounds.Height)); | |
this.Image.Layer.Transform = transform; | |
} | |
else | |
{ | |
this.bluredImage.Alpha = 0; | |
this.Image.Layer.Transform = CATransform3D.Identity; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment