![](/img/trans.png)
[英]Method for animating images (like a movie) on iPhone without using MPMoviePlayer
[英]Animating images using CAAnimation
是否可以使用 CAAnimation 實現圖像動畫序列? 而且我不想使用 UIImageView ......
我需要類似於 UIImageView 的東西,我們可以在其中設置 imageView.animationImages 並調用 startAnimation... 但使用 CAAnimation
CAKeyframeAnimation *animationSequence = [CAKeyframeAnimation animationWithKeyPath: @"contents"];
animationSequence.calculationMode = kCAAnimationLinear;
animationSequence.autoreverses = YES;
animationSequence.duration = kDefaultAnimationDuration;
animationSequence.repeatCount = HUGE_VALF;
NSMutableArray *animationSequenceArray = [[NSMutableArray alloc] init];
for (UIImage *image in self.animationImages)
{
[animationSequenceArray addObject:(id)image.CGImage];
}
animationSequence.values = animationSequenceArray;
[animationSequenceArray release];
[self.layer addAnimation:animationSequence forKey:@"contents"];
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.