首页 新闻 会员 周边 捐助

谁能指点一下怎么能让一幅图片沿着关键路径运动的同时逐渐变大?

0
[待解决问题]

谁能指点一下IOS平台下怎么能让一幅图片沿着关键路径运动的同时逐渐变大?

下面这段代码实现了关键路径运动,但不能变大,谁能帮帮我

path = CGPathCreateMutable();

CGPathMoveToPoint(path, NULL, 500.0, 100.0);

CGPathAddArcToPoint(path, NULL, 200.0, 380.0, 200.0, 500.0, 260.0);

CALayer *layerCar = [[[CALayer alloc] init] autorelease];

layerCar.frame = CGRectMake(20.0, 350.0, 320.0, 248.0);

layerCar.contents = (id)[UIImage imageNamed:@"car.png"].CGImage;

[self.layer addSublayer:layerCar];



CAKeyframeAnimation *animation = [CAKeyframeAnimationanimationWithKeyPath:@"position"];

animation.duration = 3.0;

animation.path = path;

animation.timingFunction =[CAMediaTimingFunctionfunctionWithName:kCAMediaTimingFunctionEaseInEaseOut];

[layerCar addAnimation:animation forKey:@"move"];
迷迷糊糊学编程的主页 迷迷糊糊学编程 | 初学一级 | 园豆:184
提问于:2012-07-25 12:05
< >
分享
所有回答(2)
0

这是那个平台下的??

WPF的话可以用express做.设置动画就可以了

xiaxia—博客园 | 园豆:128 (初学一级) | 2012-07-25 12:58
0

1. 加一个缩放动画

CABasicAnimation *scaleAnim = [CABasicAnimation animationWithKeyPath:@"transform.scale"];

2. 然后建一个CAAnimationGroup

CAAnimationGroup *animationGroup = [CAAnimationGroupanimation];

[animationGroup setAnimations:[NSArray arrayWithObjects:animation, scaleAnim, nil]];

3. 最后将动画组添加到layerCar就行了。

[layerCar addAnimation:animationGroup forKey:@"move"];

具体的代码可以自己搜索一下哈。

趣味苹果开发 | 园豆:208 (菜鸟二级) | 2013-04-27 14:14
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册