我正在使用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"];
动画效果很好..但是我找不到一件事。我想从较小的尺寸开始动画图像,并以正常尺寸结束。你已经在电影中看到过一些报纸会快速旋转并且它们会逐渐消失,最后我们会完全看到屏幕上的纸张。我想这样做。我不知道怎么做,拜托!
答案 0 :(得分:1)
你也可以使用以下内容,就像魅力一样
[UIView beginAnimations:@"fade in" context:nil];
[UIView setAnimationDuration:1.0];
[UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
_imageView.alpha = 0.0;
_newImageView.alpha = 1.0;
[UIView commitAnimations];
答案 1 :(得分:0)
在动画前设置imageView框架:[imageView setFrame: CGRectMake(your Frame)];
然后使用循环或其他东西继续增加动画中的帧..