-
-
Save Teness/2c428c65931a2d1b0bf8 to your computer and use it in GitHub Desktop.
Revisions
-
aloisdeniel revised this gist
Feb 18, 2015 . No changes.There are no files selected for viewing
-
aloisdeniel revised this gist
Feb 18, 2015 . 1 changed file with 28 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,28 @@ //Some examples from below animation gists this.view = new UIView (new CGRect (50, 50, 70, 100)); this.view.BackgroundColor = UIColor.Red; this.View.AddSubview (this.view); this.animations = new Dictionary<string, Action> () { { "FadeIn", () => view.Fade (true) }, { "FadeOut", () => view.Fade (false) }, { "RotateIn", () => view.Rotate (true) }, { "RotateOut", () => view.Rotate (false) }, { "FlipInVerticaly", () => view.FlipVerticaly (true) }, { "FlipOutVerticaly", () => view.FlipVerticaly (false) }, { "FlipInHorizontaly", () => view.FlipHorizontaly (true) }, { "FlipOutHorizontaly", () => view.FlipHorizontaly (false) }, { "SlideInFromTop", () => view.SlideVerticaly (true, true) }, { "SlideInFromBottom", () => view.SlideVerticaly (true, false) }, { "SlideInFromLeft", () => view.SlideHorizontaly (true, true) }, { "SlideInFromRight", () => view.SlideHorizontaly (true, false) }, { "SlideOutFromTop", () => view.SlideVerticaly (false, true) }, { "SlideOutFromBottom", () => view.SlideVerticaly (false, false) }, { "SlideOutFromLeft", () => view.SlideHorizontaly (false, true) }, { "SlideOutFromRight", () => view.SlideHorizontaly (false, false) }, { "ZoomIn", () => view.Zoom (true) }, { "ZoomOut", () => view.Zoom (false) }, { "ScaleIn", () => view.Scale (true) }, { "ScaleOut", () => view.Scale (false) }, }; -
aloisdeniel revised this gist
Feb 18, 2015 . 8 changed files with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes.File renamed without changes.File renamed without changes.File renamed without changes.File renamed without changes.File renamed without changes.File renamed without changes.File renamed without changes. -
aloisdeniel created this gist
Feb 18, 2015 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,14 @@ public static void Fade (this UIView view, bool isIn, double duration = 0.3, Action onFinished = null) { var minAlpha = (nfloat)0.0f; var maxAlpha = (nfloat)1.0f; view.Alpha = isIn ? minAlpha : maxAlpha; view.Transform = CGAffineTransform.MakeIdentity (); UIView.Animate (duration, 0, UIViewAnimationOptions.CurveEaseInOut, () => { view.Alpha = isIn ? maxAlpha : minAlpha; }, onFinished ); } This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,26 @@ public static void FlipHorizontaly (this UIView view, bool isIn, double duration = 0.3, Action onFinished = null) { var m34 = (nfloat)(-1 * 0.001); var minAlpha = (nfloat)0.0f; var maxAlpha = (nfloat)1.0f; view.Alpha = (nfloat)1.0; var minTransform = CATransform3D.Identity; minTransform.m34 = m34; minTransform = minTransform.Rotate ((nfloat)((isIn ? 1 : -1) * Math.PI * 0.5), (nfloat)0.0f, (nfloat)1.0f, (nfloat)0.0f); var maxTransform = CATransform3D.Identity; maxTransform.m34 = m34; view.Alpha = isIn ? minAlpha : maxAlpha; view.Layer.Transform = isIn ? minTransform : maxTransform; UIView.Animate (duration, 0, UIViewAnimationOptions.CurveEaseInOut, () => { view.Layer.AnchorPoint = new CGPoint ((nfloat)0.5, (nfloat)0.5f); view.Layer.Transform = isIn ? maxTransform : minTransform; view.Alpha = isIn ? maxAlpha : minAlpha; }, onFinished ); } This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,24 @@ public static void FlipVerticaly (this UIView view, bool isIn, double duration = 0.3, Action onFinished = null) { var m34 = (nfloat)(-1 * 0.001); var minAlpha = (nfloat)0.0f; var maxAlpha = (nfloat)1.0f; var minTransform = CATransform3D.Identity; minTransform.m34 = m34; minTransform = minTransform.Rotate ((nfloat)((isIn ? 1 : -1) * Math.PI * 0.5), (nfloat)1.0f, (nfloat)0.0f, (nfloat)0.0f); var maxTransform = CATransform3D.Identity; maxTransform.m34 = m34; view.Alpha = isIn ? minAlpha : maxAlpha; view.Layer.Transform = isIn ? minTransform : maxTransform; UIView.Animate (duration, 0, UIViewAnimationOptions.CurveEaseInOut, () => { view.Layer.AnchorPoint = new CGPoint ((nfloat)0.5, (nfloat)0.5f); view.Layer.Transform = isIn ? maxTransform : minTransform; view.Alpha = isIn ? maxAlpha : minAlpha; }, onFinished ); } This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,17 @@ public static void Rotate (this UIView view, bool isIn, bool fromLeft = true, double duration = 0.3, Action onFinished = null) { var minAlpha = (nfloat)0.0f; var maxAlpha = (nfloat)1.0f; var minTransform = CGAffineTransform.MakeRotation ((nfloat)((fromLeft ? -1 : 1) * 720)); var maxTransform = CGAffineTransform.MakeRotation ((nfloat)0.0); view.Alpha = isIn ? minAlpha : maxAlpha; view.Transform = isIn ? minTransform : maxTransform; UIView.Animate (duration, 0, UIViewAnimationOptions.CurveEaseInOut, () => { view.Alpha = isIn ? maxAlpha : minAlpha; view.Transform = isIn ? maxTransform : minTransform; }, onFinished ); } This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,17 @@ public static void Scale (this UIView view, bool isIn, double duration = 0.3, Action onFinished = null) { var minAlpha = (nfloat)0.0f; var maxAlpha = (nfloat)1.0f; var minTransform = CGAffineTransform.MakeScale ((nfloat)0.1, (nfloat)0.1); var maxTransform = CGAffineTransform.MakeScale ((nfloat)1, (nfloat)1); view.Alpha = isIn ? minAlpha : maxAlpha; view.Transform = isIn ? minTransform : maxTransform; UIView.Animate (duration, 0, UIViewAnimationOptions.CurveEaseInOut, () => { view.Alpha = isIn ? maxAlpha : minAlpha; view.Transform = isIn ? maxTransform : minTransform; }, onFinished ); } This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,17 @@ public static void SlideHorizontaly (this UIView view, bool isIn, bool fromLeft, double duration = 0.3, Action onFinished = null) { var minAlpha = (nfloat)0.0f; var maxAlpha = (nfloat)1.0f; var minTransform = CGAffineTransform.MakeTranslation ((fromLeft ? -1 : 1) * view.Bounds.Width, 0); var maxTransform = CGAffineTransform.MakeIdentity (); view.Alpha = isIn ? minAlpha : maxAlpha; view.Transform = isIn ? minTransform : maxTransform; UIView.Animate (duration, 0, UIViewAnimationOptions.CurveEaseInOut, () => { view.Alpha = isIn ? maxAlpha : minAlpha; view.Transform = isIn ? maxTransform : minTransform; }, onFinished ); } This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,17 @@ public static void SlideVerticaly (this UIView view, bool isIn, bool fromTop, double duration = 0.3, Action onFinished = null) { var minAlpha = (nfloat)0.0f; var maxAlpha = (nfloat)1.0f; var minTransform = CGAffineTransform.MakeTranslation (0, (fromTop ? -1 : 1) * view.Bounds.Height); var maxTransform = CGAffineTransform.MakeIdentity (); view.Alpha = isIn ? minAlpha : maxAlpha; view.Transform = isIn ? minTransform : maxTransform; UIView.Animate (duration, 0, UIViewAnimationOptions.CurveEaseInOut, () => { view.Alpha = isIn ? maxAlpha : minAlpha; view.Transform = isIn ? maxTransform : minTransform; }, onFinished ); } This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,17 @@ public static void Zoom (this UIView view, bool isIn, double duration = 0.3, Action onFinished = null) { var minAlpha = (nfloat)0.0f; var maxAlpha = (nfloat)1.0f; var minTransform = CGAffineTransform.MakeScale ((nfloat)2.0, (nfloat)2.0); var maxTransform = CGAffineTransform.MakeScale ((nfloat)1, (nfloat)1); view.Alpha = isIn ? minAlpha : maxAlpha; view.Transform = isIn ? minTransform : maxTransform; UIView.Animate (duration, 0, UIViewAnimationOptions.CurveEaseInOut, () => { view.Alpha = isIn ? maxAlpha : minAlpha; view.Transform = isIn ? maxTransform : minTransform; }, onFinished ); }