static void AnimationCircle(StackView stackView) { var circleExample = new CircleView(); stackView.AddChild(circleExample); circleExample.Allocation = new Rectangle(0, 0, 100, 100); Task.Run(() => { bool positive = true; int addition = 5; while (true) { NSApplication.SharedApplication.InvokeOnMainThread(() => { if (circleExample.Allocation.Width <= 0) { return; } var circleWidth = circleExample.Width; if (positive) { circleWidth += addition; circleExample.Width = circleWidth; if (circleWidth > 150) { positive = false; } } else { circleWidth -= addition; circleExample.Width = circleWidth; if (circleWidth < 50) { positive = true; } } }); Thread.Sleep(50); } }); var rnd = new Random(); var button = new Button() { Text = "Press" }; stackView.AddChild(button); button.Clicked += (s, e) => { var randomColor = new NGraphics.Color(rnd.NextDouble(), rnd.NextDouble(), rnd.NextDouble(), 1); circleExample.Brush = new NGraphics.SolidBrush(randomColor); }; }
public static FigmaSharp.Views.Color ToLFormsColor(this NGraphics.Color sender) { return(new FigmaSharp.Views.Color(sender.R, sender.G, sender.B, sender.A)); }
public static Xamarin.Forms.Color ToForms(this NGraphics.Color xColor) { return(new Xamarin.Forms.Color(xColor.R / 255.0, xColor.G / 255.0, xColor.B / 255.0, xColor.A / 255.0)); }
public static Color ToColor(this NGraphics.Color color) { return(new Color(color.R / 255d, color.G / 255d, color.B / 255d, color.A / 255d)); }
public static LiteForms.Color ToLFormsColor(this NGraphics.Color sender) { return(new LiteForms.Color(sender.R, sender.G, sender.B, sender.A)); }