2

i've succesfully animated a simple rectangle view on the main screen (using UIView.Animate) by setting its Transform property, using rotations and translations.

In the end of the animation, i run another animation to put the view in its initial state: i set the transform property to an identity transform.

It works, but instead of starting at the current location, the animation moves abruptly the view by about 50 points, then it moves the object back to its initial position.

I tryed to set some flags: BeginFromCurrentState, ShowHideTransitionViews, OverrideInheritedDuration without success.

Any idea what's going on and how to fix it ?

Softlion
  • 12,281
  • 11
  • 58
  • 88
  • maybe that will help, not sure because of monotouch: http://stackoverflow.com/questions/17360402/why-are-animations-on-bounds-of-an-uilabel-only-working-when-increasing-the-size – peko Dec 11 '13 at 12:03
  • definitively not a duplicate, as lots of searching never lead to it. – Softlion Dec 14 '13 at 18:33

1 Answers1

0

You can use the auto reverse option to return the animation to its initial state:

UIView.Animate(2f, 0f, UIViewAnimationOptions.Autoreverse | UIViewAnimationOptions.BeginFromCurrentState | UIViewAnimationOptions.CurveEaseInOut, () => { }, null);
Krumelur
  • 32,180
  • 27
  • 124
  • 263
  • well ... it is not a simple animation. It is a combination of animations which do not occur at the same time. I need to choose by code when it goes back to its initial state. And not using the same animation. – Softlion Dec 11 '13 at 15:13
  • 1
    Maybe this helps? http://stackoverflow.com/questions/12535647/uiview-animation-jumps-at-beginning – Krumelur Dec 13 '13 at 21:17
  • Thank you Krumelur, that's it !!!! Update your answer and it will be marked as the solution. – Softlion Dec 13 '13 at 22:50
  • A remark: Autoreverse MUST be combined with Repeat. It won't do what you think without. – Softlion Dec 14 '13 at 09:29