I'm trying to make a UIView animation where my image starts in the upper left corner of the screen and expands to its original size and fits in the middle of the screen. So far, I could do it separately, but when I try to combine these animations, it will only do scale animations.
Is there any way to make this work with Scaling and Translation at the same time ?
Here is what I still have:
CGAffineTransform setpointTrans = CGAffineTransformMakeTranslation(-200.0f, -200.0f); CGAffineTransform setpointScale = CGAffineTransformMakeScale(0.0f, 0.0f); _RSEImage.transform = CGAffineTransformConcat(setpointTrans, setpointScale); [UIView beginAnimations:nil context:nil]; [UIView setAnimationDelegate:self]; [UIView setAnimationDuration:5]; [UIView setAnimationCurve:UIViewAnimationCurveEaseOut]; CGAffineTransform scaleTrans = CGAffineTransformMakeScale(1.0f, 1.0f); CGAffineTransform lefttorightTrans = CGAffineTransformMakeTranslation(0.0f,0.0f); _RSEImage.transform = CGAffineTransformConcat(scaleTrans, lefttorightTrans); [UIView commitAnimations];
Ok, I realized, here is what I changed:
_RSEImage.transform = CGAffineTransformMakeScale(0.0f, 0.0f); [UIView beginAnimations:nil context:nil]; [UIView setAnimationDelegate:self]; [UIView setAnimationDuration:5]; [UIView setAnimationCurve:UIViewAnimationCurveEaseOut]; CGAffineTransform scaleTrans = CGAffineTransformMakeScale(1.0f, 1.0f); CGAffineTransform lefttorightTrans = CGAffineTransformMakeTranslation(200.0f,200.0f); _RSEImage.transform = CGAffineTransformConcat(scaleTrans, lefttorightTrans); [UIView commitAnimations];
source share