Change absolute layout with animation

How can I change absolute layout parameters with animation, like if a want to change the width of this:

mainLayout.Children.Add(someButton);
AbsoluteLayout.SetLayoutFlags (someButton, AbsoluteLayoutFlags.All);
AbsoluteLayout.SetLayoutBounds (someButton, new Rectangle(1.0, 0.4, 0.2, 0.14));

I can't figure out how to reach the width property like if I change a control:

someButtonAnimation.Add (0, 1, new Animation (d => someButton.WidthRequest = d, 100, 200, Easing.SinInOut));

Answers

  • I use LayoutTo(Rectangle bounds, uint length, Easing easing) for animating the width:

    var bounds = someButton.Bounds; bounds.Width = mainLayout.Bound.Width * .4; // new proportional width of .4 someButton.LayoutTo(bounds, 200, Easing.SinInOut);

Sign In or Register to comment.