0

我正在使用 CABasicAnimation 顺时针旋转 Image 360​​,我使用的代码是

CALayer*    _caLayer = [CALayer layer];
_caLayer.contents = (id)_logo.CGImage;  
_caLayer.frame = CGRectMake(65,158, 180,55);
[self.view.layer addSublayer:_caLayer];
CABasicAnimation*   rotation;
rotation = [CABasicAnimation animationWithKeyPath:@"transform.rotation"];
rotation.fromValue = [NSNumber numberWithFloat:0];    
rotation.toValue = [NSNumber numberWithFloat:((360*M_PI)/180)];
rotation.duration = 1.4f;
//rotation.beginTime = CACurrentMediaTime() +1;
rotation.repeatCount = 2.0;
rotation.fillMode = kCAFillModeForwards;
[_caLayer addAnimation:rotation forKey:@"360"]; 

动画效果很好..但我无法弄清楚一件事。我想从较小的尺寸开始动画图像并以正常尺寸结束。你已经在电影中看到了一些报纸会快速旋转并淡入,最后我们会在屏幕上完全看到报纸。我正在尝试这样做。我不知道该怎么做,拜托!

4

2 回答 2

1

您也可以使用以下内容,就像一个魅力

[UIView beginAnimations:@"fade in" context:nil];
[UIView setAnimationDuration:1.0];
[UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
_imageView.alpha = 0.0;
_newImageView.alpha = 1.0;
[UIView commitAnimations];
于 2012-09-05T13:47:39.973 回答
0

设置动画前的imageView帧:[imageView setFrame: CGRectMake(your Frame)];

然后继续使用循环或其他东西增加动画中的帧..

于 2012-07-30T06:48:11.950 回答