Created
November 2, 2017 19:01
-
-
Save sleimanzublidi/ccabe127ff68dca7365b90ca65a6624f to your computer and use it in GitHub Desktop.
Xamarin.iOS Pulse Animation
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 void Pulse(this UIView view, float scale, double duration = 1.0, bool repeat = true) | |
{ | |
var animation = CABasicAnimation.FromKeyPath("transform.scale"); | |
animation.Duration = duration; | |
animation.To = NSNumber.FromFloat(scale); | |
animation.TimingFunction = CAMediaTimingFunction.FromName(CAMediaTimingFunction.EaseInEaseOut); | |
animation.AutoReverses = true; | |
animation.RepeatCount = repeat ? float.MaxValue : 0; | |
view.Layer.AddAnimation(animation, "pulse"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment