开发者

Can you perform/animate 2transforms on a layer at the same time?

开发者 https://www.devze.com 2023-01-15 08:43 出处:网络
[UIView beginAnimations:@\"trans\" context:nil]; [UIView setAnimationDelegate:self]; [UIView setAnimationDid开发者_开发百科StopSelector:@selector(moveCardToSide)];
 [UIView beginAnimations:@"trans" context:nil];
 [UIView setAnimationDelegate:self];
 [UIView setAnimationDid开发者_开发百科StopSelector:@selector(moveCardToSide)];
 [UIView setAnimationDuration:1.0];

 CGRect frame = playersCard.view.layer.frame;
 frame.origin.x = -30;
 playersCard.view.layer.frame = frame;

 playersCard.view.layer.transform = CATransform3DScale(playersCard.view.layer.transform, 0.7, 0.7, 1.0);
 playersCard.view.layer.transform = CATransform3DRotate(playersCard.view.layer.transform, 30*M_PI/180, 0.0, 1.0, 0.0);

 [UIView commitAnimations];

Both of the above transforms are performed. But only the 2nd once is animated. They both animate if i run them separately. It is possible to combine them into 1 animation? Whats happening with the scale is that it jumps from 100% size to 70% then animates the rotate.


As you've written it, the transformations are being combined into a single animation. If you want two animations, with the second occurring right after the first simply move your second transform adjustment into an UIView animation block in -moveCardToSide

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号