谁能指点一下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"];
这是那个平台下的??
WPF的话可以用express做.设置动画就可以了
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"];
具体的代码可以自己搜索一下哈。