1
How to create the effect in blue (shadow? Pulse?) as in the gif below in a Uibutton or Uiimage in Xamarin.iOS?
1
How to create the effect in blue (shadow? Pulse?) as in the gif below in a Uibutton or Uiimage in Xamarin.iOS?
1
You can call this function below, as follows:
Shine(true, meuBotao);
// muito código
Shine(false, meuBotao);
The function has the following code:
using MonoTouch.CoreGraphics;
using MonoTouch.CoreAnimation;
void Shine(bool active, UIView view) {
if (view == null)
throw new ArgumentNullException ("view");
if (active) {
view.Layer.ShadowColor = UIColor.Blue.CGColor;
view.Layer.ShadowOpacity = 0.0f;
view.Layer.ShadowRadius = 6.0f;
view.Layer.ShadowOffset = SizeF.Empty;
view.Layer.MasksToBounds = false;
var glow = CABasicAnimation.FromKeyPath("shadowOpacity");
glow.AutoReverses = true;
glow.Duration = 0.5;
glow.To = NSNumber.FromDouble (0.9);
glow.RepeatCount = int.MaxValue;
view.Layer.AddAnimation (glow, "glow");
} else {
view.Layer.RemoveAnimation ("glow");
if (view.Layer.ShadowColor == UIColor.Blue.CGColor) {
view.Layer.ShadowColor = UIColor.Clear.CGColor;
view.Layer.ShadowOpacity = 0.0f;
view.Layer.ShadowRadius = 0.0f;
view.Layer.ShadowOffset = SizeF.Empty;
view.Layer.MasksToBounds = false;
}
}
}
0
var shadowView = new UIView(textView.Frame);
shadowView.BackgroundColor = UIColor.White;
shadowView.Layer.ShadowColor = UIColor.DarkGray.CGColor;
shadowView.Layer.ShadowOpacity = 1.0f;
shadowView.Layer.ShadowRadius = 6.0f;
shadowView.Layer.ShadowOffset = new System.Drawing.SizeF(0f, 3f);
shadowView.Layer.ShouldRasterize = true;
shadowView.Layer.MasksToBounds = false;
Add(shadowView);
Add(textView);
What you want to do comes close to this?
Browser other questions tagged xamarin xamarin.ios
You are not signed in. Login or sign up in order to post.
It’s for him to keep blinking indefinitely or come up and stop with the blue shadow on him?
– Alexandre Marcondes
The effect/animation should work in an infinite loop
– brunopacola