Re: Group CGAffineTransform Animations?
Re: Group CGAffineTransform Animations?
- Subject: Re: Group CGAffineTransform Animations?
- From: Chunk 1978 <email@hidden>
- Date: Wed, 17 Jun 2009 05:37:22 -0400
CGAffineTransformConcat() only allow for 2 arguments. so in the case
where i have 3 transforms, i had to concatenate the first 2 to make
"Group1", and then concatenate that with the final transform:
-=-=-=-
//Animation Block
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:.5];
[UIView setAnimationDelegate:self];
[UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
CGAffineTransform enlarge = CGAffineTransformMakeScale(1.5, 1.5);
CGAffineTransform rotate = CGAffineTransformMakeRotation(3.14);
CGAffineTransform group1 = CGAffineTransformConcat(enlarge, rotate);
CGAffineTransform move = CGAffineTransformMakeTranslation(100, 50);
square.transform = CGAffineTransformConcat(group1, move);
[UIView commitAnimations];
-=-=-=-
it seems to work find, but is this the most ideal way of doing this?
On Wed, Jun 17, 2009 at 5:21 AM, Chunk 1978<email@hidden> wrote:
> thanks! :)
>
> On Wed, Jun 17, 2009 at 5:05 AM, Jean-Daniel
> Dupas<email@hidden> wrote:
>>
>> Le 17 juin 09 à 10:53, Chunk 1978 a écrit :
>>
>>> is have this animation block with both Enlarge and Rotate, but only
>>> one work properly (the last one listed). what is the proper way to
>>> group the two transforms together:
>>>
>>> -=-=-=-
>>> //Animation Block
>>> [UIView beginAnimations:nil context:NULL];
>>> [UIView setAnimationDuration:1.0];
>>> [UIView setAnimationDelegate:self];
>>> [UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
>>>
>>> CGAffineTransform enlarge = CGAffineTransformMakeScale(1.5, 1.5);
>>> CGAffineTransform rotate = CGAffineTransformMakeRotation(3.14 / 2);
>>>
>>> square.transform = enlarge;
>>> square.transform = rotate;
>>>
>>> [UIView commitAnimations];
>>> -=-=-=-
>>
>>
>> You should concat your transformations, not make two.
>>
>> CGAffineTransform trans = CGAffineTransformMakeScale(1.5, 1.5);
>> trans = CGAffineTransformRotate(trans, 3.14 / 2);
>>
>> or in your sample above:
>> square.transform = CGAffineTransformConcat(enlarge, rotate);
>>
>>
>
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden