首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >使用CAAnimation制作图像动画

使用CAAnimation制作图像动画
EN

Stack Overflow用户
提问于 2011-05-05 20:37:22
回答 1查看 2.1K关注 0票数 2

是否可以使用CAAnimation实现图像序列的动画?我也不想用UIImageView...

我需要一些类似于UIImageView的东西,在那里我们可以设置imageView.animationImages和调用startAnimation...但是使用CAAnimation

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2011-05-09 20:04:24

代码语言:javascript
复制
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"];
票数 7
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/5897759

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档