-
-
Save martinbowling/947659 to your computer and use it in GitHub Desktop.
MonoTouch animation helper by @alex_york and @follesoe
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 characters
public static class AnimationService | |
{ | |
public static void FadeOut(this UIView view, float duration = 1.0f, float opacity = 0.0f) | |
{ | |
Animate(duration, () => { | |
view.Layer.Opacity = opacity; | |
}); | |
} | |
public static void Animate(double duration, Action block) | |
{ | |
UIView.BeginAnimations(Guid.NewGuid().ToString()); | |
UIView.SetAnimationDuration(duration); | |
block(); | |
UIView.CommitAnimations(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment