我在给一棵长着生命的树做动画。就像一棵树,我希望我的UIImage留在同一个地方,这样当我把它放大时,它就会长出来。
现在它跳来跳去,也就是它从中心开始生长--我需要它从底部长出来。
是否有一种方法来设置动画的起源/基。所以比例动画从底部开始工作。
希望这是合理的。这是我的代码:
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:1];
[UIView setAnimationCurve:UIViewAnimationCurveLinear];
tree.transform = CGAffineTransformMakeScale(1.0f, 1.25f);
[UIView commitAnimations];发布于 2013-09-28 02:23:18
为此,您可能希望查看CALayer类,并将anchorPoint设置为中间底部。
- (void)viewDidLayoutSubviews
{
self.outletTestView.layer.anchorPoint = CGPointMake(0.5, 1.0);
self.outletTestView.layer.position = CGPointMake(100, 300);
}别忘了包括:
#import <QuartzCore/QuartzCore.h>并用于缩放:
CGAffineTransform CGAffineTransformScale ( CGAffineTransform t, CGFloat sx, CGFloat sy );就像这样:
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:1];
[UIView setAnimationCurve:UIViewAnimationCurveLinear];
tree.transform = CGAffineTransformScale(tree.transform, 1.0f, 1.25f);
[UIView commitAnimations];https://stackoverflow.com/questions/19062444
复制相似问题