mysterioustrousers/MTAnimation — pull request #7 by liggitt (2013-06-02 19:19:30+00:00)
Title: Fix animating different properties with different curves at the same time

Revert takeStartSnapshot to store model values, so we only animate properties if they've actually been changed in the animations block.

At the point we animate a particular property, take the presentationLayer's value as the "from" value if UIViewAnimationOptionBeginFromCurrentState is set.

Use case: animate opacity with one curve, and position with another:

// Animate motion with bounce easing curve
[UIView mt_animateViews:@[button]
duration:0.5
options:UIViewAnimationOptionBeginFromCurrentState
timingFunction:kMTEaseOutBack
animations:^{ button.center = ...; }
completion:nil];

// Animate alpha linearly, with shorter time
[UIView mt_animateViews:@[button]
duration:0.15
options:UIViewAnimationOptionBeginFromCurrentState
timingFunction:kMTEaseInQuad
animations:^{ button.alpha = ...; }
completion:nil];

Previously, the second call to mt_animateViews would pick up the presentation position in takeStartSnapshot, see a different value for the view position, and think it needed to animate the position. It would then take over the position animation with the duration and curve intended for the alpha animation.